commit 99cdabd206aeb836a08a4db4a10980da4ce5e1b9
Author: Georg Baum <[email protected]>
Date: Wed Dec 11 21:54:26 2013 +0100
Fix writer2latex quote handling (bug #8903)
writer2latex surrounds quotes by braces which we skip to avoid useless ERT.
I broke this in 25fe87e5 which made Parser::next_next_token() not recognize
that it needed to parse one more token. If we had a unit test for the Parser
class it would probably have detected that. Now we have at least a test for
the special quote.
diff --git a/src/tex2lyx/Parser.cpp b/src/tex2lyx/Parser.cpp
index 23a1bf1..7a9fff1 100644
--- a/src/tex2lyx/Parser.cpp
+++ b/src/tex2lyx/Parser.cpp
@@ -319,11 +319,10 @@ Token const Parser::next_next_token()
return dummy;
// If tokenize_one() has not been called after the last get_token() we
// need to tokenize two more tokens.
- if (pos_ >= tokens_.size()) {
+ if (pos_ >= tokens_.size())
+ tokenize_one();
+ if (pos_ + 1 >= tokens_.size())
tokenize_one();
- if (pos_ + 1 >= tokens_.size())
- tokenize_one();
- }
return pos_ + 1 < tokens_.size() ? tokens_[pos_ + 1] : dummy;
}
diff --git a/src/tex2lyx/test/test-insets.lyx.lyx
b/src/tex2lyx/test/test-insets.lyx.lyx
index f7e70f8..d598d40 100644
--- a/src/tex2lyx/test/test-insets.lyx.lyx
+++ b/src/tex2lyx/test/test-insets.lyx.lyx
@@ -6635,6 +6635,14 @@ script with
.
\end_layout
+\begin_layout Standard
+latex2writer outputs quotes in braces like
+\begin_inset Quotes ers
+\end_inset
+
+. We swallow the, but this was one broken (bug 8903).
+\end_layout
+
\begin_layout Section
Mathematics
\begin_inset Index idx
diff --git a/src/tex2lyx/test/test-insets.tex b/src/tex2lyx/test/test-insets.tex
index ebc7d61..ea33b66 100644
--- a/src/tex2lyx/test/test-insets.tex
+++ b/src/tex2lyx/test/test-insets.tex
@@ -654,6 +654,9 @@ builtin \textasciicircum % with a comment
A sub\textsubscript{sc\emph{ript}} and super\textsuperscript{script
with $a^2+b^2=c^2$ math}.
+latex2writer outputs quotes in braces like {\textquoteright}. We swallow the,
+but this was one broken (bug 8903).
+
\section{Mathematics\index{Mathematics}}