rinohtype icon indicating copy to clipboard operation
rinohtype copied to clipboard

List item with a definition list inside renders incorrectly

Open hamzamohdzubair opened this issue 4 years ago • 4 comments

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

hamzamohdzubair avatar Jan 25 '21 13:01 hamzamohdzubair

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
<document source="nested_lists.rst">
    <enumerated_list enumtype="arabic" prefix="" suffix=".">
        <list_item>
            <definition_list>
                <definition_list_item>
                    <term>
                        Bandits with exploration and fixed context
                    <definition>
                        <enumerated_list enumtype="arabic" prefix="" suffix=".">
                            <list_item>
                                <paragraph>
                                    The context is fixed.
                            <list_item>
                                <paragraph>
                                    This is a classical Multi-Armed Bandit Scenario
                            <list_item>
                                <paragraph>
                                    When the entire scenario is played out in a fixed environment with no moving variables
                        <definition_list>
                            <definition_list_item>
                                <term>
                                    Algorithms:
                                <definition>
                                    <enumerated_list enumtype="arabic" prefix="" suffix=".">
                                        <list_item>
                                            <paragraph>
                                                <math>
                                                    \epsilon
                                                -Greedy
                                        <list_item>
                                            <paragraph>
                                                UCB
                                        <list_item>
                                            <paragraph>
                                                Thomson Sampling
        <list_item>
            <definition_list>
                <definition_list_item>
                    <term>
                        Bandits with exploration, variable context and fixed actions
                    <definition>
                        <enumerated_list enumtype="arabic" prefix="" suffix=".">
                            <list_item>
                                <paragraph>
                                    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!

brechtm avatar Feb 05 '21 17:02 brechtm

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

hamzamohdzubair avatar May 13 '21 07:05 hamzamohdzubair

This issue can be considered as solved, i think.

hamzamohdzubair avatar May 13 '21 07:05 hamzamohdzubair

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

brechtm avatar May 13 '21 09:05 brechtm