]> git.lyx.org Git - features.git/commitdiff
DocBook: convert a first ERT.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Fri, 19 Feb 2021 21:38:25 +0000 (22:38 +0100)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 20 Feb 2021 19:29:34 +0000 (20:29 +0100)
src/insets/InsetERT.cpp

index 61adfbdb198e700753fe51a57df375040bf2f5c8..5251b773272745d409377fb7831c726c50b41386 100644 (file)
@@ -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 << " -->";
+    }
 }