]> git.lyx.org Git - features.git/commitdiff
DocBook: more robust list implementation.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 26 Oct 2020 04:11:59 +0000 (05:11 +0100)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Fri, 30 Oct 2020 00:59:34 +0000 (01:59 +0100)
src/output_docbook.cpp

index 5b303369d6d61c86a7edfa3210d160ab761bdffe..74904e1af30007ea958ee720bb52b2b94f3025a7 100644 (file)
@@ -625,9 +625,14 @@ ParagraphList::const_iterator makeListEnvironment(Text const &text,
 
        // Handle the content of the list environment, item by item.
        while (par != envend) {
 
        // Handle the content of the list environment, item by item.
        while (par != envend) {
-               Layout const & style = par->layout();
+               // Skip this paragraph if it is both empty and the last one (otherwise, there may be deeper paragraphs after).
+               auto nextpar = par;
+               ++nextpar;
+               if (par->empty() && nextpar == envend)
+                       break;
 
                // Open the item wrapper.
 
                // Open the item wrapper.
+               Layout const & style = par->layout();
                openTag(xs, style.docbookitemwrappertag(), style.docbookitemwrapperattr(), style.docbookitemwrappertagtype());
 
                // Generate the label, if need be. If it is taken from the text, sep != 0 and corresponds to the first
                openTag(xs, style.docbookitemwrappertag(), style.docbookitemwrapperattr(), style.docbookitemwrappertagtype());
 
                // Generate the label, if need be. If it is taken from the text, sep != 0 and corresponds to the first