checkuser, Administrators
2,635
edits
Zhuyifei1999 (talk | contribs) No edit summary |
Zhuyifei1999 (talk | contribs) No edit summary |
||
Line 88: | Line 88: | ||
newtext = text | newtext = text | ||
size_r = re.compile(ur"""(?im)(?P<all>\{\{\s*Size\s*((\s*\|\s*(?P<pages>pages|wiki[ _]pages)\s*=\s*(?P<pages_value>\d*)\s*[^\|\}]*\s*)|(\s*\|\s*(?P<pagesurl>statistics[ _]URL|wiki[ _]statistics[ _]URL)\s*=\s*(?P<pagesurl_value>https?://[^ \|\}\<]*)\s*[^\|\}]*\s*)|(\s*\|\s*(?P<wikifactor>wikiFactor)\s*=\s*(?P<wikifactor_value>\d*)\s*[^\|\}]*\s*)|(\s*\|\s*(?P<wikifactorurl>wikiFactor[ _]URL)\s*=\s*(?P<wikifactorurl_value>http://[^ \|\}\<]*)\s*[^\|\}]*\s*))+\s*\|?\s*\}\})""") | size_r = re.compile(ur"""(?im)(?P<all>\{\{\s*Size\s*((\s*\|\s*(?P<pages>pages|wiki[ _]pages)\s*=\s*(?P<pages_value>\d*)\s*[^\|\}]*\s*)|(\s*\|\s*(?P<pagesurl>statistics[ _]URL|wiki[ _]statistics[ _]URL)\s*=\s*(?P<pagesurl_value>https?://[^ \|\}\<]*)\s*[^\|\}]*\s*)|(\s*\|\s*(?P<wikifactor>wikiFactor)\s*=\s*(?P<wikifactor_value>\d*)\s*[^\|\}]*\s*)|(\s*\|\s*(?P<wikifactorurl>wikiFactor[ _]URL)\s*=\s*(?P<wikifactorurl_value>http://[^ \|\}\<]*)\s*[^\|\}]*\s*))+\s*\|?\s*\}\})\(\s*As[ _]of[ _]\s*(?P<day>day\d*)\s*(?P<month>month\d*)\s*(?P<year>year\d*)""") | ||
wtext = page.get() | |||
m = size_r.finditer( | m = size_r.finditer(wtext) | ||
all = "" | all = "" | ||
Line 105: | Line 105: | ||
wikifactor_value = i.group('wikifactor_value') and i.group('wikifactor_value').strip() or '' | wikifactor_value = i.group('wikifactor_value') and i.group('wikifactor_value').strip() or '' | ||
wikifactorurl_value = i.group('wikifactorurl_value') and i.group('wikifactorurl_value').strip() or '' | wikifactorurl_value = i.group('wikifactorurl_value') and i.group('wikifactorurl_value').strip() or '' | ||
day = i.group('day') and i.group('day').strip() or '' | |||
month = i.group('month') and i.group('month').strip() or '' | |||
year = i.group('year') and i.group('year').strip() or '' | |||
#get new values | #get new values | ||
Line 147: | Line 150: | ||
| %s = %s <!--wF source (often 'PopularPages', 'Mostvisitedpages' or 'PageHits'); if unknown leave void--> | | %s = %s <!--wF source (often 'PopularPages', 'Mostvisitedpages' or 'PageHits'); if unknown leave void--> | ||
}}""" % (pages and pages or 'pages', pages_value and pages_value or '', pagesurl and pagesurl or 'statistics URL', pagesurl_value and pagesurl_value or '', wikifactor and wikifactor or 'wikiFactor', wikifactor_value and wikifactor_value or '', wikifactorurl and wikifactorurl or 'wikiFactor URL', wikifactorurl_value and wikifactorurl_value or '') | }}""" % (pages and pages or 'pages', pages_value and pages_value or '', pagesurl and pagesurl or 'statistics URL', pagesurl_value and pagesurl_value or '', wikifactor and wikifactor or 'wikiFactor', wikifactor_value and wikifactor_value or '', wikifactorurl and wikifactorurl or 'wikiFactor URL', wikifactorurl_value and wikifactorurl_value or '') | ||
newtext = text.replace(all, newvalues) | |||
if not self.save(newtext, page, self.summary): | if not self.save(newtext, page, self.summary): |