Topic on Manual talk:Pywikibot

Replacing template with text

4
Summary by Dvorapa

To work with templates there is a template.py script. It can easily get e.g. category of templates to process by -cat parameter

87.0.79.89 (talkcontribs)

Hi,

I need a script that:

1) Select pages that are in a specific category

2) Delete in those pages an old template with its parameters (that could also be sub-templates); the template is the same, but the content is different for all, so I can't specify manually the text

3) And replace it with a text (a new template with standard content for all)

It's possible? I see something in ''replace.py'' (point 1 and 3), but I'm not sure it can do the 2nd; and it seems that ''template.py'' can only replace the template name.

Glz19

Xqt (talkcontribs)

Try template.py script.

Glz19 (talkcontribs)

Thank you for the answer. It's possible with it selecting a category, for work only on pages in it? I read the documentation page but I can't see it.

Xqt (talkcontribs)

All scripts have a documentation with it. Just use -help option. In your case -cat:<categoryname> should do it.