DocBook: documents must have a title.

This commit is contained in:
Thibaut Cuvelier 2020-10-12 19:26:37 +02:00
parent 92b9c82dea
commit 82ea3d67ec

View File

@ -920,6 +920,15 @@ void outputDocBookInfo(
for (auto pit : info.mustBeInInfo)
makeAny(text, buf, xs, runparams, paragraphs.iterator_at(pit));
// If there is no title, generate one (required for the document to be valid).
// This code is called for the main document, for table cells, etc., so be precise in this condition.
if (text.isMainText() && info.mustBeInInfo.empty()) {
xs << xml::StartTag("title");
xs << "Untitled Document";
xs << xml::EndTag("title");
xs << xml::CR();
}
// Always output the abstract as the last item of the <info>, as it requires special treatment (especially if
// it contains several paragraphs that are empty).
if (hasAbstract) {