work around the jtidy bug where html-tag-esque contents of "script" tags break it.
do this by stripping script tags before passing the html to jtidy.
also clean up the script-tag-stripping code