From: Juergen Spitzmueller Date: Mon, 22 Jul 2024 07:51:54 +0000 (+0200) Subject: tex2lyx: Fix two bugs in nomencl import X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5bc4c11fd601773a7ffba850524afa03eafe13f9;p=lyx.git tex2lyx: Fix two bugs in nomencl import * The comment character % is made active to serve as an escape char * quotation marks need to be escaped --- diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index cd16531d18..57fc2f0668 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -5009,10 +5009,18 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, string prefix = convert_literate_command_inset_arg(p.getArg('[', ']')); if (!prefix.empty()) os << "prefix " << '"' << prefix << '"' << "\n"; + // nomencl activates % + CatCode savecc = p.catcode('%'); + p.setCatcode('%', catActive); string symbol = p.verbatim_item(); + p.setCatcode('%', savecc); + // escape quotation marks + symbol = subst(symbol, "\"", "\\\""); pair sym = convert_latexed_command_inset_arg(symbol); bool literal = !sym.first; string description = p.verbatim_item(); + // escape quotation marks + description = subst(description, "\"", "\\\""); pair desc = convert_latexed_command_inset_arg(description); literal |= !desc.first; if (literal) {