コード例 #1
0
    def addrefs3(self, text, article):
        srclist = ["*", "{{IMDb-h", "#",
        util.getwordlc("bref"), util.getword("bref"),
        util.getwordlc("wref"), util.getword("wref"),
        util.getwordlc("mref"), util.getword("mref"),
        util.getwordlc("sref"), util.getword("sref"),
        util.getwordlc("nref"), util.getword("nref"),
        util.getwordlc("commons"), util.getword("commons"),
        "{{"+util.getword("refs"), "{{"+util.getwordlc("refs"),
        "<references", "{{Käännös|", "{{käännös|"]

        nono = ["[["+util.getwordc("cat"), "{{Tynkä", "{{tynkä", "{{AAKKOSTUS", "{{DEFAULTSORT", "{{OLETUSAAKKOSTUS"]

        text = text.split("\n")

        feed0 = util.listend('\n'.join(text), util.getword("refs"), srclist, nono)

        if feed0[0] == feed0[1]:
            war.append_warning(self.warning00)

        refsec = '\n'.join(text[feed0[0]:feed0[1]+1])


        for l,t in zip(range(feed0[0], feed0[1]+1), range(0, feed0[1]-feed0[0]+1)):
            text.pop(l-t)


        feed = util.listend('\n'.join(text), util.getword("srcs"), srclist, nono)

        if util.tagwithoutend('\n'.join(text[feed[0]:feed[1]])):
            war.append_warning(self.warning01)

        if feed[0] == feed[1]:
            war.append_warning(self.warning00)

        if feed[1] != None:
            nl0 = "\n"
            nl1 = "\n"
            self.error_count = 1

            text[feed[1]] = text[feed[1]]+nl0+refsec+"\n"+nl1
            text = '\n'.join(text)
            self.comment0 = self.comment03
        return text
コード例 #2
0
    def run(self, page):
        srclist = [
            "*", "{{IMDb-h", "#",
            util.getwordlc("bref"),
            util.getword("bref"),
            util.getwordlc("wref"),
            util.getword("wref"),
            util.getwordlc("mref"),
            util.getword("mref"),
            util.getwordlc("sref"),
            util.getword("sref"),
            util.getwordlc("nref"),
            util.getword("nref"),
            util.getwordlc("commons"),
            util.getword("commons")
        ]
        nono = [
            "[[" + util.getwordc("cat"), "{{Tynkä", "{{tynkä", "{{AAKKOSTUS",
            "{{DEFAULTSORT", "{{OLETUSAAKKOSTUS"
        ]

        if util.titlein(util.getword("li"), page.text) and util.titlein(
                util.getword("exl"), page.text) and util.titlepos(
                    util.getword("li"), page.text) > util.titlepos(
                        util.getword("exl"), page.text):
            feed = util.listend(page.text, util.getword("li"), srclist, nono)
            if feed[0] == feed[1]:
                war.append_warning(self.warning0)

            if util.tagwithoutend('\n'.join(page.text[feed[0]:feed[1]])):
                war.append_warning(self.warning1)

            page.text = page.text.split("\n")
            if "===" in page.text[util.titleline(util.getword("li"),
                                                 '\n'.join(page.text))]:
                page.text = '\n'.join(page.text)
                return page.text, self.error_count

            exlec = page.text[feed[0]:feed[1] + 1]
            page.text = util.removefromlist(exlec, page.text)
            n1 = "\n"
            exlec = '\n'.join(exlec)
            if page.text[
                    util.titleline(util.getword("exl"), '\n'.join(page.text)) -
                    1] == "":
                n1 = ""
            page.text[util.titleline(util.getword("exl"), '\n'.join(
                page.text))] = n1 + exlec + "\n\n" + page.text[util.titleline(
                    util.getword("exl"), '\n'.join(page.text))]
            page.text = '\n'.join(page.text)
            self.error_count += 1

        return self.error_count
コード例 #3
0
ファイル: seealsotoexl.py プロジェクト: 4shadoww/mws
    def run(self, page):
        srclist = [
            "*", "{{IMDb-h", "#",
            util.getwordlc("bref"),
            util.getword("bref"),
            util.getwordlc("wref"),
            util.getword("wref"),
            util.getwordlc("mref"),
            util.getword("mref"),
            util.getwordlc("sref"),
            util.getword("sref"),
            util.getwordlc("nref"),
            util.getword("nref"),
            util.getwordlc("commons"),
            util.getword("commons")
        ]
        nono = [
            "[[" + util.getwordc("cat"), "{{Tynkä", "{{tynkä", "{{AAKKOSTUS",
            "{{DEFAULTSORT", "{{OLETUSAAKKOSTUS"
        ]

        if util.titlein(util.getword("seealso"),
                        page.text) and "http://" in page.text and util.titlein(
                            util.getword("exl"),
                            page.text) == False or util.titlein(
                                util.getword("seealso"), page.text
                            ) and "https://" in page.text and util.titlein(
                                util.getword("exl"), page.text) == False:
            feed = util.listend(page.text, util.getword("seealso"), srclist,
                                nono)

            if feed[0] == feed[1]:
                war.append_warning(self.warning1)

            if util.tagwithoutend('\n'.join(page.text[feed[0]:feed[1]])):
                war.append_warning(self.warning2)

            page.text = page.text.split("\n")
            seealsosec = '\n'.join(page.text[feed[0]:feed[1] + 1])

            if "[[" in seealsosec and "http://" in seealsosec or "[[" in seealsosec and "https://" in seealsosec:
                war.append_warning(self.warning0)
            if "http://" in seealsosec or "https://" in seealsosec:
                page.text[feed[0]] = "==" + util.getword("exl") + "=="
                self.error_count += 1

            page.text = '\n'.join(page.text)
        return self.error_count
コード例 #4
0
    def addrefs0(self, text, article):
        srclist = ["*", "{{IMDb-h", "#",
        util.getwordlc("bref"), util.getword("bref"),
        util.getwordlc("wref"), util.getword("wref"),
        util.getwordlc("mref"), util.getword("mref"),
        util.getwordlc("sref"), util.getword("sref"),
        util.getwordlc("nref"), util.getword("nref"),
        util.getwordlc("commons"), util.getword("commons"),
        "{{"+util.getword("refs"), "{{"+util.getwordlc("refs"),
        "<references", "{{Käännös|", "{{käännös|"]

        nono = ["[["+util.getwordc("cat"), "{{Tynkä", "{{tynkä", "{{AAKKOSTUS", "{{DEFAULTSORT", "{{OLETUSAAKKOSTUS"]

        feed = util.listend(text, util.getword("srcs"), srclist, nono)

        if util.tagwithoutend('\n'.join(text[feed[0]:feed[1]])):
            war.append_warning(self.warning01)

        if feed[0] == feed[1]:
            war.append_warning(self.warning00)

        if feed[1] != None and feed[2] == False:
            self.error_count = 1
            text = text.split("\n")
            nl00 = "\n"
            if text[feed[0]] == "":
                nl00 = ""
            text[feed[0]] = text[feed[0]]+nl00+"{{"+util.getword("refs")+"}}"
            text = '\n'.join(text)
            self.comment0 = self.comment01

        elif feed[1] != None and feed[2]:
            nl0 = "\n"
            nl1 = ""
            self.error_count = 1
            text = text.split("\n")
            if text[feed[1]] != "":
                nl0 = "\n\n"
            if text[feed[1]+1] != "":
                nl1 += "\n\n"

            text[feed[1]] = text[feed[1]]+"\n\n"+"==="+util.getword("refs")+"===\n"+"{{"+util.getword("refs")+"}}"+nl1
            text = '\n'.join(text)
            self.comment0 = self.comment00

        return text
コード例 #5
0
ファイル: notvalidsec.py プロジェクト: 4shadoww/mws
    def run(self, text):
        self.wm = "osion siirto tuottaa ongelmia"
        text = text.split("\n")
        secs = self.getsec(text)

        srclist = [
            "*", "{{IMDb-h", "#",
            util.getwordlc("bref"),
            util.getword("bref"),
            util.getwordlc("wref"),
            util.getword("wref"),
            util.getwordlc("mref"),
            util.getword("mref"),
            util.getwordlc("sref"),
            util.getword("sref"),
            util.getwordlc("nref"),
            util.getword("nref"),
            util.getwordlc("commons"),
            util.getword("commons"), "{{" + util.getword("refs"),
            "{{" + util.getwordlc("refs"), "<references", "===", "{{Käännös|",
            "{{käännös|"
        ]

        nono = [
            "[[" + util.getwordc("cat"), "{{Tynkä", "{{tynkä", "{{AAKKOSTUS",
            "{{DEFAULTSORT", "{{OLETUSAAKKOSTUS"
        ]

        secsl = [
            util.getword("srcs"),
            util.getword("refs"),
            util.getword("li"),
            util.getword("exl"),
            util.getword("seealso")
        ]

        for l, sec in enumerate(secs):
            if len(sec) > 0 and sec[0].replace(
                    "=", "") in secsl and l != len(secs) - 1:
                feed = util.listend('\n'.join(text), sec[0].replace("=", ""),
                                    srclist, nono)
                if feed[1] - feed[0] + 1 != self.getlen(sec):
                    self.error_count += 1
                    self.wm = sec[0].replace("=", "") + ", " + self.wm

        return self.error_count