]> git.lyx.org Git - lyx.git/commitdiff
tex2lyx: Fix two bugs in nomencl import
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 22 Jul 2024 07:51:54 +0000 (09:51 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 22 Jul 2024 17:03:10 +0000 (19:03 +0200)
* The comment character % is made active to serve as an escape char
* quotation marks need to be escaped

(cherry picked from commit 5bc4c11fd601773a7ffba850524afa03eafe13f9)

src/tex2lyx/text.cpp
status.24x

index 7c63b7679f0b62eec1c1bfe7aac32435b8ee0afc..af0be81231bcf8b213fa55c86858461b0562c49c 100644 (file)
@@ -4946,10 +4946,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<bool, string> sym = convert_latexed_command_inset_arg(symbol);
                        bool literal = !sym.first;
                        string description = p.verbatim_item();
+                       // escape quotation marks
+                       description = subst(description, "\"", "\\\"");
                        pair<bool, string> desc = convert_latexed_command_inset_arg(description);
                        literal |= !desc.first;
                        if (literal) {
index 2be245c92de2bf05f225f164c87b0952e228d490..7e4886fea369c259b98c06cc946ab9e42039b1ba 100644 (file)
@@ -84,6 +84,7 @@ What's new
 
 * TEX2LYX
 
+- Fix import of nomenclature entries which contain '%' or '"' characters.
 
 
 * LYXHTML