Commit d0d7f715 authored by Vincent Le gallic's avatar Vincent Le gallic

[wiki/macro] LostSoulsInGroups : gestion des cas [[|]]

parent f8e0ced9
......@@ -31,15 +31,25 @@ def macro_LostSoulsInGroups(macro, args):
isgroup = request.cfg.cache.page_group_regex.search
grouppages = request.rootpage.getPageList(user='', filter=isgroup)
srch = re.compile("^ \* [^ ]*", re.M)
# Expression matchant un WikiNom
wikiname_expr = "[^][| ]+"
# Cas où le wikinom est tout seul
wikiname_alone = "(?P<wikiname>%s)" % wikiname_expr
# Cas où il est avec des [[]], éventuellement avec un |
wikiname_aliased = "\[\[([^|]+\|)?(?P<wikiname2>%s)\]\]" % wikiname_expr
# Fusion des cas
wikiname = "(%s|%s)" % (wikiname_alone, wikiname_aliased)
# Contexte
srch = "^ \* %s" % wikiname
srch = re.compile(srch)
for pg in grouppages:
pged = PageEditor(request, pg)
pagelines = pged.getlines()
for lin in pagelines:
srchS = srch.match(lin)
if srchS:
st = srchS.group()
st = st[3:]
dic = srchS.groupdict()
st = dic["wikiname"] or dic["wikiname2"]
try:
usr = userlist.index(st)
except ValueError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment