Skip to content

Instantly share code, notes, and snippets.

@daverosoff
Last active August 29, 2015 14:04
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 daverosoff/0785e374595294bce947 to your computer and use it in GitHub Desktop.
Save daverosoff/0785e374595294bce947 to your computer and use it in GitHub Desktop.
Script for finding images lacking alt text in the Open Problem Library.
#!/bin/sh
# Dave Rosoff, August 2014
# Run this script from the root of the OPL, e.g.
# /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary
imglist=list
touch $imglist
grep -r -P -l "image\s*\(" >> $imglist
#!/bin/bash
# Dave Rosoff, August 2014
# Note that this script is potentially destructive
# It will overwrite previous versions of its logfile.
# Use the accompanying script findImages.sh to generate
# the list file
# Run this script from the root of the OPL, e.g.
# /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary
logfile="MissingImages.log" # change this to something suitable
for file in `cat ~/fiximages/list`; do # update the filename appropriately
isalt=`sed -n '
/image/ {
N
/image.*alt/ {
p
}
D
} ' $file`
if [ "$isalt" = "" ]; then
echo $file >> $logfile
fi
done
@daverosoff
Copy link
Author

TODO: rewrite this to use Text::Balanced instead of sed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment