http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9280
Revision: 9280
Author: xqt
Date: 2011-05-29 09:43:35 +0000 (Sun, 29 May 2011)
Log Message:
-----------
cosmetic changes PEP8
Modified Paths:
--------------
trunk/pywikipedia/pywikibot/textlib.py
Modified: trunk/pywikipedia/pywikibot/textlib.py
===================================================================
--- trunk/pywikipedia/pywikibot/textlib.py 2011-05-29 09:43:01 UTC (rev 9279)
+++ trunk/pywikipedia/pywikibot/textlib.py 2011-05-29 09:43:35 UTC (rev 9280)
@@ -621,12 +621,12 @@
% (catNamespace, title), re.I | re.M)
if newcat is None:
""" First go through and try the more restrictive regex that removes
- an entire line, if the category is the only thing on that line (this
- prevents blank lines left over in category lists following a removal.)
+ an entire line, if the category is the only thing on that line (this
+ prevents blank lines left over in category lists following a removal.)
"""
text = replaceExcept(oldtext, categoryRN, '',
- ['nowiki', 'comment', 'math', 'pre', 'source'])
+ ['nowiki', 'comment', 'math', 'pre', 'source'])
text = replaceExcept(text, categoryR, '',
['nowiki', 'comment', 'math', 'pre', 'source'])
else:
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9278
Revision: 9278
Author: xqt
Date: 2011-05-29 09:40:40 +0000 (Sun, 29 May 2011)
Log Message:
-----------
prevents category removals from leaving gaps in category listings - update from trunk r9225
Modified Paths:
--------------
branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py 2011-05-29 09:32:20 UTC (rev 9277)
+++ branches/rewrite/pywikibot/textlib.py 2011-05-29 09:40:40 UTC (rev 9278)
@@ -584,9 +584,18 @@
title = title.replace(r"\ ", "[ _]+").replace(r"\_", "[ _]+")
categoryR = re.compile(r'\[\[\s*(%s)\s*:\s*%s\s*((?:\|[^]]+)?\]\])'
% (catNamespace, title), re.I)
+ categoryRN = re.compile(r'^[^\S\n]*\[\[\s*(%s)\s*:\s*%s\s*((?:\|[^]]+)?\]\])[^\S\n]*\n'
+ % (catNamespace, title), re.I | re.M)
if newcat is None:
- text = replaceExcept(oldtext, categoryR, '',
+ """ First go through and try the more restrictive regex that removes
+ an entire line, if the category is the only thing on that line (this
+ prevents blank lines left over in category lists following a removal.)
+ """
+
+ text = replaceExcept(oldtext, categoryRN, ''
['nowiki', 'comment', 'math', 'pre', 'source'])
+ text = replaceExcept(text, categoryR, '',
+ ['nowiki', 'comment', 'math', 'pre', 'source'])
else:
text = replaceExcept(oldtext, categoryR,
'[[%s:%s\\2' % (site.namespace(14),
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9276
Revision: 9276
Author: xqt
Date: 2011-05-29 09:11:40 +0000 (Sun, 29 May 2011)
Log Message:
-----------
revert r4823 replacing obsolete codes, fix for bug #3305243; update from trunk r9275
Modified Paths:
--------------
branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py 2011-05-29 09:03:51 UTC (rev 9275)
+++ branches/rewrite/pywikibot/textlib.py 2011-05-29 09:11:40 UTC (rev 9276)
@@ -480,8 +480,8 @@
firstsites = []
for code in putfirst:
# The code may not exist in this family?
- if code in insite.family.obsolete:
- code = insite.family.obsolete[code]
+## if code in insite.family.obsolete:
+## code = insite.family.obsolete[code]
if code in insite.validLanguageLinks():
site = insite.getSite(code = code)
if site in sites:
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9275
Revision: 9275
Author: xqt
Date: 2011-05-29 09:03:51 +0000 (Sun, 29 May 2011)
Log Message:
-----------
revert r4823 replacing obsolete codes, fix for bug #3305243
Modified Paths:
--------------
trunk/pywikipedia/pywikibot/textlib.py
Modified: trunk/pywikipedia/pywikibot/textlib.py
===================================================================
--- trunk/pywikipedia/pywikibot/textlib.py 2011-05-27 10:17:56 UTC (rev 9274)
+++ trunk/pywikipedia/pywikibot/textlib.py 2011-05-29 09:03:51 UTC (rev 9275)
@@ -507,8 +507,8 @@
firstsites = []
for code in putfirst:
# The code may not exist in this family?
- if code in insite.family.obsolete:
- code = insite.family.obsolete[code]
+## if code in insite.family.obsolete:
+## code = insite.family.obsolete[code]
if code in insite.validLanguageLinks():
site = insite.getSite(code = code)
if site in sites: