#!/bin/bash
# html5css.cgi - CSS Based HTML5 Validation Litmus
# Copyright 2008, Sean B. Palmer, inamidst.com
# Licensed under the Eiffel Forum License 2.
URI=$(python -c "
import urllib
print urllib.quote('$HTTP_REFERER', '')
")
echo Content-Type: text/css
echo
if ! echo $URI | grep $SERVER_NAME &> /dev/null
then echo 'span.check:after { content: " Only works on $SERVER_NAME!"; }'
exit
fi
if curl -s "http://html5.validator.nu/?doc=$URI&out=text" | \
grep 'valid HTML' &> /dev/null
then echo 'span.check:after { content: " \002713"; color: green; }'
else echo 'span.check:after { content: " \002717"; color: red; }'
fi
# EOF