Last active
August 29, 2015 14:04
-
-
Save daverosoff/0785e374595294bce947 to your computer and use it in GitHub Desktop.
Script for finding images lacking alt text in the Open Problem Library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: rewrite this to use Text::Balanced instead of sed.