Revert "Merge findLastParagraph and findLastBibliographyParagraph to lower code duplication."

This reverts commit 20d65b9d97.
This commit is contained in:
Thibaut Cuvelier 2020-08-03 22:57:22 +02:00
parent fe8aff31fd
commit dedeb885f8

View File

@ -266,11 +266,10 @@ inline void closeItemTag(XMLStream & xs, Layout const & lay)
// end of convenience functions // end of convenience functions
ParagraphList::const_iterator findLast( ParagraphList::const_iterator findLastParagraph(
ParagraphList::const_iterator p, ParagraphList::const_iterator p,
ParagraphList::const_iterator const & pend, ParagraphList::const_iterator const & pend) {
LatexType type) { for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p);
for (++p; p != pend && p->layout().latextype == type; ++p);
return p; return p;
} }
@ -645,11 +644,11 @@ ParagraphList::const_iterator makeEnvironment(
break; break;
} }
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
send = findLast(par, pend, LATEX_PARAGRAPH); send = findLastParagraph(par, pend);
par = makeParagraphs(buf, xs, runparams, text, par, send); par = makeParagraphs(buf, xs, runparams, text, par, send);
break; break;
case LATEX_BIB_ENVIRONMENT: case LATEX_BIB_ENVIRONMENT:
send = findLast(par, pend, LATEX_BIB_ENVIRONMENT); send = findLastBibliographyParagraph(par, pend);
par = makeParagraphBibliography(buf, xs, runparams, text, par, send); par = makeParagraphBibliography(buf, xs, runparams, text, par, send);
break; break;
case LATEX_COMMAND: case LATEX_COMMAND:
@ -719,19 +718,22 @@ pair<ParagraphList::const_iterator, ParagraphList::const_iterator> makeAny(
} }
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
case LATEX_LIST_ENVIRONMENT: case LATEX_LIST_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT: {
// FIXME Same fix here. // FIXME Same fix here.
send = findEndOfEnvironment(par, pend); send = findEndOfEnvironment(par, pend);
par = makeEnvironment(buf, xs, ourparams, text, par, send); par = makeEnvironment(buf, xs, ourparams, text, par, send);
break; break;
case LATEX_PARAGRAPH: }
send = findLast(par, pend, LATEX_PARAGRAPH); case LATEX_BIB_ENVIRONMENT: {
par = makeParagraphs(buf, xs, ourparams, text, par, send); send = findLastBibliographyParagraph(par, pend);
break;
case LATEX_BIB_ENVIRONMENT:
send = findLast(par, pend, LATEX_BIB_ENVIRONMENT);
par = makeParagraphBibliography(buf, xs, ourparams, text, par, send); par = makeParagraphBibliography(buf, xs, ourparams, text, par, send);
break; break;
}
case LATEX_PARAGRAPH: {
send = findLastParagraph(par, pend);
par = makeParagraphs(buf, xs, ourparams, text, par, send);
break;
}
} }
return make_pair(par, send); return make_pair(par, send);