mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
support for verbatim: step 2: tex2lyx support
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40785 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6869d5205f
commit
05446b232f
@ -1343,6 +1343,29 @@ void parse_environment(Parser & p, ostream & os, bool outer,
|
|||||||
preamble.registerAutomaticallyLoadedPackage("verbatim");
|
preamble.registerAutomaticallyLoadedPackage("verbatim");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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') {
|
||||||
|
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
|
||||||
|
os << *it;
|
||||||
|
}
|
||||||
|
os << "\n\\end_layout\n\n";
|
||||||
|
p.skip_spaces();
|
||||||
|
skip_braces(p); // eat {} that might by set by LyX behind comments
|
||||||
|
// reset to Standard layout
|
||||||
|
os << "\n\\begin_layout Standard\n";
|
||||||
|
}
|
||||||
|
|
||||||
else if (name == "lyxgreyedout") {
|
else if (name == "lyxgreyedout") {
|
||||||
eat_whitespace(p, os, parent_context, false);
|
eat_whitespace(p, os, parent_context, false);
|
||||||
parent_context.check_layout(os);
|
parent_context.check_layout(os);
|
||||||
|
@ -31,7 +31,7 @@ extern char const * const lyx_version_info;
|
|||||||
// Do not remove the comment below, so we get merge conflict in
|
// Do not remove the comment below, so we get merge conflict in
|
||||||
// independent branches. Instead add your own.
|
// independent branches. Instead add your own.
|
||||||
#define LYX_FORMAT_LYX 426 // uwestoehr: support for verbatim
|
#define LYX_FORMAT_LYX 426 // uwestoehr: support for verbatim
|
||||||
#define LYX_FORMAT_TEX2LYX 425 // uwestoehr: support for the package cancel
|
#define LYX_FORMAT_TEX2LYX 426 // uwestoehr: support for verbatim
|
||||||
|
|
||||||
#if LYX_FORMAT_FOR_TEX2LYX != LYX_FORMAT_FOR_LYX
|
#if LYX_FORMAT_FOR_TEX2LYX != LYX_FORMAT_FOR_LYX
|
||||||
#warning "tex2lyx produces an out of date file format."
|
#warning "tex2lyx produces an out of date file format."
|
||||||
|
Loading…
Reference in New Issue
Block a user