]> git.lyx.org Git - lyx.git/commitdiff
DocBook: better handling of paragraphs containing notes in the abstract.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 20 Jul 2020 00:47:40 +0000 (02:47 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 20 Jul 2020 01:01:41 +0000 (03:01 +0200)
src/output_docbook.cpp

index d29362eb51336f3aa04f85191fd7e0b8abffc200..e1df2cc2d3eaf7308ccc98b56877a1b0fc7eadec 100644 (file)
@@ -669,7 +669,15 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs, pit_type c
 
        pit_type cpit = bpit;
        while (cpit < epit) {
-               Layout const &style = paragraphs[cpit].layout();
+               // Skip paragraphs only containing one note.
+               Paragraph const &par = paragraphs[cpit];
+               if (par.size() == 1 && dynamic_cast<InsetNote*>(paragraphs[cpit].insetList().get(0))) {
+                       cpit += 1;
+                       continue;
+               }
+
+               // Based on layout information, store this paragraph in one set: should be in <info>, must be.
+               Layout const &style = par.layout();
                if (style.docbookininfo() == "always") {
                        mustBeInInfo.emplace(cpit);
                } else if (style.docbookininfo() == "maybe") {
@@ -680,7 +688,8 @@ DocBookInfoTag getParagraphsWithInfo(ParagraphList const &paragraphs, pit_type c
                }
                cpit += 1;
        }
-       // Now, bpit points to the last paragraph that has things that could go in <info>.
+       // Now, cpit points to the last paragraph that has things that could go in <info>.
+       // bpit is still the beginning of the <info> part.
 
        return make_tuple(shouldBeInInfo, mustBeInInfo, bpit, cpit);
 }