def run(self, page): nono = ["{{iihfranking"] if page.text.count("<ref/>") == 0 and page.text.count( "<ref />") == 0 and page.text.count("<ref>") == 0: self.error_count += 1 if util.titlein(util.getword("refs"), page.text): page.text = page.text.split("\n") for l, line in enumerate(page.text): if util.titlein(util.getword("refs"), line): page.text.pop(l) break for l, line in enumerate(page.text): if "{{" + util.getword( "refs") in line or "{{" + util.getwordlc( "refs") in line or "<references" in line: page.text.pop(l) break else: page.text = page.text.split("\n") for l, line in enumerate(page.text): if util.titlein(util.getword("srcs"), line): page.text.pop(l) break for l, line in enumerate(page.text): if "{{" + util.getword( "refs") in line or "{{" + util.getwordlc( "refs") in line or "<references" in line: page.text.pop(l) break page.text = '\n'.join(page.text) return self.error_count
def run(self, text): r0 = 0 r1 = 0 r2 = 0 r3 = 0 r0 = text.count("{{" + util.getword("refs") + "}}") r1 = text.count("{{" + util.getwordlc("refs") + "}}") r2 = text.count("{{" + util.getword("refs") + "|") f3 = text.count("{{" + util.getwordlc("refs") + "|") if r0 + r1 + r2 + r3 > 1: self.error_count += 1 return self.error_count
def run(self, text): if util.titlein(util.getword("refs"), text) and "<ref" not in text: self.error_count += 1 if "{{" + util.getword( "refs" ) + "|" in text and "<ref" not in text or "{{" + util.getwordlc( "refs") + "|" in text and "<ref" not in text: self.error_count += 1 if "{{" + util.getword( "refs" ) + "}}" in text and "<ref" not in text or "{{" + util.getwordlc( "refs") + "}}" in text and "<ref" not in text: self.error_count += 1 return self.error_count
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
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
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
def addrefs1(self, text, article): targetline = None pos = None nono = ["{{", util.getwordc("cat"), util.getwordlcc("cat"),] unwanted = ["{{"+util.getword("commons"), "{{"+util.getwordlc("commons"), "*", "#", "<ref>", "</ref>", "\n", "\t", "\b", "\a", "\r", "|}"] text = text.split("\n") firstcat = len(text) for l, line in enumerate(text): if util.getwordlcc("cat") in line or util.getwordc("cat") in line: firstcat = l pos = l break for l, line in reversed(list(enumerate(text[:firstcat]))): if util.anymatch(unwanted, line): minus = len(text)-l pos = len(text)-minus+1 break elif util.zeromatch(nono, line) and util.zeromatch(nono, text[l-1]) and line != "": minus = len(text)-l pos = len(text)-minus+1 break if pos == len(text): pos -= 1 if pos != None: nl = "" if text[pos] != "": nl = "\n" text[pos] = text[pos]+nl+"\n=="+util.getword("srcs")+"==\n{{"+util.getword("refs")+"}}\n" text = '\n'.join(text) self.error_count = 1 self.comment0 = self.comment02 return text
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
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
def run(self, page): article = page.title nono = ["<references/>", "<references />", "<references>", "{{"+util.getword("refs"), "{{"+util.getwordlc("refs"), "{{reflist", "{{Reflist"] if util.titlein(util.getword("refs"), page.text) and util.titlein(util.getword("srcs"), page.text) and not util.titlebefore(util.getword("srcs"), util.getword("refs"), page.text, subtitles=False): page.text = self.addrefs3(page.text, article) if "<ref>" not in page.text and "</ref>" not in page.text: return self.error_count if util.andop(nono, page.text): return self.error_count elif util.titlein(util.getword("refs"), page.text) and util.titlein(util.getword("srcs"), page.text) and "{{"+util.getword("refs") not in page.text and "{{"+util.getwordlc("refs") not in page.text: page.text = self.addrefs2(page.text, article) elif util.titlein(util.getword("srcs"), page.text) and "{{"+util.getword("refs") not in page.text and "{{"+util.getwordlc("refs") not in page.text: page.text = self.addrefs0(page.text, article) elif util.titlein(util.getword("srcs"), page.text) == False: page.text = self.addrefs1(page.text, article) return self.error_count
def run(self, page): if page.text.count("<ref/>") < 1 and "{{" + util.getwordlc( "refs") + "|sarakkeet}}" in page.text and "{{" + util.getword( "refs") + "|sarakkeet}}" in page.text: self.error_count = 1 page.text = page.text.replace( "{{" + util.getwordlc("refs") + "|sarakkeet}}", "{{" + util.getword("refs") + "}}") page.text = page.text.replace( "{{" + util.getword("refs") + "|sarakkeet}}", "{{" + util.getword("refs") + "}}") self.comments0 = self.comment01 else: self.error_count += page.text.count("{{" + util.getwordlc("refs") + "}}") self.error_count += page.text.count("{{" + util.getwordlc("refs") + "|") page.text = page.text.replace("{{" + util.getwordlc("refs") + "}}", "{{" + util.getword("refs") + "}}") page.text = page.text.replace("{{" + util.getwordlc("refs") + "|", "{{" + util.getword("refs") + "|") return self.error_count