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/ #LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 508 \lyxformat 526
\begin_document \begin_document
\begin_header \begin_header
\save_transient_properties true \save_transient_properties true
@ -51,6 +51,7 @@ shapepar
\font_osf false \font_osf false
\font_sf_scale 100 100 \font_sf_scale 100 100
\font_tt_scale 100 100 \font_tt_scale 100 100
\use_microtype false
\graphics default \graphics default
\default_output_format pdf2 \default_output_format pdf2
\output_sync 0 \output_sync 0
@ -103,7 +104,8 @@ shapepar
\tocdepth 3 \tocdepth 3
\paragraph_separation indent \paragraph_separation indent
\paragraph_indentation default \paragraph_indentation default
\quotes_language german \quotes_style german
\dynamic_quotes 0
\papercolumns 1 \papercolumns 1
\papersides 2 \papersides 2
\paperpagestyle headings \paperpagestyle headings
@ -777,8 +779,10 @@ tex2lyx
-Datei einsetzen -Datei einsetzen
wollen, lesen Sie Abschnitt wollen, lesen Sie Abschnitt
\begin_inset CommandInset ref \begin_inset CommandInset ref
LatexCommand vref LatexCommand formatted
reference "sec:LaTeX-Code" reference "sec:LaTeX-Code"
plural "false"
caps "false"
\end_inset \end_inset
@ -8281,7 +8285,6 @@ aa.cls
\begin_layout Standard \begin_layout Standard
\align center \align center
\begin_inset Flex URL \begin_inset Flex URL
status collapsed status collapsed
@ -14066,8 +14069,6 @@ Unsichtbarer Text
\family sans \family sans
SichtbarerText SichtbarerText
\family default
\end_layout \end_layout
\begin_deeper \begin_deeper
@ -15951,8 +15952,6 @@ Left
\end_inset \end_inset
Header Header
\family default
\end_layout \end_layout
\begin_deeper \begin_deeper

View File

@ -1101,18 +1101,24 @@ def revert_plural_refs(document):
i += 1 i += 1
continue continue
plural = caps = label = False plural = caps = suffix = False
if use_refstyle: 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) plural = get_bool_value(document.body, "plural", i, j, False)
caps = get_bool_value(document.body, "caps", i, j, False) caps = get_bool_value(document.body, "caps", i, j, False)
label = get_quoted_value(document.body, "reference", i, j) label = get_quoted_value(document.body, "reference", i, j)
if label: 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: else:
document.warning("Can't find label for reference at line %d!" % (i)) document.warning("Can't find label for reference at line %d!" % (i))
# this effectively tests also for use_refstyle # this effectively tests also for use_refstyle and a formatted reference
if not ((plural or caps) and label): # 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, "plural", i, j)
del_token(document.body, "caps", i, j - 1) # since we deleted a line del_token(document.body, "caps", i, j - 1) # since we deleted a line
i = j - 1 i = j - 1