User:MurphBot/Achievementbox

This is my Unix shell script for standardising the usage of Achievementbox. It has a high accuracy rate, but changes should be manually reviewed, as it can get some false-positives. It uses the pywikipediabot replace.py script to do the actual work - this script just provides the configuration in an easily repeatable manner. This was developed on MacOS 10.5.

Disclaimer
I accept no responsibility if you chose to use this script - you do so entirely at your own risk, and you own any damage to your reputation or account status. If you don't understand what it does, you are probably not qualified to use it - there are some quite advanced regular expressions in here, and understanding and debugging them is not for the novice. Documentation is deliberately sparse, it is not intended to be release quality code, or for general use.

Code

 * 1) !/bin/sh

python replace.py -transcludes:Achievementbox \ -namespace:0 \ -summary:'Standardisation of achievementbox mode, arg, type params, ' \ -recursive \ -regex \ '(?mi){{Achievementbox\s*\|' \ '{{Achievementbox\n|mode={{{mode|}}}\n|arg={{{arg|}}}\n|' \ '(?ms)({{Achievementbox\s*\|mode={{{mode\|}}}\s*\|arg={{{arg\|}}}.*?)\|mode=[^\r\n]*[\r\n]*(?=\|[^}]|}}\s* )' '\1' \ '(?ms)({{Achievementbox\s*\|mode={{{mode\|}}}\s*\|arg={{{arg\|}}}.*?)\|arg=[^\r\n]*[\r\n]*(?=\|[^}]|}}\s* )' '\1' \ '(?m)(?<={{Achievementbox)(.*?)^[ \t]*?\|[ \t]*?(\S)' '\1|\2' \ '(?m)^\|type=(?!{{{doc\|)\s*([^\r\n]*)' '|type={{{doc|\1}}}' \ '(?mi)^\|type={{{doc\|General}}}' '|type={{{doc|General}}}' \ '(?mi)^\|type={{{doc\|Quests?}}}' '|type={{{doc|Quest}}}' \ '(?mi)^\|type={{{doc\|Exploration}}}' '|type={{{doc|Exploration}}}' \ '(?mi)^\|type={{{doc\|Player *vs.? *Player}}}' '|type={{{doc|Player vs. Player}}}' \ '(?mi)^\|type={{{doc\|Dungeons? *(&|and) *Raids?}}}' '|type={{{doc|Dungeons & Raids}}}' \ '(?mi)^\|type={{{doc\|Professions?}}}' '|type={{{doc|Professions}}}' \ '(?mi)^\|type={{{doc\|Reputation}}}' '|type={{{doc|Reputation}}}' \ '(?mi)^\|type={{{doc\|World *Events?}}}' '|type={{{doc|World Events}}}' \ '(?mi)^\|type={{{doc\|Feats? *of *Strength}}}' '|type={{{doc|Feats of Strength}}}' \ '(?msi) \s*({{Achievementbox(({{(({{.*?}})|.)*?}})|.)*?}})\s* ' \ ' \1 ' \	'(?msi)(?<! )({{Achievementbox(({{(({{.*?}})|.)*?}})|.)*?}})' \ ' \1 ' \	'(?msi)(?<={{Achievementbox)(.*?}} )([^\r\n])' '\1\n\2' \ '(?msi)([^\r\n])( {{Achievementbox)' '\1\n\2' \ '(?msi)(?<={{Achievementbox)(.*?)' '\1' \ '(?msi)(?=.*{{Achievementbox)' '' \