From a874173660e9bbf8cc6323d03d0475aeb00798be Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Sun, 26 Jul 2020 04:59:30 +0200 Subject: [PATCH] DocBook: can finally generate "Developing LyX" without validation errors. This also removes many warnings when generating this document. --- autotests/export/docbook/Development.xml | 54 +++--------------------- src/output_docbook.cpp | 11 ++--- 2 files changed, 13 insertions(+), 52 deletions(-) diff --git a/autotests/export/docbook/Development.xml b/autotests/export/docbook/Development.xml index 9f3f3e990d..d0bc9a4fbf 100644 --- a/autotests/export/docbook/Development.xml +++ b/autotests/export/docbook/Development.xml @@ -16,34 +16,29 @@ New document setting - Whenever you introduce a new setting that is stored in the document header, a file format update is needed. Removed document setting - If a certain setting becomes obsolete and gets removed, a file format update is needed. New valid value for an existing setting, - e. g. Automatically loaded math package - The reason for this is that there is no true ERT inset for math formulas: Each command is parsed, and if a user happens to define a local command with the same name as a command that triggers an automatic load of a package, they need to be able to switch off the automatic loading of that package. This switch is stored by the use_package header setting. New language - that is stored in \language. @@ -53,21 +48,18 @@ New inset - Of course a new inset requires a file format update. New style - If a new style or inset layout is added to any layout file or module shipped with LyX, then a new file format is needed in the master (development) branch. It is possible to backport new styles to the stable version without a file format change. Removed style - If a style or inset layout is removed in any layout file or module shipped with LyX, a new file format is required. @@ -81,27 +73,23 @@ LyX: - lyx16 - LyX 1.6 file format (lyx2lyx) lyx21 - LyX 2.1 file format (lyx2lyx) xhtml - LyXHTML (native LyX HTML export) @@ -111,62 +99,53 @@ LyX + LaTeX: - dvi - DVI (8-bit latex) dvi3_texF - DVI (LuaTeX with 8-bit TeX fonts) dvi3_systemF - DVI (LuaTeX with Unicode fonts) pdf2 - PDF (pdflatex) pdf4_texF - PDF (XeTeX with 8-bit TeX fonts) pdf4_systemF - PDF (XeTeX with Unicode fonts) pdf5_texF - PDF (LuaTeX with 8-bit TeX fonts) pdf5_systemF - PDF (LuaTeX with Unicode fonts) @@ -176,20 +155,17 @@ LyX + LaTeX + postprocessing: - pdf - DVI -> PS (dvips) -> PDF (ps2pdf) pdf3 - DVI -> PDF (dvipdfm) @@ -199,113 +175,97 @@ not tested: - (or only if set as default output format in the document source) latex - LaTeX (plain) luatex - LaTeX (LuaTeX) dviluatex - LaTeX (dviluatex) pdflatex - LaTeX (pdflatex) platex - LaTeX (pLaTeX) xetex - LaTeX (XeTeX) eps3 - EPS (encapsulated Postscript) (cropped) ps - DVI -> Postscript (dvips) odf - - + text - (nor text2, ..., text4) textparagraph - - + word - - + word2 - - + wordhtml - - + - - - + + diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 489230d5cc..75c160d612 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -539,8 +539,10 @@ ParagraphList::const_iterator makeEnvironment( openLabelTag(xs, style); xs << lbl; closeLabelTag(xs, style); + } else { + // No new line after closeLabelTag. + xs << xml::CR(); } - xs << xml::CR(); } } else { // some kind of list if (style.labeltype == LABEL_MANUAL) { @@ -549,12 +551,10 @@ ParagraphList::const_iterator makeEnvironment( openLabelTag(xs, style); sep = par->firstWordDocBook(xs, runparams); closeLabelTag(xs, style); - xs << xml::CR(); } else { openLabelTag(xs, style); xs << par->params().labelString(); closeLabelTag(xs, style); - xs << xml::CR(); } } } // end label output @@ -568,7 +568,8 @@ ParagraphList::const_iterator makeEnvironment( // Maybe the item is completely empty, i.e. if the first word ends at the end of the current paragraph // AND if the next paragraph doesn't have the same depth (if there is such a paragraph). - // Common case: there is only the first word on the line, but there is a nested list instead. + // Common case: there is only the first word on the line, but there is a nested list instead + // of more text. bool emptyItem = false; if (sep == par->size()) { auto next_par = par; @@ -576,7 +577,7 @@ ParagraphList::const_iterator makeEnvironment( if (next_par == text.paragraphs().end()) // There is no next paragraph. emptyItem = true; else // There is a next paragraph: check depth. - emptyItem = par->params().depth() > next_par->params().depth(); + emptyItem = par->params().depth() >= next_par->params().depth(); } if (emptyItem) { -- 2.39.5