From: Thibaut Cuvelier Date: Tue, 18 Aug 2020 03:37:46 +0000 (+0200) Subject: DocBook: fine tuning of new lines. X-Git-Tag: lyx-2.4.0dev-acb2ca7b~181^2~70 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=25f72d392c60e93f5adb2412d5885a758fa2511a;p=features.git DocBook: fine tuning of new lines. --- diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 82fd0899c4..2ef5768771 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2140,8 +2140,6 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os, bool const output_body = output == FullSource || output == OnlyBody; - XMLStream xs(os); - if (output_preamble) { // XML preamble, no doctype needed. // Not using XMLStream for this, as the root tag would be in the tag stack and make troubles with the error @@ -2164,16 +2162,17 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os, } if (output_body) { - params().documentClass().counters().reset(); - // Start to output the document. + XMLStream xs(os); docbookParagraphs(text(), *this, xs, runparams); } if (output_preamble) { - // Close the root element. - os << "\n"; + // Close the root element. No need for a line break, as free text is never allowed + // in a root element, it must always be wrapped in some container. + os << ""; } + return ExportSuccess; } diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index b7b59413ad..ad683c713e 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -239,7 +239,8 @@ void openBlockTag(XMLStream & xs, const std::string & tag, const std::string & a void closeBlockTag(XMLStream & xs, const std::string & tag) { - xs << xml::CR(); + if (!xs.isLastTagCR()) + xs << xml::CR(); xs << xml::EndTag(tag); xs << xml::CR(); }