mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
- text.cpp: escape backslashes in verbatim, fix a thinko
- test-structure.tex: add verbatim testcase git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40798 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c73d9adeb7
commit
8bca3e510f
@ -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)
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user