Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
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.
RST file to reproduce the problem
output ODT file
output HTML file
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.
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.
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.
nested numbered and definition lists (input RST)
nested numbered and definition lists (output ODT)
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.
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.