From: Jean-Marc Lasgouttes Date: Tue, 12 Feb 2013 17:36:25 +0000 (+0100) Subject: Handle properly insets which have the PassThru property X-Git-Tag: 2.1.0beta1~636 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3d2dcab03f4df849ee12d81fa3abc9e993d8c8c6;p=features.git Handle properly insets which have the PassThru property This fixes in particular bug 5312: % escape in \url{} treated as TeX comment start by importer --- diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index f9888df654..855ac28e99 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1698,7 +1698,14 @@ void parse_environment(Parser & p, ostream & os, bool outer, begin_inset(os, "Flex "); os << to_utf8(newinsetlayout->name()) << '\n' << "status collapsed\n"; - parse_text_in_inset(p, os, FLAG_END, false, parent_context, newinsetlayout); + if (newinsetlayout->isPassThru()) { + string const arg = p.verbatimEnvironment(name); + Context context(true, parent_context.textclass, + &parent_context.textclass.plainLayout(), + parent_context.layout); + output_ert(os, arg, parent_context); + } else + parse_text_in_inset(p, os, FLAG_END, false, parent_context, newinsetlayout); end_inset(os); } @@ -4476,7 +4483,20 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, begin_inset(os, "Flex "); os << to_utf8(newinsetlayout->name()) << '\n' << "status collapsed\n"; - parse_text_in_inset(p, os, FLAG_ITEM, false, context, newinsetlayout); + if (newinsetlayout->isPassThru()) { + // set catcodes to verbatim early, just in case. + p.setCatcodes(VERBATIM_CATCODES); + string delim = p.get_token().asInput(); + if (delim != "{") + cerr << "Warning: bad delimiter for command " << t.asInput() << endl; + string const arg = p.verbatimStuff("}"); + Context newcontext(true, context.textclass); + if (newinsetlayout->forcePlainLayout()) + newcontext.layout = &context.textclass.plainLayout(); + output_ert(os, arg, newcontext); + } else + + parse_text_in_inset(p, os, FLAG_ITEM, false, context, newinsetlayout); end_inset(os); }