[LyX/master] DocBook: documents must have a title.

Thibaut Cuvelier tcuvelier at lyx.org
Mon Oct 12 16:58:39 UTC 2020


commit 82ea3d67ecdfcbae703109e9aab980f008fd76fe
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Mon Oct 12 19:26:37 2020 +0200

    DocBook: documents must have a title.
---
 src/output_docbook.cpp |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index a8d509a..e9d826b 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -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) {


More information about the lyx-cvs mailing list