From MythTV Official Wiki
Revision as of 01:35, 22 April 2010 by Wagnerrp (talk | contribs) (edit category)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Important.png Note: The correct title of this article is It appears incorrectly here due to technical restrictions.

This is a pywikipedia script, developed to support maintenance of this site.

Several user pages have email links on them. Mediawiki supports the mailto: type designator. However, many of the entries, due to MoinMoin's style, have spaces in them. This script cleans up the mail links, and make them operable again.

Source code


import re
from pywikipedia import wikipedia

site = wikipedia.getSite()

for page in site.allpages():
        if not page.isRedirectPage():
                wikitext = page.get()

                        mailtoR = re.compile("mailto:\((.*)\)")
                        results =
                        before, after = results.span()
                        final = wikitext[0:before] + re.compile("\(|\)").sub("", re.compile(" ").sub("_", + wikitext[after:]
                        if wikitext <> final:
                                page.put(newtext = final, comment='[[pywikipedia]] assisted cleanup ([[]])-> fixing legacy email references', minorEdit=True)

How to run it

To run the script, it needs no arguments.

% python

It will search all pages, and where it sees: mailto:(foo at bar), it will replace it with mailto:foo_at_bar.