Polish plural and capitalized reference reversion.

Thanks to Scott for noticing the problem.
This commit is contained in:
Richard Heck 2017-01-05 02:50:18 -05:00
parent fe0d73dead
commit 516423c54e
2 changed files with 19 additions and 14 deletions

View File

@ -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

View File

@ -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:
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