From: Waylan L. <wa...@gm...> - 2008-02-05 14:20:03
|
On Feb 5, 2008 7:59 AM, Blake Winton <bw...@la...> wrote: > > >> Oh, and do you handle definition lists? The examples I saw were all of > >> the form: > >> definition term > >> : definition description > >> If you don't handle them, how hard do you think it would be to create a > >> plugin that would handle them? > > > > Unfortunately, that's the one thing I haven't tried to tackle yet. I > > find the whole 'description gets the markup (:), not the term' a > > little hard to wrap my mind around. I keep getting the feeling that > > we'll need to make some changes to the core to get that one to work, > > although I could be wrong. If you have any suggestions, I'm game. > > It seems to me, (after a total of 5 minutes of thinking about it ;) that > you could use a combination of pre- and post-processors. The > pre-processor would turn a line that preceeds a line that starts with a > colon (should be easy enough to find, just get lines[index-1]) into > something more recognizable for the parser, and the post processor could > turn those things into dt/dd sets. Actually, I think you could just > turn them into lines of the form "<dt>...</dt>" and "<dd>...</dd>". > Don't forget that you can associate more than one term with a definition. Second, python-markdown doesn't just substitute text for html. Rather the text is inserted into a dom object, which is later output as html when processing is complete. To do that, you need to be within the core (after preprocessors), although, I suppose you could set them aside and use a postprocessor for that. But, then what happens when a definition list is nested in an ordered or unordered list, or a blockquote? Or what if such blocklevel elements are nested within a definition? What we need is a easier way to insert additional blocklevel parsers into the core. This is something I've been chewing on for a while now and the reason I haven't tackled definition lists yet. I wanted to work out this addition extension mechanism (which I've tentatively named blockparsers) first. If anyone has any suggestions, I'm all ears. -- ---- Waylan Limberg wa...@gm... |