HOME        PACKAGES        SCRIPTS

tidy.sh

Here is the script I personally use to run tidy. It directs only the error listing to the console, and enables tidy to create two files, one being the error listing and the other being the corrected markup.

For my discussion of tidy and tidy resources, click here. If you want to download an html-free copy of the script in English, it is located at http://sdjf.esmartdesign.com/files/tidy.sh.

If you want to save a copy of this script in your native language, you will need to copy and paste it into a file. Editing a file saved by your browser will be much more difficult because of the <code> tags I inserted to make it display properly in your browser.

If you see html <code> tags in the following script, or the four letter English word "exit", which is a bash command, does not appear as a single word on the very last line at the end of the script, then your translation engine is not working properly and I recommend using altavista if that happens.

 
#!/bin/bash
 
# tidy.sh uses  tidy  to process a file which
# must be given as the first argument on the
# command-line.
# It outputs a list of errors to the console
# and puts a copy of the list in $1.tidy-err.tmp. /home/QtPalmtop/bin/tidy -q -f /tmp/html-err.tmp -O $1.tmp $1 # I use sed to sort the output by line number.
# My script only partially sorts the output
# but I have not taken the time to change it
# as it works well enough for me as it stands.
#
# the following could possibly be replaced by: # # s/e \([1-9]\) /e 0\1/ # or # sed -e '/e 1 /s//e 01 /;/e 2 /s//e 02 /;/e 3 /s//e 03 /;/e 4 /s//e 04 /;/e 5 /s//e 05 /;/e 6 /s//e 06 /;/e 7 /s//e 07 /;/e 8 /s//e 08 /;/e 9 /s//e 09 /' /tmp/html-err.tmp | sort | tee $1.tidy-err.tmp | more # # The following works on ROM 2.38. sed versions
# vary so you may have to tweak for other ROMs
# or to use the BusyBox version of sed. sed -e 's/line //' /tmp/html-err.tmp | sort -n | sed -e 's/^/line /' | tee $1.tidy-err.tmp | more rm /tmp/html-err.tmp 2> /dev/null exit




Revised October 9, 2011