Example #1
0
 def change(self, text):
     """
     Given a wiki source code text, return the cleaned up version.
     """
     oldText = text
     if self.site.sitename() == u'commons:commons' and self.namespace == 6:
         text = self.commonsfiledesc(text)
     text = self.fixSelfInterwiki(text)
     text = self.standardizePageFooter(text)
     text = self.cleanUpLinks(text)
     text = self.cleanUpSectionHeaders(text)
     text = self.putSpacesInLists(text)
     text = self.translateAndCapitalizeNamespaces(text)
     text = self.replaceDeprecatedTemplates(text)
     text = self.resolveHtmlEntities(text)
     text = self.validXhtml(text)
     text = self.removeUselessSpaces(text)
     text = self.removeNonBreakingSpaceBeforePercent(text)
     text = self.fixSyntaxSave(text)
     text = self.fixHtml(text)
     text = self.fixStyle(text)
     text = self.fixTypo(text)
     text = self.fixArabicLetters(text)
     try:
         text = isbn.hyphenateIsbnNumbers(text)
     except isbn.InvalidIsbnException, error:
         if pywikibot.verbose:
             pywikibot.output(u"ISBN error: %s" % error)
         pass
Example #2
0
 def isbn_execute(text):
     """Hyphenate ISBN numbers and catch 'InvalidIsbnException'."""
     try:
         return isbn.hyphenateIsbnNumbers(text)
     except isbn.InvalidIsbnException as error:
         pywikibot.log(u"ISBN error: %s" % error)
         return None
 def isbn_execute(text):
     """Hyphenate ISBN numbers and catch 'InvalidIsbnException'."""
     try:
         return isbn.hyphenateIsbnNumbers(text)
     except isbn.InvalidIsbnException as error:
         pywikibot.log(u"ISBN error: %s" % error)
         return None
Example #4
0
    def change(self, text):
        """
        Given a wiki source code text, return the cleaned up version.
        """
        oldText = text
        if self.site.sitename() == u'commons:commons' and self.namespace == 6:
            text = self.commonsfiledesc(text)
        text = self.fixSelfInterwiki(text)
        text = self.standardizePageFooter(text)
        text = self.fixSyntaxSave(text)
        text = self.cleanUpLinks(text)
        text = self.cleanUpSectionHeaders(text)
        text = self.putSpacesInLists(text)
        text = self.translateAndCapitalizeNamespaces(text)
##        text = self.translateMagicWords(text)
        text = self.replaceDeprecatedTemplates(text)
##        text = self.resolveHtmlEntities(text)
        text = self.validXhtml(text)
        text = self.removeUselessSpaces(text)
        text = self.removeNonBreakingSpaceBeforePercent(text)

        text = self.fixHtml(text)
        text = self.fixReferences(text)
        text = self.fixStyle(text)
        text = self.fixTypo(text)
        if self.site.lang in ['ckb', 'fa']:
            text = self.fixArabicLetters(text)
        try:
            text = isbn.hyphenateIsbnNumbers(text)
        except isbn.InvalidIsbnException, error:
            if pywikibot.verbose:
                pywikibot.output(u"ISBN error: %s" % error)
            pass
Example #5
0
 def change(self, text):
     """
     Given a wiki source code text, returns the cleaned up version.
     """
     oldText = text
     text = self.fixSelfInterwiki(text)
     text = self.standardizeInterwiki(text)
     text = self.standardizeCategories(text)
     text = self.cleanUpLinks(text)
     text = self.cleanUpSectionHeaders(text)
     # Disabled because of a bug, and because its usefulness is disputed
     # text = self.putSpacesInLists(text)
     text = self.translateAndCapitalizeNamespaces(text)
     text = self.removeDeprecatedTemplates(text)
     text = self.resolveHtmlEntities(text)
     text = self.validXhtml(text)
     text = self.removeUselessSpaces(text)
     text = self.removeNonBreakingSpaceBeforePercent(text)
     try:
         text = isbn.hyphenateIsbnNumbers(text)
     except isbn.InvalidIsbnException, error:
         pass