Re: writing a moin parser

jacob martinson <[email protected]> Wed, 15 Jun 2005 15:20:30 -0500
Newsgroups gmane.comp.web.wiki.moin.devel
Message-ID <[email protected]>
On 6/14/05, Thomas Waldmann <[email protected]> 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.
>=20
> Not really, but there is some example code in MoinMoin/parser/*.py. :)
>=20
> And it is not THAT complicated.
>=20

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 =3D=20
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


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click