Skip to content

Instantly share code, notes, and snippets.

@kroq-gar78
Last active December 11, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kroq-gar78/4646054 to your computer and use it in GitHub Desktop.
Save kroq-gar78/4646054 to your computer and use it in GitHub Desktop.
The Elder Scrolls Wiki stub Megaswitch maker
#!/bin/bash -eu
# This script should generate the Megaswitch for the banner message and
# categories [[Template:Stub]] on the Elder Scrolls Wiki (http://elderscrolls.wikia.com/Template:Stub)
#
# Currently, it's at Template:TestTemplate (for testing, duh.)
cat="[[Category:"
stub="Stub]]"
stubs="Stubs]]"
inconly="includeonly>"
#echo "{{#switch: {{{1|}}}"
for i in Skyrim Dawnguard Dragonborn Oblivion "Shivering Isles" Morrowind Tribunal Bloodmoon Daggerfall Arena; do
echo "| `echo $i | tr '[A-Z]' '[a-z]'`"
echo "| $i = {{$i}} {{#switch: {{{2|}}}"
for j in Armor Character Creature Enemy Item Location Quest Spell Weapon; do
if [[ ("$i" != "Skyrim") && "$j" == "Enemies" ]]; then # no Oblivion: Enemies or Morrowind: Enemies categories
continue
fi
lower=`echo $j | tr '[A-Z]' '[a-z]'` # make the string lowercase
echo " | $j" # add lower case because it will trigger the upper case one
echo " | $lower = $lower <$inconly$cat $i: $j $stub</$inconly"
done
echo " | <$inconly$cat $i: $stubs</$inconly"
echo " }}"
done
echo "| <$inconly$cat $stub</$inconly"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment