def glob(): patintclass = lre.lre(ur"(?ms)\|\s*title\s*=(.*?)$") delimit = [ur"\s*[\•\·]\s*", ur"\ +[\•\.\·\-] +", ur"\ *\{\{(?:[\,\•·]|[\•\·\!]w|·wrap|จุด)\}\}\s*", ur"\s*\&\#124\;\s*"] delimit = lre.sep(delimit) + ur"(?!(?:(?![\[\]]).)*\])" patdel = lre.lre(u"(?s)(\|\ *list\d+(?:(?!below|seealso|" + #u"(?<=\]\])" + delimit + u").)*)" + #u"(?<=\]\])" + delimit) patnl = lre.lre(u"(list\d+)\s*=\s*(?![\|\s\}])") patwrap = lre.lre(u"\{\{[Nn]owrap\s*(?:\|(.*?))?\}\}\ *") patrmwrap = lre.lre(u"\{\{[Nn]owrap.*?\}\}\ *") triml = lre.lre(u"\n+") patbr = lre.lre(u"(?m)^(\*[^\n]*)<\s*/?\s*br\s*/?\s*>") alltag = [u"small", u"span", u"div"] patopen = lre.lre(u"(?m)^\*\ *(<" + lre.sep(alltag) + u">)\s*\[\[") patclose = lre.lre(u"\]\]\ *(</" + lre.sep(alltag) + u">)")
def mosteditsArt(): """ most edits """ regexArt = lre.genData(conf.tagind, u"บทความแก้ไขมากสุด") regexArtlist = lre.genData(conf.tagind, u"บทความรายชื่อแก้ไขมากสุด") oldtable = getdat(regexArt) oldtablelist = getdat(regexArtlist) table = [] tablelist = [] ptr = 0 patListName = lre.lre(lre.sep(conf.listname)) for page, revisions in site.mostrevisionspages(): if len(tablelist) < 5 and patListName.search(page.title()): tablelist.append([page.title(), getrankold(page.title(), oldtablelist), revisions, firstContributor(page)]) elif len(table) < 10 and not patListName.search(page.title()): table.append([page.title(), getrankold(page.title(), oldtable), revisions, firstContributor(page)]) elif (len(tablelist) >= 5) and (len(table) >= 10): break writetable(table, regexArt) writetable(tablelist, regexArtlist)
def glob(): global datenow, template template = wp.Page(conf.templateName) lre.pats["tl"] = lre.lre(ur"(?i)\{\{\s*%s\s*\}\}\s*" % lre.sep([page.title(withNamespace=False) for page in list(template.backlinks(filterRedirects=True)) + [template]])) datenow = site.getcurrenttime()
patList.append(r"[\t\r\f\v]", " ") # change all whitespaces to space! patList.append(r"_(?=[^\[\]]*\]\])", " ") # $[[_abc_def_]]$ => $[[ abc def ]]$ patList.append(r"(?m)(?<!=) +$", "") # strip traling space patList.append(r"(?m)=$", "= ") # strip traling space except the last character is = patList.append(r"(?m)^(=+) *(.*?) *(=+) *$", r"\1 \2 \3") # $== oak == $ => $== oak ==$ patList.append(r"(?m)^= (.*?) =$", r"== \1 ==") # don't use first-level headings patList.append(r"(?m)^==+\ .*?\ ==+$", patListSection.process) # call patListSection tablemarkup = ["rowspan", "align", "colspan", "width", "style"] patList.append("(" + lre.sep(tablemarkup) + ") *= *", r"\1 = ") # clean whitespace around equal sign patList.append(r"\[\[ *(.*?) *\]\]", r"[[\1]]") # $[[ abc def ]]$ => $[[abc def]]$ patList.append(r"\[\[(:?)[Cc]ategory:", ur"[[\1หมวดหมู่:") # L10n patList.append(ur"\[\[(:?)([Ii]mage|[Ff]ile|ภาพ):", ur"[[\1ไฟล์:") # L10n patList.append((u"(?m)^== (แหล่ง|หนังสือ|เอกสาร|แหล่งข้อมูล)อ้างอิง ==$", u"== อ้างอิง ==")) # อ้างอิง patList.append((u"(?m)^== (หัวข้ออื่นที่เกี่ยวข้อง|ดูเพิ่มที่) ==$", u"== ดูเพิ่ม ==")) # ดูเพิ่ม patList.append((ur"""(?mx)^==\ (เว็บไซต์|โยง|ลิง[กค]์|Link *|(แหล่ง)?ข้อมูล) (ภายนอก|อื่น)\ ==$""", u"== แหล่งข้อมูลอื่น =="))