A
Ara.T.Howard
hi-
i know nada about python so please forgive me if this is way off base. i'm
trying to fix a bug in MoinMoin whereby
WordsWithTwoCapsInARowLike
^^
^^
^^
do not become WikiNames. this is because the the wikiname pattern is
basically
/([A-Z][a-z]+){2,}/
but should be (IMHO)
/([A-Z]+[a-z]+){2,}/
however, the way the patterns are constructed like
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'm not that familiar with python syntax. to me this looks like a map
used to bind variables into the regex - or is it binding into a string then
compiling that string into a regex - regexs don't seem to be literal objects
in pythong AFAIK... i'm thinking i need something like
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 this seems to work - but i'm wondering what the 's' in '%(u)s' implies?
obviously the u is the char range (unicode?)... but what's the 's'?
i'm looking at
http://docs.python.org/lib/re-syntax.html
http://www.amk.ca/python/howto/regex/
and coming up dry. sorry i don't have more time to rtfm - just want to
implement this simple fix and get on to fcgi configuration! ;-)
cheers.
-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple. My religion is kindness.
| --Tenzin Gyatso
===============================================================================
i know nada about python so please forgive me if this is way off base. i'm
trying to fix a bug in MoinMoin whereby
WordsWithTwoCapsInARowLike
^^
^^
^^
do not become WikiNames. this is because the the wikiname pattern is
basically
/([A-Z][a-z]+){2,}/
but should be (IMHO)
/([A-Z]+[a-z]+){2,}/
however, the way the patterns are constructed like
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'm not that familiar with python syntax. to me this looks like a map
used to bind variables into the regex - or is it binding into a string then
compiling that string into a regex - regexs don't seem to be literal objects
in pythong AFAIK... i'm thinking i need something like
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 this seems to work - but i'm wondering what the 's' in '%(u)s' implies?
obviously the u is the char range (unicode?)... but what's the 's'?
i'm looking at
http://docs.python.org/lib/re-syntax.html
http://www.amk.ca/python/howto/regex/
and coming up dry. sorry i don't have more time to rtfm - just want to
implement this simple fix and get on to fcgi configuration! ;-)
cheers.
-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple. My religion is kindness.
| --Tenzin Gyatso
===============================================================================