Thanks for this! I have a better understanding now.

On Sunday, August 9, 2020 at 10:33:16 AM UTC+2 matthia...@gmail.com wrote:

> For reference, this has recently been discussed on the issue tracker:
> https://github.com/sphinx-doc/sphinx/issues/7838.
>
> It looks like docutils made the decision for the HTML5 writer to
> always keep <p> elements and handle "compact" lists with CSS (instead
> of removing <p> elements).
>
> At the time, this wasn't handled quite correctly in Sphinx, so I made
> some changes to the "basic" theme:
> https://github.com/sphinx-doc/sphinx/pull/7852.
>
> This should handle "compact" lists correctly (starting with Sphinx
> version 3.1.2), as long as the theme you are using doesn't break it.
>
> cheers,
> Matthias
>
> On Sat, Aug 8, 2020 at 6:00 PM Komiya Takeshi <i.tk...@gmail.com> wrote:
> >
> > I don't know why docutils determined this approach. But they surely
> > chose this way on moving to HTML5.
> > Please post a comment to the docutils project if you really want to
> > change this. At present, sphinx simply follows the docutils' behavior.
> >
> > 2020年8月9日(日) 0:32 Yves Chevallier <cana...@gmail.com>:
> > >
> > > Yes I am getting the same result as you. But this is an incorrect html 
> output I think and I would like to get rid of that behavior. The only way I 
> found is to visit all the `<li>` nodes afterwards and do replace node with 
> the text content. But I think it is ugly.
> > >
> > > On Saturday, August 8, 2020 at 5:12:56 PM UTC+2 i.tk...@gmail.com 
> wrote:
> > >>
> > >> Please try this on your local. We can see <p> tag on "html5_polyglot" 
> writer.
> > >> ```
> > >> >>> from docutils import core
> > >> >>> print(core.publish_parts('''
> > >> ... - a
> > >> ... - b
> > >> ... - c
> > >> ... ''', writer_name='html5_polyglot')['html_body'])
> > >> <div class="document">
> > >> <ul class="simple">
> > >> <li><p>a</p></li>
> > >> <li><p>b</p></li>
> > >> <li><p>c</p></li>
> > >> </ul>
> > >> </div>
> > >>
> > >> >>>
> > >> ```
> > >>
> > >> 2020年8月8日(土) 23:46 Yves Chevallier <cana...@gmail.com>:
> > >> >
> > >> > Not really sure how to use the HTML5 writer which I think I am 
> using...
> > >> >
> > >> > ```
> > >> > $ docker-compose run latex sphinx-build --version
> > >> > sphinx-build 2.2.0
> > >> > ```
> > >> >
> > >> > And I do use `html5.py` because I always place my breakpoints there 
> and it works.
> > >> >
> > >> > On Saturday, August 8, 2020 at 4:36:28 PM UTC+2 i.tk...@gmail.com 
> wrote:
> > >> >>
> > >> >> Hi,
> > >> >>
> > >> >> This is default behavior of docutils' reST parser. It always 
> generates
> > >> >> paragraph node.
> > >> >>
> > >> >> >By default docutils removes these `<p>`:
> > >> >>
> > >> >> Please try again with html5 writer. It seems you're using old HTML4
> > >> >> writer. It suppresses <p> tag on generating HTML. But HTML5 writer
> > >> >> does not do that.
> > >> >>
> > >> >> Thanks,
> > >> >> Takeshi KOMIYA
> > >> >>
> > >> >> 2020年8月8日(土) 21:37 Yves Chevallier <cana...@gmail.com>:
> > >> >> >
> > >> >> > I am wondering why Sphinx/Docutils add a paragraph around minor 
> text:
> > >> >> >
> > >> >> > The list:
> > >> >> >
> > >> >> > ```rst
> > >> >> > - foo
> > >> >> > - bar
> > >> >> > - baz
> > >> >> > ```
> > >> >> >
> > >> >> > Will be translated in HTML as:
> > >> >> >
> > >> >> > ```html
> > >> >> > <li><p>foo</p></li>
> > >> >> > <li><p>bar</p></li>
> > >> >> > <li><p>baz</p></li>
> > >> >> > ```
> > >> >> >
> > >> >> > In some case it gives bad formatting especially if `<p>` has 
> some margins.
> > >> >> >
> > >> >> > By default docutils removes these `<p>`:
> > >> >> >
> > >> >> > ```python
> > >> >> > >>> from docutils import core
> > >> >> > >>> print(core.publish_parts('''
> > >> >> > - a
> > >> >> > - b
> > >> >> > - c
> > >> >> > ''', writer_name='html')['html_body']))
> > >> >> > <div class="document">
> > >> >> > <ul class="simple">
> > >> >> > <li>a</li>
> > >> >> > <li>b</li>
> > >> >> > <li>c</li>
> > >> >> > </ul>
> > >> >> > </div>
> > >> >> > ```
> > >> >> >
> > >> >> > But behind the scenes they are still there...
> > >> >> >
> > >> >> > ```python
> > >> >> > >>> from docutils import core
> > >> >> > >>> print(core.publish_parts('''
> > >> >> > - a
> > >> >> > - b
> > >> >> > - c
> > >> >> > ''')['whole'])
> > >> >> > <document source="<string>">
> > >> >> > <bullet_list bullet="-">
> > >> >> > <list_item>
> > >> >> > <paragraph>
> > >> >> > a
> > >> >> > <list_item>
> > >> >> > <paragraph>
> > >> >> > b
> > >> >> > <list_item>
> > >> >> > <paragraph>
> > >> >> > c
> > >> >> > ```
> > >> >> >
> > >> >> > Why is sphinx acting differently? Is there a way to tell Sphinx 
> to not add paragraphs in such cases?
> > >> >> >
> > >> >> > --
> > >> >> > You received this message because you are subscribed to the 
> Google Groups "sphinx-users" group.
> > >> >> > To unsubscribe from this group and stop receiving emails from 
> it, send an email to sphinx-users...@googlegroups.com.
> > >> >> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/f85679d1-395c-4f05-b342-d844c0225e19n%40googlegroups.com
> .
> > >> >
> > >> > --
> > >> > You received this message because you are subscribed to the Google 
> Groups "sphinx-users" group.
> > >> > To unsubscribe from this group and stop receiving emails from it, 
> send an email to sphinx-users...@googlegroups.com.
> > >> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/029a0cf7-8ce9-4e1f-9af9-af5fd2c90d4dn%40googlegroups.com
> .
> > >
> > > --
> > > You received this message because you are subscribed to the Google 
> Groups "sphinx-users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sphinx-users...@googlegroups.com.
> > > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/4c755b51-4e6a-4a3c-a219-c68bdf792880n%40googlegroups.com
> .
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sphinx-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sphinx-users...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/CAFmkQAPchm5uWQ%2Bta%2BM6w7n%2BodP%2BTbADi9_nRHa1kApZweaP6Q%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/74168e3e-adc1-4958-840d-4a790aac5455n%40googlegroups.com.

Reply via email to