brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
499 stars 59 forks source link

List item with a definition list inside renders incorrectly #221

Open hamzamohdzubair opened 3 years ago

hamzamohdzubair commented 3 years ago

Issue:

This is the output of lists having nested lists, in fact lists with any inner nested content, behave like this:


image

I don't see this issue with lists that are not nested, for example the inner lists are fine.

Below is the rst file for the above output.

#. Bandits with exploration and fixed context
    #. The context is fixed.
    #. This is a classical Multi-Armed Bandit Scenario
    #. When the entire scenario is played out in a fixed environment with no moving variables

    Algorithms:
        #. :math:`\epsilon`-Greedy
        #. UCB
        #. Thomson Sampling

#. Bandits with exploration, variable context and fixed actions
    #. Actions are fixed but the context is featurized

Is there any other information I should be providing? I am assuming stylelog might be needed. Should i upload the entire file, or only relevant lines?

Technical Stats

Python 3.8.5
Sphinx==3.4.3
docutils==0.16
rinohtype==0.5.0.dev0
brechtm commented 3 years ago

Your reStructuredText file actually produces enumerated lists with definition lists (with a single item) in their items. Is that what you intended? See the output from rst2pseudoxml.py (comes with docutils) below to clearly see the document structure.

$ rst2pseudoxml.py nested_lists.rst ``` Bandits with exploration and fixed context The context is fixed. This is a classical Multi-Armed Bandit Scenario When the entire scenario is played out in a fixed environment with no moving variables Algorithms: \epsilon -Greedy UCB Thomson Sampling Bandits with exploration, variable context and fixed actions Actions are fixed but the context is featurized ```

Lists need to be preceded by a blank line (see the bullet list example in the reStructuredText Markup Specification). For your example:

#. Bandits with exploration and fixed context

    #. The context is fixed.
    #. This is a classical Multi-Armed Bandit Scenario
    #. When the entire scenario is played out in a fixed environment with no moving variables

    Algorithms:

        #. :math:`\epsilon`-Greedy
        #. UCB
        #. Thomson Sampling

#. Bandits with exploration, variable context and fixed actions

    #. Actions are fixed but the context is featurized

This is probably still not what you want, since the extra indentation produces block quotes. Make sure the indentation of the nested lists match that of the paragraph above:


#. Bandits with exploration and fixed context

   #. The context is fixed.
   #. This is a classical Multi-Armed Bandit Scenario
   #. When the entire scenario is played out in a fixed environment with no moving variables

   Algorithms:

   #. :math:`\epsilon`-Greedy
   #. UCB
   #. Thomson Sampling

#. Bandits with exploration, variable context and fixed actions

   #. Actions are fixed but the context is featurized

This produces:

image

Is that what you wanted?

All that said, your original input file should still place the definition on the same line as the list item number. I'll look into that!

hamzamohdzubair commented 3 years ago

The blank line before the inner lists actually solves the problem. Thanks alot.

hamzamohdzubair commented 3 years ago

This issue can be considered as solved, i think.

brechtm commented 3 years ago

Reopening this to track the definition-list-in-list-item rendering issue.