Skip to content

Instantly share code, notes, and snippets.

Created March 5, 2014 19:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save samskivert/9374390 to your computer and use it in GitHub Desktop.
Bash script to remove redirect JS crap from scaladoc
# Trims out the bullshit "redirect me to the top-level page" Javascript that scaladoc
# jams into every fucking documentation page. Fucking fuckers.
if [ -z "$1" ]; then
echo "Usage: $0 somedoc.jar"
exit 255
rm -rf /tmp/ufscaladoc
mkdir /tmp/ufscaladoc
cd /tmp/ufscaladoc
jar xf $1
for file in `find scala -name '*.html'`; do
LINE12=`sed -n '12,12p' $file | sed 's: ::g'`
if [ "$LINE12" = '<scripttype="text/javascript">' ]; then
echo "Trimming $file..."
awk 'NR < 12 || NR > 22' $file > $
mv $ $file
jar cf $OLDCWD/unfucked.jar *
rm -rf /tmp/ufscaladoc
echo "If nothing choked:"
echo "mv unfucked.jar $1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment