]> git.lyx.org Git - features.git/commitdiff
DocBook: documents must have a title.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 12 Oct 2020 17:26:37 +0000 (19:26 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 12 Oct 2020 17:26:37 +0000 (19:26 +0200)
src/output_docbook.cpp

index a8d509adb7723dc71c36de1bcc60ada97138ea42..e9d826b9bd30f0decc641f794262dbe511ff65b6 100644 (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) {