From: Waylan L. <wa...@gm...> - 2009-08-21 13:29:23
|
On Fri, Aug 21, 2009 at 12:09 AM, Mark Eichin<ei...@gm...> wrote: > I'd like to write a treeprocessor that takes the <h2> elements and > stuffs <a name="..."> anchors before them (with the anchorname derived > from the h2 text.) Why not just set the id on the h2 tag? Like this: `<h2 id="...">`. It accomplishes the same thing and is actually considered the correct way to do it today. In fact, the HeaderId extension [1] included with Markdown already does this. Regarding the issues with ElementTree, yes, unfortunately, ET elements have no reference to their parent, thus no knowledge of their siblings, which, needless to say is very annoying. Probably my biggest gripe. But Yuri's recollection is correct. We initially tried to offer lxml as an option but there were just to many differences to make it work right with both. I believe lxml's poor Unicode support was a problem as well. As Yuri mentioned, search the list archives for more. Of course, if we could get it working, I would gladly do so for both the performance increase and references to parent elements. [1]: http://www.freewisdom.org/projects/python-markdown/HeaderId -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg |