From 516423c54e7a11ae2e4ad4ecac391108151f1a4a Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 5 Jan 2017 02:50:18 -0500 Subject: [PATCH] Polish plural and capitalized reference reversion. Thanks to Scott for noticing the problem. --- lib/doc/de/Additional.lyx | 17 ++++++++--------- lib/lyx2lyx/lyx_2_3.py | 16 +++++++++++----- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/doc/de/Additional.lyx b/lib/doc/de/Additional.lyx index 2397c544ce..5c6bc9b46e 100644 --- a/lib/doc/de/Additional.lyx +++ b/lib/doc/de/Additional.lyx @@ -1,5 +1,5 @@ -#LyX 2.2 created this file. For more info see http://www.lyx.org/ -\lyxformat 508 +#LyX 2.3 created this file. For more info see http://www.lyx.org/ +\lyxformat 526 \begin_document \begin_header \save_transient_properties true @@ -51,6 +51,7 @@ shapepar \font_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 +\use_microtype false \graphics default \default_output_format pdf2 \output_sync 0 @@ -103,7 +104,8 @@ shapepar \tocdepth 3 \paragraph_separation indent \paragraph_indentation default -\quotes_language german +\quotes_style german +\dynamic_quotes 0 \papercolumns 1 \papersides 2 \paperpagestyle headings @@ -777,8 +779,10 @@ tex2lyx -Datei einsetzen wollen, lesen Sie Abschnitt \begin_inset CommandInset ref -LatexCommand vref +LatexCommand formatted reference "sec:LaTeX-Code" +plural "false" +caps "false" \end_inset @@ -8281,7 +8285,6 @@ aa.cls \begin_layout Standard \align center - \begin_inset Flex URL status collapsed @@ -14066,8 +14069,6 @@ Unsichtbarer Text \family sans SichtbarerText -\family default - \end_layout \begin_deeper @@ -15951,8 +15952,6 @@ Left \end_inset Header -\family default - \end_layout \begin_deeper diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py index e3eab80c16..efabaed14c 100644 --- a/lib/lyx2lyx/lyx_2_3.py +++ b/lib/lyx2lyx/lyx_2_3.py @@ -1101,18 +1101,24 @@ def revert_plural_refs(document): i += 1 continue - plural = caps = label = False - if use_refstyle: + plural = caps = suffix = False + k = find_token(document.body, "LaTeXCommand formatted", i, j) + if k != -1 and use_refstyle: plural = get_bool_value(document.body, "plural", i, j, False) caps = get_bool_value(document.body, "caps", i, j, False) label = get_quoted_value(document.body, "reference", i, j) if label: - (prefix, suffix) = label.split(":", 1) + try: + (prefix, suffix) = label.split(":", 1) + except: + document.warning("No `:' separator in formatted reference at line %d!" % (i)) else: document.warning("Can't find label for reference at line %d!" % (i)) - # this effectively tests also for use_refstyle - if not ((plural or caps) and label): + # this effectively tests also for use_refstyle and a formatted reference + # we do this complicated test because we would otherwise do this erasure + # over and over and over + if not ((plural or caps) and suffix): del_token(document.body, "plural", i, j) del_token(document.body, "caps", i, j - 1) # since we deleted a line i = j - 1 -- 2.39.2