Benutzer:NumberFive/Cosmetic

Aus Piratenwiki Mirror
Zur Navigation springen Zur Suche springen

Code fuer cosmetic_changes.py aus pywikipedia

def fixPiratenWikiLink(self, text): """ fix teh link """ if not self.talkpage and pywikibot.calledModuleName() <> 'interwiki': piLink = re.compile(r'\[?\[https?://wiki.piratenpartei.de/index.php\?title=([\S:/]+?)(\|.*?)?\]\]?') text = piLink.sub(r'[[\1]]', text) piLink = re.compile(r'\[https?://wiki.piratenpartei.de/index.php\?title=([\S:/]+?)(\s.*?)?\]') text = piLink.sub(r'[[\1]]', text) piLink = re.compile(r'\[https?://wiki.piratenpartei.de/([\S]+?)(\|.*?)?\]') text = piLink.sub(r'[[\1]]', text) piLink = re.compile(r'\[https?://wiki.piratenpartei.de/([\S]+?)(\s.*?)?\]') text = piLink.sub(r'[[\1]]', text) piLink = re.compile(r'(\W)https?://wiki.piratenpartei.de/index.php\?title=([\S]+?)(\s|\n|\')') text = piLink.sub(r'\1[[\2]]\3', text) piLink = re.compile(r'(\W)https?://wiki.piratenpartei.de/([\S]+?)(\s|\n|\')') text = piLink.sub(r'\1[[\2]]\3', text) return text