On 2011-11-04, Friedrich Romstedt wrote:
> 2011/11/4 Guenter Milde <mi...@users.berlios.de>:
>>> It appears by inspection of the html source code, that indeed the
>>> sublist is not contained in a <p> tag.  This appears like a mistake to
>>> me.  Because it should be a paragraph, since it is an entity on its
>>> own to be rendered such.  It also generates a rather wrong-looking
>>> visual impression of the rendered html output.

>> I don't think that a sub-list of a list should be nested in a paragraph
>> element.

> OK, I don't think I'm knowledgable enough to decide that.  But to a
> LaTeX user, a list makes a paragraph, although it might contain
> paragraphs in its items.

In Docutils, lists are "paragraph like block level objects" and the
content of a list item is always put in a paragraph (as the pseudoxml
output of the example shows):

    <paragraph>
        This not:
    <bullet_list bullet="*">
        <list_item>
            <paragraph>
                item 1
            <bullet_list bullet="-">
                <list_item>
                    <paragraph>
                        subitem 1.1
                <list_item>
                    <paragraph>
                        subitem 1.2
        <list_item>
            <paragraph>
                item 2
            <paragraph>
                second paragraph

The relationship between the objects is defined in
http://docutils.sourceforge.net/docs/ref/doctree.html#element-hierarchy
The standard HTML writer omits the paragraph tags around list item content.
(The html-strict writer is more consistent here and adjusts the CSS style
sheet to get the compact/non-compact distinction.)

In LaTeX, text is not structured by putting it in a "paragraph object"

  <p> first paragraph </p>
  <p> second paragraph </p>

(the \paragraph macro is actually a section heading).
Rather a "paragraph separator" is used:

  first paragraph
  <new-paragraph/>
  second paragraph

Hence, the question whether a list is an "instance" of a paragraph or should
be embedded into one does not apply.


BTW, in LaTeX, you can write both, lists that are separate from the
context and lists that are "embedded" - depending on whether the \begin
\end pair is offset from the pre/post text with blank lines.

In rst, embedded lists are not possible, the syntax requires blank lines
around a list. (To embed a list in a paragraph, you need a "compound"
directive.)

...

>>> I would appreciate a solution, since I'm
>>> observing this mistake since years now; although I seem to be a rare
>>> case in constructing such lists, it apprears regularly to me.

>> I suppose that the visual impression of the rendered html output is due
>> the used CSS style sheet and can be fixed in a style sheet (either as a fix
>> in the default Sphinx style or as a workaround in a custom style sheet).

> I also agree that it seems to be style sheet related.  I think it can
> be solved fully via this.  I see that the ``simple`` as well as the
> ``first`` classes are missing at least in the default + nature style
> sheets; it is the ``ol.simple, ul.simple`` that introduces
> ``margin-bottom:1em``.

> Now that I know what I have to work on I can try a fix.

Attention: AFAIK the "! important" feature is not supported by ePub. It
might be better to list the relevant objects in the specifier (divided by
``,``), e.g. ::

.first {
  margin-top: 0 }

.last, ol.simple.last, ul.simple.last, .with-subtitle {
  margin-bottom: 0 }


> P.S.: I was apparently too quick in believing that the <p> tag is
> necessarily the only solution.  Although I still believe it is a more
> elegant solution.  The browser can decide how much space to place, and
> the stylesheet does not need to say ``1em`` explicitly.  I have put my
> thoughts in a comprehensive form on
> http://friedrichromstedt.github.com/lists1.html, with an example how
> it could work out in terms of resulting HTML.

IMV, not a good idea: what happens, if you decide to separate
paragraphs by indentation like

p {
   margin-bottom: 0
}
p + p {
   text-indent:1.5em;
   margin-top:0
}

?

Besides this, the change to add the <p> tag would be required in the
Docutils html writer that does not exhibit the problem.

Günter

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to