[LyX/master] Escape standalone ampersands in xhtml InsetCitation

Juergen Spitzmueller spitz at lyx.org
Wed Oct 16 10:55:52 UTC 2024


commit 1865738417cac31af36b5db9a40c17209fa072c0
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Oct 16 12:55:11 2024 +0200

    Escape standalone ampersands in xhtml InsetCitation
---
 src/insets/InsetCitation.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 73a17e70ff..ec3374f47f 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -663,7 +663,9 @@ docstring InsetCitation::xhtml(XMLStream & xs, OutputParams const &) const
 		return docstring();
 
 	// have to output this raw, because generateLabel() will include tags
-	xs << XMLStream::ESCAPE_NONE << generateLabel(true);
+	// but we need to escape standalone ampersands
+	xs << XMLStream::ESCAPE_NONE
+	   << subst(generateLabel(true), from_ascii(" & "), from_ascii(" & "));
 
 	return docstring();
 }


More information about the lyx-cvs mailing list