http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9079
Revision: 9079
Author: xqt
Date: 2011-03-14 06:17:41 +0000 (Mon, 14 Mar 2011)
Log Message:
-----------
outreach is a known_family, update from trunk r9077
Modified Paths:
--------------
branches/rewrite/pywikibot/family.py
Modified: branches/rewrite/pywikibot/family.py
===================================================================
--- branches/rewrite/pywikibot/family.py 2011-03-14 06:14:00 UTC (rev 9078)
+++ branches/rewrite/pywikibot/family.py 2011-03-14 06:17:41 UTC (rev 9079)
@@ -129,13 +129,8 @@
self.content_id = "bodyContent"
# A dictionary where keys are family codes that can be used in
- # inter-family interwiki links. Values are not used yet.
- # Generated from http://toolserver.org/~daniel/interwiki-en.txt:
- # remove interlanguage links from file, then run
- # f = open('interwiki-en.txt')
- # for line in f.readlines():
- # s = line[:line.index('\t')]
- # print ((" '%s':" % s).ljust(20) + ("'%s'," % s))
+ # inter-family interwiki links. Do not use it directly but
+ # get_known_families() instead.
# TODO: replace this with API interwikimap call
self.known_families = {
@@ -370,6 +365,7 @@
'orthodoxwiki': 'orthodoxwiki',
'osi reference model':'osi reference model',
'ourmedia': 'ourmedia',
+ 'outreach': 'outreach',
'paganwiki': 'paganwiki',
'panawiki': 'panawiki',
'pangalacticorg': 'pangalacticorg',
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9077
Revision: 9077
Author: xqt
Date: 2011-03-14 06:06:32 +0000 (Mon, 14 Mar 2011)
Log Message:
-----------
outreach is a known_family; doc changed
Modified Paths:
--------------
trunk/pywikipedia/family.py
Modified: trunk/pywikipedia/family.py
===================================================================
--- trunk/pywikipedia/family.py 2011-03-14 06:03:18 UTC (rev 9076)
+++ trunk/pywikipedia/family.py 2011-03-14 06:06:32 UTC (rev 9077)
@@ -3042,13 +3042,8 @@
self.content_id = "bodyContent"
# A dictionary where keys are family codes that can be used in
- # inter-family interwiki links. Values are not used yet.
- # Generated from http://toolserver.org/~daniel/interwiki-en.txt:
- # remove interlanguage links from file, then run
- # f = open('interwiki-en.txt')
- # for line in f.readlines():
- # s = line[:line.index('\t')]
- # print ((" '%s':" % s).ljust(20) + ("'%s'," % s))
+ # inter-family interwiki links. Do not use it directly but
+ # get_known_families() instead.
# TODO: replace this with API interwikimap call
self.known_families = {
@@ -3283,6 +3278,7 @@
'orthodoxwiki': 'orthodoxwiki',
'osi reference model':'osi reference model',
'ourmedia': 'ourmedia',
+ 'outreach': 'outreach',
'paganwiki': 'paganwiki',
'panawiki': 'panawiki',
'pangalacticorg': 'pangalacticorg',
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9074
Revision: 9074
Author: xqt
Date: 2011-03-13 17:28:41 +0000 (Sun, 13 Mar 2011)
Log Message:
-----------
doc for default maintenance cat
Modified Paths:
--------------
trunk/pywikipedia/noreferences.py
Modified: trunk/pywikipedia/noreferences.py
===================================================================
--- trunk/pywikipedia/noreferences.py 2011-03-13 17:15:28 UTC (rev 9073)
+++ trunk/pywikipedia/noreferences.py 2011-03-13 17:28:41 UTC (rev 9074)
@@ -25,6 +25,9 @@
All other parameters will be regarded as part of the title of a single page,
and the bot will only work on that single page.
+If neither a page title nor a page generator is given, it takes all pages from
+the default maintenance category.
+
It is strongly recommended not to run this script over the entire article
namespace (using the -start) parameter, as that would consume too much
bandwidth. Instead, use the -xml parameter, or use another way to generate
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9073
Revision: 9073
Author: xqt
Date: 2011-03-13 17:15:28 +0000 (Sun, 13 Mar 2011)
Log Message:
-----------
* load pages from a default maintenance_category
* check templatePattern on the beginning of the line only for correct placing
* revert r8952 due to template bug which does not recognize commons templates as part of a section
Modified Paths:
--------------
trunk/pywikipedia/noreferences.py
Modified: trunk/pywikipedia/noreferences.py
===================================================================
--- trunk/pywikipedia/noreferences.py 2011-03-13 16:50:37 UTC (rev 9072)
+++ trunk/pywikipedia/noreferences.py 2011-03-13 17:15:28 UTC (rev 9073)
@@ -86,10 +86,10 @@
u'Poznámky',
],
'de': [ # no explicit policy on where to put the references
-## u'Literatur',
-## u'Weblinks',
-## u'Siehe auch',
-## u'Weblink', # bad, but common singular form of Weblinks
+ u'Literatur',
+ u'Weblinks',
+ u'Siehe auch',
+ u'Weblink', # bad, but common singular form of Weblinks
],
'en': [ # no explicit policy on where to put the references
u'Further reading',
@@ -362,6 +362,16 @@
# <references />
noTitleRequired = [u'pl', u'be']
+maintenance_category = {
+ 'wikipedia': {
+ 'be-x-old': u'Вікіпэдыя:Старонкі з адсутным сьпісам зносак',
+ 'de': u'Seiten mit fehlendem References-Tag',
+ 'en': u'Pages with missing references list',
+ 'ja': u'Refタグがあるのにreferencesタグがないページ',
+ 'simple': u'Wikipedia pages with broken references',
+ },
+}
+
class XmlDumpNoReferencesPageGenerator:
"""
Generator which will yield Pages that might lack a references tag.
@@ -502,7 +512,11 @@
# won't work with nested templates
# the negative lookahead assures that we'll match the last template
# occurence in the temp text.
- templatePattern = r'{{((?!}}).)+?}}\s*'
+ ### fix me:
+ ### {{commons}} or {{commonscat}} are part of Weblinks section
+ ### * {{template}} is mostly part of a section
+ ### so templatePattern must be fixed
+ templatePattern = r'\r\n{{((?!}}).)+?}}\s*'
commentPattern = r'<!--((?!-->).)*?-->\s*'
metadataR = re.compile(r'(\r\n)?(%s|%s|%s|%s)$'
% (categoryPattern, interwikiPattern,
@@ -515,7 +529,7 @@
else:
break
pywikibot.output(
- u'Found no section that can be preceeded by a new references section. Placing it before interwiki links, categories, and bottom templates.')
+ u'Found no section that can be preceeded by a new references section.\nPlacing it before interwiki links, categories, and bottom templates.')
index = len(tmpText)
return self.createReferenceSection(oldText, index)
@@ -632,9 +646,21 @@
if not gen:
gen = genFactory.getCombinedGenerator()
if not gen:
+ site = pywikibot.getSite()
+ try:
+ cat = maintenance_category[site.family.name][site.lang]
+ except:
+ pass
+ else:
+ import catlib
+ if not namespaces:
+ namespaces = [0]
+ cat = catlib.Category(site, "%s:%s" % (site.namespace(14), cat))
+ gen = pagegenerators.CategorizedPageGenerator(cat)
+ if not gen:
pywikibot.showHelp('noreferences')
else:
- if namespaces != []:
+ if namespaces:
gen = pagegenerators.NamespaceFilterPageGenerator(gen, namespaces)
preloadingGen = pagegenerators.PreloadingGenerator(gen)
bot = NoReferencesBot(preloadingGen, always)