- // 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 << " -->";
+ }