[LyX/master] DocBook: don't use a surrounding <para> for rendered insets.

Thibaut Cuvelier tcuvelier at lyx.org
Wed Oct 13 17:04:19 UTC 2021


commit 5c735ce880d1bf702df397ecfa8418e1d4590839
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Thu Oct 7 00:07:21 2021 +0200

    DocBook: don't use a surrounding <para> for rendered insets.
---
 src/output_docbook.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 114c258..50b66fb 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -360,11 +360,13 @@ void makeParagraph(
 
 	// Plain layouts must be ignored.
 	special_case |= buf.params().documentClass().isPlainLayout(par->layout()) && !runparams.docbook_force_pars;
+
 	// Equations do not deserve their own paragraph (DocBook allows them outside paragraphs).
 	// Exception: any case that generates an <inlineequation> must still get a paragraph to be valid.
-	special_case |= nInsets == parSize && std::all_of(par->insetList().begin(), par->insetList().end(), [](InsetList::Element inset) {
+	auto isEquationSpecialCase = [](InsetList::Element inset) {
 		return inset.inset && inset.inset->asInsetMath() && inset.inset->asInsetMath()->getType() != hullSimple;
-	});
+	};
+	special_case |= nInsets == parSize && std::all_of(par->insetList().begin(), par->insetList().end(), isEquationSpecialCase);
 
 	// Things that should not get into their own paragraph. (Only valid for DocBook.)
 	static std::set<InsetCode> lyxCodeSpecialCases = {
@@ -420,6 +422,12 @@ void makeParagraph(
 	};
 	special_case |= nInsets == parSize && std::all_of(par->insetList().begin(), par->insetList().end(), isFlexSpecialCase);
 
+	// If the insets should be rendered as images, enter the special case.
+	auto isRenderedAsImageSpecialCase = [](InsetList::Element inset) {
+		return inset.inset && inset.inset->getLayout().docbookrenderasimage();
+	};
+	special_case |= nInsets == parSize && std::all_of(par->insetList().begin(), par->insetList().end(), isRenderedAsImageSpecialCase);
+
 	// Open a paragraph if it is allowed, we are not already within a paragraph, and the insets in the paragraph do
 	// not forbid paragraphs (aka special cases).
 	bool const open_par = runparams.docbook_make_pars


More information about the lyx-cvs mailing list