From: Stefan R. <lis...@st...> - 2009-04-09 07:03:25
|
on 2009-04-08 17:22 Kent Tenney said the following: > Howdy, > > I am interested in the capability to read a rst file into > a doctree, write it back out, char-for-char. Just in case you did not know: I started working on a "lossless-rst-writer" quite some time ago, but got distracted. You can find it as a branch in the repository (might need some merging of trunk changes):: http://svn.berlios.de/viewcvs/docutils/branches/lossless-rst-writer/ It's not fully functional yet, but there is a test setup that might help. As there is quite some information missing in the current doctree, my plan was to get a decent lossy writer using the current doctree first and then add a lossless-parser that annotates the doctree with the necessary info. (of course adding this to the standard parser is fine with me :-) ) hope this helps, stefan > This would allow editing tools which didn't create > spurious diffs due changes in section title adornment. > > If the original title and adornment were stored in the > doctree it would make it easier to provide round-tripping. > > I discussed this a bit with David at Pycon, he was > willing to consider patches. > > I've attached 2 patches, the first, states.py.title_rawsource.patch > changes a few lines so that the lines comprising a section title > (underline, text, overline) > end up in the `rawsource` attribute of a title node. > > The second patch, states.py.name_change.patch is cosmetic, > changing a name. > > The string which ends up as `rawsource` is born on line 2852:: > > source = '%s\n%s\n%s' % (overline, title, underline) > > this patch changes it's creation and usage to `rawsource` > > (This seems in keeping with the use of `source` in document.node > to identify if the input came from a file or a string.) > > The tests run ok. > > Thanks, > Kent > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > High Quality Requirements in a Collaborative Environment. > Download a free trial of Rational Requirements Composer Now! > http://p.sf.net/sfu/www-ibm-com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Docutils-develop mailing list > Doc...@li... > https://lists.sourceforge.net/lists/listinfo/docutils-develop > > Please use "Reply All" to reply to the list. |