Message346205
tl;dr I think it's a difference in the CSS for the HTML5 writer.
----------------------------------------
In the HTMLTranslator class for docutils writer [1], I found the following docstring, specifically the line "The html5_polyglot writer solves this using CSS2.".
"""
The html4css1 writer has been optimized to produce visually compact
lists (less vertical whitespace). HTML's mixed content models
allow list items to contain "<li><p>body elements</p></li>" or
"<li>just text</li>" or even "<li>text<p>and body
elements</p>combined</li>", each with different effects. It would
be best to stick with strict body elements in list items, but they
affect vertical spacing in older browsers (although they really
shouldn't).
The html5_polyglot writer solves this using CSS2.
Here is an outline of the optimization:
- Check for and omit <p> tags in "simple" lists: list items
contain either a single paragraph, a nested simple list, or a
paragraph followed by a nested simple list. This means that
this list can be compact:
- Item 1.
- Item 2.
But this list cannot be compact:
- Item 1.
This second paragraph forces space between list items.
- Item 2.
- In non-list contexts, omit <p> tags on a paragraph if that
paragraph is the only child of its parent (footnotes & citations
are allowed a label first).
- Regardless of the above, in definitions, table cells, field bodies,
option descriptions, and list items, mark the first child with
'class="first"' and the last child with 'class="last"'. The stylesheet
sets the margins (top & bottom respectively) to 0 for these elements.
The ``no_compact_lists`` setting (``--no-compact-lists`` command-line
option) disables list whitespace optimization.
"""
In the HTMLTranslator class for the base [2], I found this comment:
# Do not omit <p> tags
# --------------------
#
# The HTML4CSS1 writer does this to "produce
# visually compact lists (less vertical whitespace)". This writer
# relies on CSS rules for"visual compactness".
#
# * In XHTML 1.1, e.g. a <blockquote> element may not contain
# character data, so you cannot drop the <p> tags.
# * Keeping simple paragraphs in the field_body enables a CSS
# rule to start the field-body on a new line if the label is too long
# * it makes the code simpler.
Since both comments are a few years old, I think it's in the CSS.
[1] https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/writers/html4css1/__init__.py
[2] https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/writers/_html_base.py |
|
Date |
User |
Action |
Args |
2019-06-21 11:23:14 | cheryl.sabella | set | recipients:
+ cheryl.sabella, terry.reedy, markroseman, mdk |
2019-06-21 11:23:13 | cheryl.sabella | set | messageid: <1561116193.96.0.474659698069.issue37298@roundup.psfhosted.org> |
2019-06-21 11:23:13 | cheryl.sabella | link | issue37298 messages |
2019-06-21 11:23:13 | cheryl.sabella | create | |
|