Module pywikipedia.template
Very simple script to replace a template with another one,
and to convert the old MediaWiki boilerplate format to the new template format.
Syntax: python template.py [-newformat] oldTemplate [newTemplate]
Specify the template on the command line. The program will
pick up the template page, and look for all pages using it. It will
then automatically loop over them, and replace the template.
Command line options:
-oldformat - Use the old format {{msg:Stub}} instead of {{Stub}}.
-remove - Remove every occurence of the template from every article
-sql - retrieve information from a local dump (http://download.wikimedia.org).
if this argument isn't given, info will be loaded from the maintenance
page of the live wiki.
argument can also be given as "-sql:filename.sql".
other: First argument is the old template name, second one is the new
name. If only one argument is given, the bot resolves the
template by putting its text directly into the article.
This is done by changing {{...}} or {{msg:...}} into {{subst:...}}
If you want to address a template which has spaces, put quotation
marks around it.
Example:
If you have a template called [[Template:Cities in Washington]] and want to
change it to [[Template:Cities in Washington state]], start
python template.py "Cities in Washington" "Cities in Washington state"
Move the page [[Template:Cities in Washington]] manually afterwards.
- Imported modules:
-
pywikipedia.config
,
pywikipedia.pagegenerators
,
re
,
pywikipedia.replace
,
string
,
sys
,
pywikipedia.wikipedia
- Imported variables:
-
__version__