From: Georg Baum Date: Wed, 11 Dec 2013 20:54:26 +0000 (+0100) Subject: Fix writer2latex quote handling (bug #8903) X-Git-Tag: 2.1.0rc1~344 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=99cdabd206aeb836a08a4db4a10980da4ce5e1b9;p=features.git 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 23a1bf1a01..7a9fff1372 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 f7e70f8432..d598d406b6 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 ebc7d619aa..ea33b6646f 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}}