From dedeb885f8787da6efd49e11eece75a5f6ea756d Mon Sep 17 00:00:00 2001 From: Thibaut Cuvelier Date: Mon, 3 Aug 2020 22:57:22 +0200 Subject: [PATCH] Revert "Merge findLastParagraph and findLastBibliographyParagraph to lower code duplication." This reverts commit 20d65b9d97c3b2d0f5fe29063f3a54a88f9dbfad. --- src/output_docbook.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index 434148bc86..5b788f3278 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -266,11 +266,10 @@ inline void closeItemTag(XMLStream & xs, Layout const & lay) // end of convenience functions -ParagraphList::const_iterator findLast( +ParagraphList::const_iterator findLastParagraph( ParagraphList::const_iterator p, - ParagraphList::const_iterator const & pend, - LatexType type) { - for (++p; p != pend && p->layout().latextype == type; ++p); + ParagraphList::const_iterator const & pend) { + for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p); return p; } @@ -645,11 +644,11 @@ ParagraphList::const_iterator makeEnvironment( break; } case LATEX_PARAGRAPH: - send = findLast(par, pend, LATEX_PARAGRAPH); + send = findLastParagraph(par, pend); par = makeParagraphs(buf, xs, runparams, text, par, send); break; case LATEX_BIB_ENVIRONMENT: - send = findLast(par, pend, LATEX_BIB_ENVIRONMENT); + send = findLastBibliographyParagraph(par, pend); par = makeParagraphBibliography(buf, xs, runparams, text, par, send); break; case LATEX_COMMAND: @@ -719,19 +718,22 @@ pair makeAny( } case LATEX_ENVIRONMENT: case LATEX_LIST_ENVIRONMENT: - case LATEX_ITEM_ENVIRONMENT: + case LATEX_ITEM_ENVIRONMENT: { // FIXME Same fix here. send = findEndOfEnvironment(par, pend); par = makeEnvironment(buf, xs, ourparams, text, par, send); break; - case LATEX_PARAGRAPH: - send = findLast(par, pend, LATEX_PARAGRAPH); - par = makeParagraphs(buf, xs, ourparams, text, par, send); - break; - case LATEX_BIB_ENVIRONMENT: - send = findLast(par, pend, LATEX_BIB_ENVIRONMENT); + } + case LATEX_BIB_ENVIRONMENT: { + send = findLastBibliographyParagraph(par, pend); par = makeParagraphBibliography(buf, xs, ourparams, text, par, send); break; + } + case LATEX_PARAGRAPH: { + send = findLastParagraph(par, pend); + par = makeParagraphs(buf, xs, ourparams, text, par, send); + break; + } } return make_pair(par, send);