Steps: Open Writer Write some text Add some bullets and text Add some text. File => "Save a Copy..." => "Save as Type" := "HTML" => Save Open the saved file. The result is like (fragment): <ul> <li><p style="text-indent: 0cm; margin-top: 0cm; line-height: 100%">midagi</p> <li><p style="text-indent: 0cm; margin-top: 0cm; line-height: 100%">kedasi</p> <li><p style="text-indent: 0cm; margin-top: 0cm; line-height: 100%">kuidagi</p> <li><p style="text-indent: 0cm; margin-top: 0cm; line-height: 100%">OK</p> </ul> There are no "</li>" tags after "</p>". This is a bug. Why "<p style="text-indent: 0cm; margin-top: 0cm; line-height: 100%">" needed at all as default?
On which env are you? (MacOs, Windows, Linux) Could you give a try with last stable LO version 6.4.5?
I use Win7. I just tested with LibreOffice 7.0.0.3. The result was the same.
On pc Debian x86-64 with master sources updated today, I could reproduce this.
The li element has an end tag (</li>), but itβs optional in some cases: An li element's end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element. Should we go for XHTML compliance here and close the li tag?
Hm, not so easy to correctly close and open nested lists because I have not the insight in that part of the code :(
Miklos: reading some docs it seems ending li is optional in html in some cases. But what about putting it anyway and just use this simple patch: diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index f41ac73929f9..a556f4139da4 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -354,18 +354,16 @@ Writer& OutHTML_NumberBulletListEnd( SwHTMLWriter& rWrt, } } - if (rWrt.mbXHTML) + // The list is numbered if the previous text node is numbered or any other previous text + // node is numbered. + bool bPrevIsNumbered = rInfo.IsNumbered() || *oAtLeastOneNumbered; + // XHTML </li> for the list item content, if there is an open <li>. + // also for HTML even if it's optional, it can't be bad (see tdf#135449) + if ((bListEnd && bPrevIsNumbered) || (!bListEnd && rNextInfo.IsNumbered())) { - // The list is numbered if the previous text node is numbered or any other previous text - // node is numbered. - bool bPrevIsNumbered = rInfo.IsNumbered() || *oAtLeastOneNumbered; - // XHTML </li> for the list item content, if there is an open <li>. - if ((bListEnd && bPrevIsNumbered) || (!bListEnd && rNextInfo.IsNumbered())) - { - HTMLOutFuncs::Out_AsciiTag( - rWrt.Strm(), OStringConcatenation(rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_li), - false); - } + HTMLOutFuncs::Out_AsciiTag( + rWrt.Strm(), OStringConcatenation(rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_li), + false); } if (!bListEnd) ?
Created attachment 181510 [details] Nested List Thank you for your patch! I tried to tackle this bug, too, but in a nested list case, it produces wrong HTML code :( Wrong output: <ul> <li> <p style="line-height: 100%; margin-bottom: 0in">A</p> </li> <ul> <li> <p style="line-height: 100%; margin-bottom: 0in">One</p> </li> <li> <p style="line-height: 100%; margin-bottom: 0in">Two</p> </li> </ul> <li> <p style="line-height: 100%; margin-bottom: 0in">B</p> </li> </ul> Should be: <ul> <li> <p style="line-height: 100%; margin-bottom: 0in">A</p> <ul> <li> <p style="line-height: 100%; margin-bottom: 0in">One</p> </li> <li> <p style="line-height: 100%; margin-bottom: 0in">Two</p> </li> </ul> </li> <li> <p style="line-height: 100%; margin-bottom: 0in">B</p> </li> </ul>
(In reply to Andreas Heinisch from comment #7) > Created attachment 181510 [details] > Nested List > > Thank you for your patch! I tried to tackle this bug, too, but in a nested > list case, it produces wrong HTML code :( > ... Indeed :-( (I wanted to give a try to exporting in xhtml but it's not in the list)