DocBook: start splitting environment handling in two, to have proper things for lists.

This commit is contained in:
Thibaut Cuvelier 2020-08-29 03:03:16 +02:00
parent 1bd49f9c39
commit 8656fbd520

View File

@ -370,12 +370,11 @@ void closeItemTag(XMLStream & xs, Layout const & lay)
} }
void makeAny( ParagraphList::const_iterator makeAny(Text const &,
Text const &, Buffer const &,
Buffer const &, XMLStream &,
XMLStream &, OutputParams const &,
OutputParams const &, ParagraphList::const_iterator);
ParagraphList::const_iterator);
void makeBibliography( void makeBibliography(
@ -664,7 +663,6 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
XMLStream &xs, XMLStream &xs,
OutputParams const &runparams, OutputParams const &runparams,
ParagraphList::const_iterator const & par) ParagraphList::const_iterator const & par)
>>>>>>> be6480e59c... DocBook: same refactoring for docbookSimpleAllParagraphs.
{ {
auto const end = text.paragraphs().end(); auto const end = text.paragraphs().end();
@ -751,6 +749,8 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
auto nextpar = par; auto nextpar = par;
++nextpar; ++nextpar;
closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block? closeParTag(xs, &*par, (nextpar != end) ? &*nextpar : nullptr); // TODO: switch in layout for par/block?
return nextpar;
} }
@ -791,10 +791,12 @@ ParagraphList::const_iterator makeAny(Text const &text,
makeCommand(text, buf, xs, runparams, par); makeCommand(text, buf, xs, runparams, par);
break; break;
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
makeEnvironment(text, buf, xs, runparams, par);
break;
case LATEX_LIST_ENVIRONMENT: case LATEX_LIST_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT:
makeEnvironment(buf, xs, ourparams, text, par); // Only case when makeAny() might consume more than one paragraph.
break; return makeListEnvironment(text, buf, xs, runparams, par);
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
makeParagraph(text, buf, xs, runparams, par); makeParagraph(text, buf, xs, runparams, par);
break; break;
@ -802,6 +804,8 @@ ParagraphList::const_iterator makeAny(Text const &text,
makeBibliography(text, buf, xs, runparams, par); makeBibliography(text, buf, xs, runparams, par);
break; break;
} }
++par;
return par;
} }
@ -1208,7 +1212,7 @@ void docbookParagraphs(Text const &text,
} }
// Generate this paragraph. // Generate this paragraph.
makeAny(text, buf, xs, ourparams, par); par = makeAny(text, buf, xs, ourparams, par);
} }
// If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning // If need be, close <section>s, but only at the end of the document (otherwise, dealt with at the beginning