]> git.lyx.org Git - features.git/commitdiff
- text.cpp: escape backslashes in verbatim, fix a thinko
authorUwe Stöhr <uwestoehr@web.de>
Mon, 27 Feb 2012 00:55:57 +0000 (00:55 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Mon, 27 Feb 2012 00:55:57 +0000 (00:55 +0000)
- test-structure.tex: add verbatim testcase

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40798 a592a061-630c-0410-9148-cb99ea01b6c8

src/tex2lyx/test/test-structure.tex
src/tex2lyx/text.cpp

index 6ca87694a818c5abc3acacb261ee1cd66992da57..ec61f6fc43b4223d7e6d26d5cb6ec316a4cab6da 100644 (file)
@@ -288,6 +288,17 @@ labelings:
 \item [label~2] second item
 \item [{$\left[\textrm{ }\right]^{x}$}] Label with space, math and ] in it
 \end{lyxlist}
+verbatim:
+\begin{verbatim}
+verbat  im % $ 02/19/12
+hjkh
+jkh \ blah
+atesta
+
+
+zzz
+
+\end{verbatim}
 and bibliography:
 \begin{thebibliography}{9}
 \bibitem{FOO} Edward Bar. \emph{The Foo Book}. (1999)
index e57784fc0782f7963716993b14b0be2076528ef1..17e19486bef0833fdf3a02b3fb1fcd801b1b3bae 100644 (file)
@@ -1344,19 +1344,20 @@ void parse_environment(Parser & p, ostream & os, bool outer,
        }
 
        else if (name == "verbatim") {
-               eat_whitespace(p, os, parent_context, false);
                os << "\n\\begin_layout Verbatim\n";
                string const s = p.verbatimEnvironment("verbatim");
                string::const_iterator it2 = s.begin();
                for (string::const_iterator it = s.begin(), et = s.end(); it != et; ++it) {
-                       if (*it == '\n') {
+                       if (*it == '\\')
+                               os << "\\backslash ";
+                       else if (*it == '\n') {
                                it2 = it + 1;
                                // avoid adding an empty paragraph at the end
                                // if there are 2 consecutive spaces at the end ignore it
                                // because LyX will re-add a \n
                                if ((it + 1 != et) && (it + 2 != et || *it2 != '\n'))
                                        os << "\n\\end_layout\n\\begin_layout Verbatim\n";
-                       } else
+                       } else 
                                os << *it;
                }
                os << "\n\\end_layout\n\n";