#151 rst2odt doesn\'t do nested definiton lists

ODT Writer (14)
N. Riesco

I'm attaching an RST file with a simple example of nested definition lists.

I can see the nested lists when I run rst2html test.rst > test.html

But when I run rst2odt test.rst > test.odt
I get everything in one definition list.


  • N. Riesco

    N. Riesco - 2010-11-05

    RST file to reproduce the problem

  • N. Riesco

    N. Riesco - 2010-11-05

    output ODT file

  • N. Riesco

    N. Riesco - 2010-11-05

    output HTML file

  • Dave Kuhlman

    Dave Kuhlman - 2010-11-09

    I've looked into this a bit. The difficulty is that definition lists, as we produce them in ODF files, are *not* really lists. odf-odt writer just adds a few styles (bold and indent) to make them look like a list.

    Maybe there is some way to nest them that I have not yet found. There is a "span" element, or some such, I believe.

    I'll see what I can do.

    - Dave

  • Dave Kuhlman

    Dave Kuhlman - 2010-11-12

    I implemented a fix and have checked it into the SVN repository.

    Because there is no such thing as a definition list in ODF files, I've implemented special styles that indent the text in definition terms and definitions so that nested lists appear nested. It seems to look correct. Perhaps the original poster can give us an evaluation on that.

    You can nest definition lists inside definition lists to a maximum level of 5.

    You can nest definition lists inside bullet or enumerated lists and vice versa.

    I suspect that if you put a definition list inside a bullet list that is inside another definition list, then you might be able to produce an incorrect level of indenting. And, I still wonder whether definition lists could be represented in ODF with some kind of indented block or maybe a bullet list without the bullets (although that *does* seem like a kludge), but I have not found a way to do that yet.

  • N. Riesco

    N. Riesco - 2010-11-15

    OK. Here comes some feedback. I'm using version python-docutils 0.6-5 in ubuntu 10.10. I've changed it as in patch r6480 in the SVN. I've also changed the method depart_term as follows:

    def depart_term(self, node):

    After these changes, rst2odt works as described in your previous comment.

    I've tried a new test case nesting both numbered and definitions lists. As you can see in the new attached files, the problem seems to be that the definition list is not indented enough.

    I wonder if this is caused by the first level in the numbered list being indented.

  • Dave Kuhlman

    Dave Kuhlman - 2010-11-15

    Hmm. This stumped me for a bit. But, after unpacking the generated .odt file, I discovered that we're producing block quotes instead of an enumerated list for your inner lists.

    If you use rst2pseudoxml.py on your reST file, you will see that Docutils is turning those inner enumerated lists into block quotes before odf-odt writer even sees them.

    I think the problem is that Docutils does not recognize "1.1." and "1.1.1" as indicating an enumerated list. Take a look at http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#enumerated-lists

    It does not mention the use of multiple dots as a possible enumerator list notation.

    When I changed to using "a.", "b." and "i.", "ii.", etc the result seems to be indented more reasonably.

    With rst2html.py, it's a little hard to see, but, if you look at the generated HTML in your text editor (or use the View/Source menu item in your Web browser), you will see that rst2html.py is also producing block quotes.

    So, I'm suggesting that you change the format of the enumerations in your inner lists.

    Please let me know if that fixes it for you, too.

    - Dave

  • N. Riesco

    N. Riesco - 2010-11-16

    Thanks a lot. I hadn't noticed the problem with "1.1." and "1.1.1"! Using "a." and "i)" fixed it.

    Again, thanks a lot.


Log in to post a comment.