What is it? A program that takes a docutils document tree ( parsed from a RST document or programatically generated) then dumps as close as I can guess to reasonable RST back.
This lets Restructured Text be a saveable data format, which is nice.
It's not done as a docutils writer. Sorry, I couldn't make that work.
What works? Most of it.
What doesn't? A dozen directives, custom interpreted text roles, and tables.
Yes, all of those are important. But the rest seems to work ok!
Look: a 804 line RST document containing almost every feature of the language, and the only difference in the generated HTML output between the original and rst2rst's is an invisible difference in continuation lines in line blocks.
[ralsina@monty wp]$ python rst2rst.py t1.txt > t2.txt [ralsina@monty wp]$ /usr/bin/rst2html.py t1.txt t1.html ; /usr/bin/rst2html.py t2.txt t2.html [ralsina@monty wp]$ diff t1.html t2.html 468,469c468,469 < <div class="line">But I'm expecting a postal order and I can pay you back < as soon as it comes.</div> --- > <div class="line">But I'm expecting a postal order and I can pay you back</div> > <div class="line">as soon as it comes.</div> [ralsina@monty wp]$ wc -l t1.txt 804 t1.txt
Anyone knows of a real docutils test suite I could borrow?