Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List item with a definition list inside renders incorrectly #221

Open
hamzamohdzubair opened this issue Jan 25, 2021 · 4 comments
Open

List item with a definition list inside renders incorrectly #221

hamzamohdzubair opened this issue Jan 25, 2021 · 4 comments
Labels
bad output rinohtype's output is not correct bug
Milestone

Comments

@hamzamohdzubair
Copy link

hamzamohdzubair commented Jan 25, 2021

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 hamzamohdzubair added bad output rinohtype's output is not correct bug labels Jan 25, 2021
@brechtm
Copy link
Owner

brechtm commented Feb 5, 2021

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 brechtm added this to the 0.5.1 milestone Feb 5, 2021
@brechtm brechtm changed the title Nested Lists: Wrong Layout in PDF List item with a definition list inside renders incorrectly Feb 5, 2021
@hamzamohdzubair
Copy link
Author

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

@hamzamohdzubair
Copy link
Author

This issue can be considered as solved, i think.

@brechtm
Copy link
Owner

brechtm commented May 13, 2021

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

@brechtm brechtm reopened this May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bad output rinohtype's output is not correct bug
Projects
None yet
Development

No branches or pull requests

2 participants