Revision: 7892
Author: xqt
Date: 2010-01-26 11:39:04 +0000 (Tue, 26 Jan 2010)
Log Message:
-----------
fixing_redirects: do not show content around the link. Use showDiff since we run in autonomous mode;
solve_disambiguation: additional exceptions, do no show content around the link if we do -always the same.
Modified Paths:
--------------
trunk/pywikipedia/fixing_redirects.py
trunk/pywikipedia/solve_disambiguation.py
Modified: trunk/pywikipedia/fixing_redirects.py
===================================================================
--- trunk/pywikipedia/fixing_redirects.py 2010-01-25 12:56:41 UTC (rev 7891)
+++ trunk/pywikipedia/fixing_redirects.py 2010-01-26 11:39:04 UTC (rev 7892)
@@ -97,7 +97,7 @@
context = 15
# at the beginning of the link, start red color.
# at the end of the link, reset the color to default
- wikipedia.output(text[max(0, m.start() - context) : m.start()] + '\03{lightred}' + text[m.start() : m.end()] + '\03{default}' + text[m.end() : m.end() + context])
+ #wikipedia.output(text[max(0, m.start() - context) : m.start()] + '\03{lightred}' + text[m.start() : m.end()] + '\03{default}' + text[m.end() : m.end() + context])
choice = 'y'
# The link looks like this:
@@ -163,6 +163,7 @@
text = treat(text, page2, target)
if text != page.get():
comment = wikipedia.translate(mysite, msg)
+ wikipedia.showDiff(page.get() ,text)
try:
page.put(text, comment)
except (wikipedia.Error):
Modified: trunk/pywikipedia/solve_disambiguation.py
===================================================================
--- trunk/pywikipedia/solve_disambiguation.py 2010-01-25 12:56:41 UTC (rev 7891)
+++ trunk/pywikipedia/solve_disambiguation.py 2010-01-26 11:39:04 UTC (rev 7892)
@@ -248,14 +248,22 @@
],
'de': [
u'.+/Archiv.*',
+ u'.+/[aA]rchiv.*',
+ u'.+/Baustelle.*',
u'.+/Spielwiese',
+ u'.+/[tT]est.*',
+ u'Benutzer:.+/[Ll]og.*',
u'Benutzer:C.Löser/.+',
u'Benutzer:Katharina/Begriffsklärungen',
u'Benutzer:Kirschblut/.+buchstabenkürzel',
u'Benutzer:Mathias Schindler/.+',
u'Benutzer:Noisper/Dingliste/[A-Z]',
+ u'Benutzer:Professor Einstein.*'
+ u'Benutzer:Sebbot/.+',
u'Benutzer:SirJective/.+',
- u'Benutzer:SrbBot/Index/.+',
+ u'Benutzer:Srbauer.*',
+ u'Benutzer:Steindy.*',
+ u'Benutzer:SrbBot.*',
u'Benutzer:PortalBot/.+',
u'Benutzer:Xqbot/.+',
u'Benutzer Diskussion:.+',
@@ -263,6 +271,7 @@
u'Liste griechischer Wortstämme in deutschen Fremdwörtern',
u'Liste von Gräzismen',
u'Portal:Abkürzungen/.+',
+ u'Portal:Astronomie/Moves',
u'Wikipedia:Administratoren/Anfragen',
u'Wikipedia:Archiv/.+',
u'Wikipedia:Artikelwünsche/Ding-Liste/[A-Z]',
@@ -650,11 +659,10 @@
# Highlight the title in purple.
pywikibot.output(u"\n\n>>> \03{lightpurple}%s\03{default} <<<" % refPage.title())
- # at the beginning of the link, start red color.
- # at the end of the link, reset the color to default
- pywikibot.output(text[max(0, m.start() - context) : m.start()] + '\03{lightred}' + text[m.start() : m.end()] + '\03{default}' + text[m.end() : m.end() + context])
-
if not self.always:
+ # at the beginning of the link, start red color.
+ # at the end of the link, reset the color to default
+ pywikibot.output(text[max(0, m.start() - context) : m.start()] + '\03{lightred}' + text[m.start() : m.end()] + '\03{default}' + text[m.end() : m.end() + context])
if edited:
choice = pywikibot.input(u"Option (#, r#, [s]kip link, [e]dit page, [n]ext page, [u]nlink, [q]uit\n"
" [m]ore context, [l]ist, [a]dd new, x=save in this form):")
Revision: 7891
Author: xqt
Date: 2010-01-25 12:56:41 +0000 (Mon, 25 Jan 2010)
Log Message:
-----------
Bot breaks categories if link contains a template, see http://la.wikipedia.org/w/index.php?title=997_Priska&diff=prev&oldid=1038880 (bugfix)
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2010-01-25 09:36:56 UTC (rev 7890)
+++ trunk/pywikipedia/wikipedia.py 2010-01-25 12:56:41 UTC (rev 7891)
@@ -445,7 +445,11 @@
break
sectionStart = t.find(u'#')
- if sectionStart > 0:
+ # Categories does not have sections.
+ # But maybe there are magic words like {{#time|}}
+ # TODO: recognize magic word and templates inside links
+ # see http://la.wikipedia.org/w/index.php?title=997_Priska&diff=prev&oldid=1038880
+ if sectionStart > 0 and self._namespace not in [14]:
self._section = t[sectionStart+1 : ].lstrip(" ")
self._section = sectionencode(self._section,
self.site().encoding())
Revision: 7887
Author: xqt
Date: 2010-01-21 17:47:24 +0000 (Thu, 21 Jan 2010)
Log Message:
-----------
command line option to enable/disable cosmetic_changes (feature request #2936228)
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2010-01-20 06:31:50 UTC (rev 7886)
+++ trunk/pywikipedia/wikipedia.py 2010-01-21 17:47:24 UTC (rev 7887)
@@ -8037,6 +8037,9 @@
elif arg.startswith('-daemonize:'):
import daemonize
daemonize.daemonize(redirect_std = arg[11:])
+ elif arg == "-cosmeticchanges" or arg == "-cc":
+ config.cosmetic_changes = not config.cosmetic_changes
+ output(u'NOTE: option cosmetic_changes is %s\n' % config.cosmetic_changes)
else:
# the argument is not global. Let the specific bot script care
# about it.
@@ -8514,6 +8517,10 @@
-verbose Have the bot provide additional output that may be useful in
-v debugging.
+
+-cosmeticchanges Toggles the cosmetic_changes setting made in config.py or
+-cc user_config.py to its inverse and overrules it. All other
+ settings and restrictions are untouched.
'''
output(globalHelp, toStdout = True)
try: