- 0 Talk
MurphBot/Category
< MurphBot
This is my Unix shell script for adding {{DEFAULTSORT:{{PAGENAME}}}} to any pages in Category:Users which do not already have it or a sort key specified for the category. Without a sort key, the default is to sort as User:..., producing a rather ugly result in the category.
Code
Edit
#!/bin/sh
python replace.py -cat:Users \
-summary:"Category sort key" \
-excepttitle:WoWWiki- \
-excepttext:DEFAULTSORT \
-regex \
'(?msi)\[\[Category:\s*Users]]' \
'{{DEFAULTSORT:{{PAGENAME}}}}\n[[Category:Users]]'
python replace.py -cat:Users \
-summary:"Category sort key" \
-excepttext:DEFAULTSORT \
-regex \
'(?msi)\[\[Category:\s*Users]]' \
'{{DEFAULTSORT:{{#replace:{{PAGENAME}}|WoWWiki-|}}}}\n[[Category:Users]]'