Revision: 8783
Author: xqt
Date: 2010-12-20 05:25:30 +0000 (Mon, 20 Dec 2010)
Log Message:
-----------
noreferences.py add option to not include section title (path bug #3139688 by masti)
Modified Paths:
--------------
trunk/pywikipedia/noreferences.py
Modified: trunk/pywikipedia/noreferences.py
===================================================================
--- trunk/pywikipedia/noreferences.py 2010-12-20 04:46:29 UTC (rev 8782)
+++ trunk/pywikipedia/noreferences.py 2010-12-20 05:25:30 UTC (rev 8783)
@@ -286,8 +286,7 @@
],
'pl': [
u'Przypisy',
- u'Ogólne przypisy',
- u'Notatki',
+ u'Uwagi',
],
'pt': [
u'Referências',
@@ -333,7 +332,7 @@
u'Referenties', u'Bron',
u'Bronnen/noten/referenties', u'Bron2',
u'Bron3', u'ref', u'references',
u'appendix',
u'Noot', u'FootnotesSmall'],
- 'pl': [u'przypisy', u'Przypisy'],
+ 'pl': [u'Przypisy', u'Przypisy-lista',
u'Uwagi'],
'pt': [u'Notas', u'ref-section', u'Referências',
u'Reflist'],
'ru': [u'Reflist', u'Ref-list', u'Refs',
u'Sources',
u'Примечания', u'Список примечаний',
@@ -353,6 +352,12 @@
},
}
+# Sites where no title is required for references template
+# as it is already included there
+# like pl.wiki where {{Przypisy}} generates
+# == Przypisy ==
+# <references />
+noTitleRequired = [u'pl']
class XmlDumpNoReferencesPageGenerator:
"""
@@ -512,7 +517,14 @@
return self.createReferenceSection(oldText, index)
def createReferenceSection(self, oldText, index, ident = '=='):
- newSection = u'\n%s %s %s\n%s\n' % (ident, pywikibot.translate(self.site,
referencesSections)[0], ident, self.referencesText)
+ if self.site.language() in noTitleRequired:
+ newSection = u'\n%s\n' % (self.referencesText)
+ else:
+ newSection = u'\n%s %s %s\n%s\n' % (ident,
+ pywikibot.translate(
+ self.site,
+ referencesSections)[0],
+ ident, self.referencesText)
return oldText[:index] + newSection + oldText[index:]
def save(self, page, newText):