DocBook: fine tuning of new lines.

This commit is contained in:
Thibaut Cuvelier 2020-08-18 05:37:46 +02:00
parent bdea21a87e
commit 25f72d392c
2 changed files with 7 additions and 7 deletions

View File

@ -2140,8 +2140,6 @@ Buffer::ExportStatus Buffer::writeDocBookSource(odocstream & os,
bool const output_body = bool const output_body =
output == FullSource || output == OnlyBody; output == FullSource || output == OnlyBody;
XMLStream xs(os);
if (output_preamble) { if (output_preamble) {
// XML preamble, no doctype needed. // 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 // 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) { if (output_body) {
params().documentClass().counters().reset();
// Start to output the document. // Start to output the document.
XMLStream xs(os);
docbookParagraphs(text(), *this, xs, runparams); docbookParagraphs(text(), *this, xs, runparams);
} }
if (output_preamble) { if (output_preamble) {
// Close the root element. // Close the root element. No need for a line break, as free text is never allowed
os << "\n</" << from_ascii(tclass.docbookroot()) << ">"; // in a root element, it must always be wrapped in some container.
os << "</" << from_ascii(tclass.docbookroot()) << ">";
} }
return ExportSuccess; return ExportSuccess;
} }

View 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) void closeBlockTag(XMLStream & xs, const std::string & tag)
{ {
xs << xml::CR(); if (!xs.isLastTagCR())
xs << xml::CR();
xs << xml::EndTag(tag); xs << xml::EndTag(tag);
xs << xml::CR(); xs << xml::CR();
} }