From: Morten W. P. <mo...@ni...> - 2003-03-05 16:31:06
|
> First, why? What's your use case? The simplest solution is, just > don't use that markup in your documents. If it's important, make it > a policy decision in your organization. I'm trying to find a mix of simplified RST that can be used straight away, and at most have 4-5 different markups (easily taught), for example emphasis, bullet lists, blockquotes and simple tables. At the same time, I want to remove the ability to mess things up (``'' is turned into some sort of hyperlink) so that users can do whatever they want when not using the agreed upon markups. > Second, what should the parser do with the markup it ignores? Don't touch it, 'pass it on' in other words. > Third, which type of markup do you want to suppress, inline markup or > block-level markup? Both, I guess. > The parser (implemented in module docutils.parsers.rst.states) deals > with the two separately and differently. Block-level markup is > recognized via an ordered dispatch table; remove the entry for the > markup you don't want, and it won't be recognized. Inline > markup (class Inliner) is recognized with a large regular expression > (Inliner.patterns.initial) that's built from a data structure > (Inliner.parts), plus a table for standalone/implicit markup (URLs > etc.; Inliner.implicit_dispatch). Alter the data structure, rebuild > and reinstall the regexp, and go from there. Of course, you should > work on subclasses or instances so as not to step on toes. OK, I'll have a look at that. Again, useful info. :) > The parser is not set up for this to be really easy to do, because it > hasn't been needed yet. If there are more people out there like me, maybe it would be an idea to refactor a bit to make parts of docutils more like a 'markup parsing framework'? Make it easier to mix-n-match different markups, which could lead to diverse markup 'dialects' of STX; diverse enough to be used by common people without screwing up, and diverse enough for the syntatic programmer. > > (without using the :: markup). > > What does this mean? Something like "making the parser ignore markup without literal blocks". Regards, Morten W. Petersen Technologies: Zope, Linux, Python, HTML, CSS, PHP Homepage: http://www.nidelven-it.no Phone number: (+47) 45 44 00 69 |