[Moin-devel] writing a moin parser

jacob martinson martinson.jacob at gmail.com
Wed Jun 15 13:41:53 EDT 2005


i thought this was going to be a simple change, but it's proving
difficult for me so far.  i'm just trying to change wiki.py to
recognize [Pagename] as a wiki word, instead of  ["Pagename"].

-j

On 6/15/05, jacob martinson <martinson.jacob at gmail.com> wrote:
> On 6/14/05, Thomas Waldmann <tw-public at gmx.de> wrote:
> > > are there any docs anywhere on writing a moin parser?  i.e. how a
> > > parser fits in with the rest of moin, the interfaces, etc.
> >
> > Not really, but there is some example code in MoinMoin/parser/*.py. :)
> >
> > And it is not THAT complicated.
> >
> 
> I'm sure it's simple once you understand it, but looking at wiki.py
> it's pretty easy to get lost on what is actually happening.  This has
> got to be one of the best candidates for being rewritten with the re.X
> option I've ever seen:
> 
> word_rule =
> ur'(?:(?<![%(l)s])|^)%(parent)s(?:%(subpages)s(?:[%(u)s][%(l)s]+){2,})+(?![%(u)s%(l)s]+)'
> % {
> 'u': config.chars_upper,
> 'l': config.chars_lower,
> 'subpages': config.allow_subpages and (wikiutil.CHILD_PREFIX + '?') or '',
> 'parent': config.allow_subpages and (ur'(?:%s)?' %
> re.escape(PARENT_PREFIX)) or '',
> }
> 
> And I thought I knew reg expressions pretty well!
> 
> Thanks for everyone's help so far... I'm still chugging at it...
> 
> -j
>




More information about the Moin-devel mailing list