|
Running batch Tidy on files before publishing
I wrote a small batch file to run HTML Tidy on all the *.htm* files in my site before they are published. It was kind of a pain to figure all this stuff out, so I figured I'd share. :-) Just put the following text into a batch file and save it (I called mine ctidy.bat), along with the tidy.exe into a folder that you can access anywhere from the command prompt (C:\Windows will work just fine).
@ECHO OFF
cd "%1"
ECHO Processing HTML files with Tidy...
ECHO.
for /f "tokens=*" %%a in ('dir /b /s *.htm*') do tidy -i -c -q -m -c -b --quote-marks yes --drop-empty-paras yes "%%a" | ECHO File: %%a
Now put "ctidy.bat %1" (without the quotes, and make sure the *.bat file is the same name you saved yours as) into the Run External Programs/Before Copy box in your location's configuration in CityDesk and it is good to go!
You can change the options Tidy uses after the "do tidy" part and before the "%%a" in the batch file. A reference to those options can be found here:
http://tidy.sourceforge.net/docs/quickref.html
Good luck!
jetexas
Saturday, August 21, 2004
One more thing...
that last line in the batch file starting with "for /f" is all supposed to be on one line, or it won't work.
jetexas
Saturday, August 21, 2004
Very Good! Congratulations!
AAJJ
Wednesday, November 03, 2004
Recent Topics
Fog Creek Home
|