def fixSelfInterwiki(self, text):
     """
     Interwiki links to the site itself are displayed like local links.
     Remove their language code prefix.
     """
     if not self.talkpage and pywikibot.calledModuleName() <> "interwiki":
         interwikiR = re.compile(r"\[\[%s\s?:([^\[\]\n]*)\]\]" % self.site.lang)
         text = interwikiR.sub(r"[[\1]]", text)
     return text
예제 #2
0
 def fixSelfInterwiki(self, text):
     """
     Interwiki links to the site itself are displayed like local links.
     Remove their language code prefix.
     """
     if not self.talkpage and pywikibot.calledModuleName() <> 'interwiki':
         interwikiR = re.compile(r'\[\[%s\s?:([^\[\]\n]*)\]\]' %
                                 self.site.lang)
         text = interwikiR.sub(r'[[\1]]', text)
     return text
예제 #3
0
    def putSpacesInLists(self, text):
        """
        For better readability of bullet list and enumeration wiki source code,
        puts a space between the * or # and the text.

        NOTE: This space is recommended in the syntax help on the English, German,
        and French Wikipedia. It might be that it is not wanted on other wikis.
        If there are any complaints, please file a bug report.
        """
        exceptions = ['comment', 'math', 'nowiki', 'pre', 'source', 'timeline']
        if not self.redirect and pywikibot.calledModuleName() <> 'capitalize_redirects':
            text = pywikibot.replaceExcept(text, r'(?m)^(?P<bullet>[:;]*(\*+|#+)[:;\*#]*)(?P<char>[^\s\*#:;].+?)', '\g<bullet> \g<char>', exceptions)
        return text
예제 #4
0
    def putSpacesInLists(self, text):
        """
        For better readability of bullet list and enumeration wiki source code,
        puts a space between the * or # and the text.

        NOTE: This space is recommended in the syntax help on the English, German,
        and French Wikipedia. It might be that it is not wanted on other wikis.
        If there are any complaints, please file a bug report.
        """
        exceptions = ['comment', 'math', 'nowiki', 'pre', 'source', 'timeline']
        if not self.redirect and pywikibot.calledModuleName(
        ) <> 'capitalize_redirects':
            text = pywikibot.replaceExcept(
                text,
                r'(?m)^(?P<bullet>[:;]*(\*+|#+)[:;\*#]*)(?P<char>[^\s\*#:;].+?)',
                '\g<bullet> \g<char>', exceptions)
        return text
    def putSpacesInLists(self, text):
        """
        For better readability of bullet list and enumeration wiki source code,
        puts a space between the * or # and the text.

        NOTE: This space is recommended in the syntax help on the English,
        German, and French Wikipedia. It might be that it is not wanted on other
        wikis. If there are any complaints, please file a bug report.
        """
        exceptions = ["comment", "math", "nowiki", "pre", "source", "timeline"]
        if not (self.redirect or self.template) and pywikibot.calledModuleName() != "capitalize_redirects":
            text = pywikibot.replaceExcept(
                text,
                r"(?m)^(?P<bullet>[:;]*(\*+|#+)[:;\*#]*)(?P<char>[^\s\*#:;].+?)",
                "\g<bullet> \g<char>",
                exceptions,
            )
        return text