[LyX/2.4.x] Properly escape special characters (!, @, |) in nomenclature output

Juergen Spitzmueller spitz at lyx.org
Mon Aug 12 16:23:15 UTC 2024


commit b6cd31e99a15213e2b3f557de827f65b7a6c995c
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Aug 12 18:22:57 2024 +0200

    Properly escape special characters (!, @, |) in nomenclature output
---
 src/insets/InsetCommandParams.cpp | 8 +++++---
 status.24x                        | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp
index 9c3552a4b7..a341f73233 100644
--- a/src/insets/InsetCommandParams.cpp
+++ b/src/insets/InsetCommandParams.cpp
@@ -550,9 +550,11 @@ docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
 	// INDEX_ESCAPE is independent of the others
 	if (handling & ParamInfo::HANDLING_INDEX_ESCAPE) {
 		// Now escape special commands
-		static docstring const quote = from_ascii("\"");
+		// We only use this for nomencl, which has the
+		// escape char '%'
+		static docstring const esc_char = from_ascii("%");
 		int const nchars_escape = 4;
-		static char_type const chars_escape[nchars_escape] = { '"', '@', '|', '!' };
+		static char_type const chars_escape[nchars_escape] = { '@', '|', '!' };
 
 		if (!result.empty()) {
 			// The characters in chars_name[] need to be changed to a command when
@@ -561,7 +563,7 @@ docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
 				for (size_t i = 0, pos;
 					(pos = result.find(chars_escape[k], i)) != string::npos;
 					i = pos + 2)
-						result.replace(pos, 1, quote + chars_escape[k]);
+						result.replace(pos, 1, esc_char + chars_escape[k]);
 		}
 	}
 
diff --git a/status.24x b/status.24x
index 0520e69b48..b0a7e1d40b 100644
--- a/status.24x
+++ b/status.24x
@@ -61,6 +61,8 @@ What's new
 
 - When exporting to MathML, the argument of the \boxed{} macro is now
   correctly treated as math.
+  
+- Properly escape special characters (!, @, |) in nomenclature output.
 
 
 * USER INTERFACE


More information about the lyx-cvs mailing list