From 25bcbe766601b7bbc5b9832858ab8e5874f5d2a2 Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Sun, 2 Aug 2020 19:00:07 +0200 Subject: [PATCH] DocBook: eat a bit of that spaghetti code. --- src/output_docbook.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 339f1c36a8..d0536eee3a 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 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(); }