From: Mark E. <ei...@gm...> - 2009-08-21 16:24:40
|
On Fri, Aug 21, 2009 at 9:28 AM, Waylan Limberg<wa...@gm...> wrote: > 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. ... because it never occurred to me that there'd be "new" syntax for that... sure enough, http://www.w3.org/TR/html401/struct/links.html#h-12.1.1 (amusingly, that document *itself* still uses <a name="..."> but it puts that inside the <h3> so it avoids the problem from a different direction.) (4.01 was published in 1999, so I suppose I can't really call that "new", can I :-) > 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. Got it, thanks. > [1]: http://www.freewisdom.org/projects/python-markdown/HeaderId > > -- > ---- > \X/ /-\ `/ |_ /-\ |\| > Waylan Limberg > -- _Mark_ <ei...@th...> <ei...@gm...> |