Revision: 5537 Author: nicdumz Date: 2008-06-08 21:22:38 +0000 (Sun, 08 Jun 2008)
Log Message: ----------- Patch #1988231 [Finnish support for noreferences.py] by Silvonen. Thanks !
Modified Paths: -------------- trunk/pywikipedia/noreferences.py
Modified: trunk/pywikipedia/noreferences.py =================================================================== --- trunk/pywikipedia/noreferences.py 2008-06-08 21:15:48 UTC (rev 5536) +++ trunk/pywikipedia/noreferences.py 2008-06-08 21:22:38 UTC (rev 5537) @@ -48,6 +48,7 @@ 'ar':u'روبوت: إضافة وسم <references /> مفقود', 'de':u'Bot: Trage fehlendes <references /> nach', 'en':u'Robot: Adding missing <references /> tag', + 'fi':u'Botti lisäsi puuttuvan {{viitteet}}-mallineen', 'he':u'בוט: מוסיף תגית <references /> חסרה', 'ja':u'ロボットによる: <references /> タグを追加。', 'ko':u'봇: 이전에 없던 <references /> 추가', @@ -86,6 +87,12 @@ u'Véase también', u'Notas', ], + 'fi': [ + u'Kirjallisuutta', + u'Aiheesta muualla', + u'Ulkoiset linkit', + u'Linkkejä', + ], 'fr': [ u'Liens externes', u'Voir aussi', @@ -145,6 +152,10 @@ u'Referencias', u'Notas', ], + 'fi': [ + u'Lähteet', + u'Viitteet', + ], 'fr': [ u'Références', u'References', @@ -200,11 +211,12 @@ # on your wiki, you don't have to enter anything here. referencesTemplates = { 'wikipedia': { - 'ar': [u'Reflist',u'ثبت المراجع',u'قائمة المراجع'], + 'ar': [u'Reflist',u'ثبت المراجع',u'قائمة المراجع'], 'en': [u'Reflist',u'Refs',u'FootnotesSmall',u'Reference', u'Ref-list',u'Reference list',u'References-small',u'Reflink', u'Footnotes',u'FootnotesSmall'], 'es': ['Listaref', 'Reflist'], + 'fi': [u'Viitteet', u'Reflist'], 'fr': [u'Références',u'Notes', u'References', u'Reflist'], 'hu': [u'reflist'], 'ja': [u'Reflist'], @@ -214,6 +226,14 @@ }, }
+# Text to be added instead of the <references /> tag. +# Define this only if required by your wiki. +referencesSubstitute = { + 'wikipedia': { + 'fi': u'{{viitteet}}', + }, +} + class XmlDumpNoReferencesPageGenerator: """ Generator which will yield Pages that might lack a references tag. @@ -250,6 +270,10 @@ self.referencesTemplates = referencesTemplates[wikipedia.getSite().family.name][wikipedia.getSite().lang] except KeyError: self.referencesTemplates = [] + try: + self.referencesText = referencesSubstitute[wikipedia.getSite().family.name][wikipedia.getSite().lang] + except KeyError: + self.referencesText = u'<references/>'
def lacksReferences(self, text, verbose = True): """ @@ -295,7 +319,7 @@ index = match.end() else: wikipedia.output(u'Adding references tag to existing %s section...\n' % section) - newText = oldText[:match.end()] + u'\n<references/>\n' + oldText[match.end():] + newText = oldText[:match.end()] + u'\n' + self.referencesText + u'\n' + oldText[match.end():] return newText else: break @@ -346,7 +370,7 @@ return self.createReferenceSection(oldText, index)
def createReferenceSection(self, oldText, index, ident = '=='): - newSection = u'\n%s %s %s\n\n<references/>\n' % (ident, wikipedia.translate(self.site, referencesSections)[0], ident) + newSection = u'\n%s %s %s\n\n%s\n' % (ident, wikipedia.translate(self.site, referencesSections)[0], ident, self.referencesText) return oldText[:index] + newSection + oldText[index:]
def save(self, page, newText):