- From: Eric Frost <eric.frost@mp2kmag.com>
- Date: Sat, 2 Aug 2008 17:10:13 -0500
- To: <dsr@w3.org>, <html-tidy@w3.org>, <tidy-develop@lists.sourceforge.net>
Hi Hao Liu, Both of my recommendations would involve learning a little shell scripting, but it depends on what environment you are in (Windows XP or Linux or ?). Or use Python, I think it will run on any platform. For #1 I would program a loop that would loop over each .html file name in a directory, and before calling tidy it would write the file name to the log. The logic would be something like this. Erase/Create error.log file and write "Start" and the current date on top For each *filename in *directory ending with .html Append *filename to error.log Run tidy command - make sure there's an option to append to the error.log file, not only create, if not, then use the .html file name in the error.log file like errors-myfile1.log Loop For #2, it's got to be a LOT easier to just insert your code in using Python or another shell scripting program. Maybe just add a line in the above program before the Loop. Hope this helps! Eric ___________________________________________________________ Eric Frost, PhD 630-729-0445 http://www.sc2hacks.com http://www.agreathomeinspector.com/ -------------------------------------------------- From: "hao liu" <liuhao181@yahoo.com.cn> Sent: Tuesday, July 29, 2008 7:07 AM To: <dsr@w3.org>; <html-tidy@w3.org>; <tidy-develop@lists.sourceforge.net> Subject: Question about tidy > > Dear Sir, > I’m a new learner of tidy. My work is cleaning up and fixing security > issues of the website. So when I meet tidy, I have to say its functions > and feathers of tidy is really great, it help me a lot.I just have two > questions, may be it looks naive. > > 1. I have a website folder. It contains 30s html files, I use the command > to clean all the html in the folder : ./tidy -f error.log *.html > So tidy can scan all the html files, generate error.log file and output > all the log information into it. > It print like > line 1 column 1 - Warning: missing <!DOCTYPE> declaration… > …. > ..... > 10 warnings, 0 errors were found! > > line 1 column 1 - Warning: missing <!DOCTYPE> declaration… > .......... > ..... > 10 warnings, 0 errors were found! > It prints each html page’s error info one by one, but don’t separate them > by html page name. I don’t know which error info is from which html file. > How can I solve this problem? Thanks very much. > > 2. I want to add google analytics code in my web site, so it needs to > append some javascript code at the end of each webpage. I know that Tidy > can generate a parser tree based on old html code and then print clean > html code, can I change the source code of tidy and append js code to > html? I have read the source code of tidy, there are so many c files in > the tidy src directory. I know some file is used to clean, some for parse, > but I don’t know which c file I should change to add the appending > function. Can you give me some instruction? > > Many thanks! > Best, > > Hao
Received on Saturday, 2 August 2008 22:10:50 UTC