.html pages generation produce wrong/missing tag order

smerch avatarsmerch created an issue

I'm using sphinx (0.6.5) to produce .html files from .rst ones.

I found that if in .rst file a .. function:: has a description only (without :atr and :type) in corresponding .html file function description IS NOT wrapped in the <p> tag.

i.e. <dd>that function description</dd>

instead of <dd><p>that function description</p></dd>

Another thing is .. attribute::. While in .rst file the resulting attribute's description is drop-off <dd> tag entirely.

i.e. <dd></dd><p>that attribute description</p>

instead of <dd><p>that attribute description</p></dd>

P.S. I have attached some .rst files that cause this issues.

Comments (5)

  1. Georg Brandl

    Your first issue is how docutils works; you can set the html_compact_lists config value to False in Sphinx 1.0 to prevent it.

    The second "issue" arises because the attribute descriptions aren't indented, and therefore not seen as belonging to the ".. attribute" directive.

  2. smerch

    1. True. The docutils indeed makes the paragraphs compact (i.e. without <p> tag) when certain conditions are met. But this is not have any relation to lists mentioned, so html_compact_lists will never work for this one.

    This happens because docutils functions visit_paragraph() and should_be_compact_paragraph() does not know about sphinx.addnodes and do not care for proper formatting in this case.

    To resolve the issue I propose override the logic of docutils functions by introducing the corresponding functions in .../sphinx/writers/html.py.

    A possible solution is presented in attached html.diff file.

    2. Thank you for the hint. That helped me a lot to track a bug in auto-gen script.

    P.S. as a web-designer I ask you to draw attention to this problem. I ran into it while developing the theme for the Sphinx. Because of this, I had to use black CSS magic to make my theme look consistent. Many other web-designers will be very grateful once you correct this (including me).

  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.