W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2002

Re: Tidying lots of files at once

From: Charles Reitzel <creitzel@rcn.com>
Date: Wed, 11 Sep 2002 10:08:23 -0400
Message-Id: <4.3.2.7.2.20020911100052.02a84be8@pop.rcn.com>
To: Ko-Kang Kevin Wang <kwan022@stat.auckland.ac.nz>
Cc: html-tidy@w3.org
I have attached a couple shell scripts we use to run the Tidy regression 
test.  It iterates over a directory, tidying each markup file with it's 
optional config file, placing the output into a separate directory.  You 
could probably strip out all the diff logic.

Here's the gist on tidy returns:

0       No Errors, No Warnings
1       No Errors, >0 Warnings
2       >0 Errors, >0 Warnings

In Windows, you can test the errorlevel variable after running Tidy.  E.g.

tidy -f %1.err -config foo.tidy.cfg %1 > out/%1
if errorlevel 2 goto handle_errors
if errorlevel 1 goto handle_warnings
goto success

:handle_errors
echo Had errors
goto done

:handle_errors
echo Had warnings
goto done

:success
echo No errors or warnings
goto done

:done

I didn't test this, so it might need some cleanup.

take it easy,
Charlie


At 04:53 AM 8/13/2002 -0400, Ko-Kang Kevin Wang wrote:

>Hi,
>
>I'm not sure if this is the right place to ask this, but...
>
>I am marking students' lab tutorials, the first thing I need to do is to 
>check if anyone whose HTML file (they submitted the HTML file 
>electronically) fails to pass the HTML Tidy.  By that I mean it generates 
>at least one "error".
>
>Say I'd like to write a DOS batch file OR a UNIX script file, so that it 
>runs through all the html files in one directory.  Check out the validity, 
>then return any files (i.e. print out the file name) that has at least 1
>errors.  In other words, any files that do NOT checked with:
>    0 warning, 0 errors were found!
>will have its file name printed on screen.  I am not worried about the "0 
>warning" section, only the "0 errors" (well, any files that do not produce
>"0 errors").
>
>I'm not sure how to write such a file, either is DOS or UNIX.  In fact I 
>would really appreciate it if one can quickly come up with a solution and
>send it to me :-)
>
>
>Cheers,
>
>Kevin
>
>---------------------------------------------------------Ko-Kang Kevin Wang
>Postgraduate PGDipSci Student
>Department of Statistics
>University of Auckland
>New Zealand
>Homepage: http://www.stat.auckland.ac.nz/~kwan022


Received on Wednesday, 11 September 2002 09:58:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:52 GMT