]> git.lyx.org Git - features.git/commitdiff
DocBook: fine tuning of new lines.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Tue, 18 Aug 2020 03:37:46 +0000 (05:37 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 19 Sep 2020 18:43:37 +0000 (20:43 +0200)
src/Buffer.cpp
src/output_docbook.cpp

index 82fd0899c427eea3a5530375dc9811ca89dc5f91..2ef57687712da88e5871325f721f4c57e0063968 100644 (file)
@@ -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</" << from_ascii(tclass.docbookroot()) << ">";
+               // 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 << "</" << from_ascii(tclass.docbookroot()) << ">";
        }
+
        return ExportSuccess;
 }
 
index b7b59413ad5704e764e45b54f6f966e1e8eb0ac0..ad683c713e97e2c10c8ce29ebb63209a480a0fed 100644 (file)
@@ -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();
 }