[Doc-SIG] Adding new inline markup?

Andrew Kuchling akuchlin@mems-exchange.org
Tue, 17 Dec 2002 08:43:28 -0500


RST only supports a few different inline markup notations, such as *
and ** for emphasis, ` for interpreted things, &c.  For my application
I'd like to add some more inline markups, such as /cited text/.

Should I expect to be able to subclass Inliner in order to add new
notations?  Right now that's rather messy.  Inliner.dispatch is a
dictionary mapping symbols to handler methods, but the large regular
expression stored as Inliner.parts doesn't take this into account.  

First, is there some other, better, way of adding new inline notations?

Second, if not, should it be possible by subclassing Inliner?  A
possible way of handling this would be to add an internal method
_get_initial_pattern() to the Inliner class that synthesized the
'parts' regular expression, using self.dispatch.keys() to match all the
listed inline markups.  Inliner is fairly complicated, though, so
maybe there are additional changes that would be necessary.

--amk                                                             (www.amk.ca)
It was astonishing the number of useless things people found to do.
      -- R.H. Barlow and H.P. Lovecraft, "The Night Ocean"