[LyX/master] DocBook: eat a bit of that spaghetti code.

Thibaut Cuvelier tcuvelier at lyx.org
Mon Aug 3 13:39:49 UTC 2020


commit 25bcbe766601b7bbc5b9832858ab8e5874f5d2a2
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Sun Aug 2 19:00:07 2020 +0200

    DocBook: eat a bit of that spaghetti code.
---
 src/output_docbook.cpp |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 339f1c3..d0536ee 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -202,14 +202,10 @@ void openParTag(XMLStream & xs, const Paragraph * par, const Paragraph * prevpar
 	// first paragraph of an author, then merging with the previous tag does not make sense. Say the
 	// next paragraph is the affiliation, then it should be output in the same <author> tag (different
 	// layout, same wrapper tag).
-	bool openWrapper = false;
-	if (prevpar == nullptr) {
-		openWrapper = lay.docbookwrappertag() != "NONE";
-	} else {
+	bool openWrapper = lay.docbookwrappertag() != "NONE";
+	if (prevpar != nullptr) {
 		Layout const & prevlay = prevpar->layout();
-		if (prevlay.docbookwrappertag() == "NONE") {
-			openWrapper = lay.docbookwrappertag() != "NONE";
-		} else {
+		if (prevlay.docbookwrappertag() != "NONE") {
 			openWrapper = prevlay.docbookwrappertag() == lay.docbookwrappertag()
 					&& !lay.docbookwrappermergewithprevious();
 		}
@@ -238,14 +234,10 @@ void closeTag(XMLStream & xs, Paragraph const * par, Paragraph const * nextpar)
 		nextpar = nullptr;
 
 	// See comment in openParTag.
-	bool closeWrapper = false;
-	if (nextpar == nullptr) {
-		closeWrapper = lay.docbookwrappertag() != "NONE";
-	} else {
+	bool closeWrapper = lay.docbookwrappertag() != "NONE";
+	if (nextpar != nullptr) {
 		Layout const & nextlay = nextpar->layout();
-		if (nextlay.docbookwrappertag() == "NONE") {
-			closeWrapper = lay.docbookwrappertag() != "NONE";
-		} else {
+		if (nextlay.docbookwrappertag() != "NONE") {
 			closeWrapper = nextlay.docbookwrappertag() == lay.docbookwrappertag()
 					&& !nextlay.docbookwrappermergewithprevious();
 		}


More information about the lyx-cvs mailing list