From: Zed A. S. <ze...@ze...> - 2013-07-16 05:42:49
|
Hi All, I have a simple problem and so far cannot figure out *at all* how to do it. I have used up all my google juice and have read this rather terse code-lacking document: http://docutils.sourceforge.net/docs/dev/hacking.html But I still cannot figure out how to actually make a Transform and register it in any way so that it runs with my document. What I want to do is simply this: Remove all of the soft line-breaks kind of like the ones at the end of this block of text. That means I want the above paragraph to be turned into: Remove all of the soft line-breaks kind of like the ones at the end of this block of text. I have so far tried: 1. Walking with walk, walkabout, traverse looking for paragraphs and changing their contents. Nada, changes don't seem to propagate and I'd have to troll deep deep deep into how each node is implemented to make that work. 2. Hacking the reprunicode/unicode/Node/Text/TextElement cluster of awesome to remove the \n chars in data or rawsource for nodes that matter. Got close but got check-mated by how TextElement and FixedTextElement are in a deadly embrace. 3. Writing a Transform to do it and ... uh ... yeah where the hell do I put it once I've written it. So, if anyone has a simple solution to this very seemingly simple problem of doing a .replace('\n', ' ') on text that's not fixed or preformatted, please let me know. However, if your solution involves sed, awk, perl, or python that isn't walking the document tree or using docutils code, then never mind, it's easier for me to just do it myself. Thanks in advance, Zed |