[LyX/master] DocBook: convert a first ERT.

Thibaut Cuvelier tcuvelier at lyx.org
Sat Feb 20 19:41:18 UTC 2021


commit 61657bd610466a0fcd8e611d5942cff328ae6169
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Feb 19 22:38:25 2021 +0100

    DocBook: convert a first ERT.
---
 src/insets/InsetERT.cpp |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp
index 61adfbd..5251b77 100644
--- a/src/insets/InsetERT.cpp
+++ b/src/insets/InsetERT.cpp
@@ -31,6 +31,8 @@
 
 #include <sstream>
 
+#include <iostream>
+
 using namespace std;
 using namespace lyx::support;
 
@@ -107,7 +109,7 @@ void InsetERT::docbook(XMLStream & xs, OutputParams const & runparams) const
             xs << XMLStream::ESCAPE_NONE << parXML;
 		auto p = pars.begin();
 		while (true) { // For each line of this ERT paragraph...
-			os << *p;
+            os << *p;
 			++p;
 			if (p != pars.end())
 				os << "\n";
@@ -129,10 +131,14 @@ void InsetERT::docbook(XMLStream & xs, OutputParams const & runparams) const
 //		auto lay = getLayout();
 //	}
 
-	// Output the ERT as a comment with the appropriate escaping.
-	xs << XMLStream::ESCAPE_NONE << "<!-- ";
-	xs << XMLStream::ESCAPE_COMMENTS << os.str();
-	xs << XMLStream::ESCAPE_NONE << " -->";
+	// Output the ERT as a comment with the appropriate escaping if the command is not recognised.
+	if (trim(os.str()) == from_ascii("\\textquotesingle")) {
+	    xs << "'";
+	} else {
+        xs << XMLStream::ESCAPE_NONE << "<!-- ";
+        xs << XMLStream::ESCAPE_COMMENTS << os.str();
+        xs << XMLStream::ESCAPE_NONE << " -->";
+    }
 }
 
 


More information about the lyx-cvs mailing list