DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

Reply
 
Thread Tools Display Modes
Old 11-22-2006, 09:57 AM   #1
dacoyle
Member
 
dacoyle's Avatar
 
Join Date: Aug 2005
Location: Arlington, VA (across the river from Washington, DC)
Posts: 560
Default Tidy

I need to clean up 190 html files. Anyone familair with running Tidy with a .bat file? The files have many errors, but the priority is to quote all attributes and get the tags in lowercase.

Thanks,

   
__________________
Dennis
dacoyle is offline   Reply With Quote
Old 11-22-2006, 12:10 PM   #2
iamback
Member
 
iamback's Avatar
 
Join Date: Oct 2005
Location: Amsterdam, NL
Posts: 4,894
Default

Quote:
Originally Posted by dacoyle View Post
I need to clean up 190 html files. Anyone familair with running Tidy with a .bat file? The files have many errors, but the priority is to quote all attributes and get the tags in lowercase.
Most of that can be done with global search and replace across files, using regular expressions. No need for any batch as the "global" bit handles that. UltraEdit and HomeSite have this capability, probably DreamWeaver, and no doubt other capable editors as well. Other thing like turning flags ('selected') into proper XHTML attributes ('selected="selected"') can be done like that as well. In fact, I have done that for a whole site (same order of magnitude) with HomeSite once, leaving very little to do manually provided the HTML is "clean" to begin with.

   
__________________
Marjolein Katsma
Look through my eyes on Cultural Surfaces (soon!), My ArtFlakes shop and Flickr.
Occasionally I am also connecting online dots... and sometimes you can follow me on Marjolein's Travel Blog
iamback is offline   Reply With Quote
Old 11-23-2006, 05:56 AM   #3
dthomsen8
Member
 
dthomsen8's Avatar
 
Join Date: Aug 2005
Location: Philadelphia, PA 19130
Posts: 2,158
Default Tidy with .bat File

Quote:
Originally Posted by dacoyle View Post
I need to clean up 190 html files. Anyone familair with running Tidy with a .bat file? The files have many errors, but the priority is to quote all attributes and get the tags in lowercase.
I have used Tidy with a .bat file on a small number of HTML files, but never so many as that. Try it out with just one example, make sure that the output doesn't overlay the input by sending it to a separate directory, and that you get all the parameters set correctly for what you want to accomplish. The separate output directory is good for erasing the output, should the first execution not quite do the whole job.

I think I wrote a single .bat file to do just one HTML file, but written with a parameter called from a big .bat file which then called the individual file for one .bat. Using the DOS command dir *.html > work.txt I created a list to make into the big .bat file calling the small .bat file.


Perhaps there are other techniques which will do the job, but I have never tried any of those.

Let us know how it works out.
dthomsen8 is offline   Reply With Quote
Old 11-24-2006, 11:14 AM   #4
Steve Rindsberg
Staff
 
Join Date: Nov 2004
Posts: 6,709
Default

There's some kind of primitive "for each " capability built into DOS BAT files but it's pretty obscure and I'm not sure if it extends past 9 parameters.

Do you have MS Office? If so I can cobble you up a quickie macro that'll fire off a command line for each file in a directory that meets a certain file spec.

   
__________________
Steve Rindsberg
====================
www.pptfaq.com
www.pptools.com
and stuff
Steve Rindsberg is offline   Reply With Quote
Old 11-24-2006, 07:40 PM   #5
dacoyle
Member
 
dacoyle's Avatar
 
Join Date: Aug 2005
Location: Arlington, VA (across the river from Washington, DC)
Posts: 560
Default

Quote:
Originally Posted by iamback View Post
Most of that can be done with global search and replace across files, using regular expressions. No need for any batch as the "global" bit handles that. UltraEdit and HomeSite have this capability, probably DreamWeaver, and no doubt other capable editors as well. Other thing like turning flags ('selected') into proper XHTML attributes ('selected="selected"') can be done like that as well. In fact, I have done that for a whole site (same order of magnitude) with HomeSite once, leaving very little to do manually provided the HTML is "clean" to begin with.
Marjolein, I'm a fan of RE but I'm talking about quoting attributes and making tags lower case in 190 files. Tidy can already do that, but even if I could write my own REs I wouldn't attempt it with so many variables.

My company has a custom Codesweeper for HomeSite that does exactly what I need, but I don't want to run it across 190 files individually.

   
__________________
Dennis
dacoyle is offline   Reply With Quote
Old 11-24-2006, 07:41 PM   #6
dacoyle
Member
 
dacoyle's Avatar
 
Join Date: Aug 2005
Location: Arlington, VA (across the river from Washington, DC)
Posts: 560
Default

Quote:
Originally Posted by Steve Rindsberg View Post
Do you have MS Office? If so I can cobble you up a quickie macro that'll fire off a command line for each file in a directory that meets a certain file spec.
I have MS Office, but I don't want to further damage the code by subjecting them to Word.

   
__________________
Dennis
dacoyle is offline   Reply With Quote
Old 11-24-2006, 08:52 PM   #7
Steve Rindsberg
Staff
 
Join Date: Nov 2004
Posts: 6,709
Default

Did I mention opening the files in Word? Not a chance! ;-)

But it's possible to write a simple macro that'd run in Word (or Excel or PowerPoint ... whichever you like) to get a list of the files in a directory and launch whatever command line you like on them. The Office app simply hosts the vba code needed to do the job.

   
__________________
Steve Rindsberg
====================
www.pptfaq.com
www.pptools.com
and stuff
Steve Rindsberg is offline   Reply With Quote
Old 11-24-2006, 11:09 PM   #8
Steve Rindsberg
Staff
 
Join Date: Nov 2004
Posts: 6,709
Default

Hey, skip all this; google HTML-Kit
Quite a box of tools and among other things, it looks like it'll run Tidy on batches of files. I'm not sure how much control it gives you over Tidy options, but it looks like it's worth checking out.

Price is right too. 0 EuroBuckYenPiastreLira

   
__________________
Steve Rindsberg
====================
www.pptfaq.com
www.pptools.com
and stuff
Steve Rindsberg is offline   Reply With Quote
Old 11-25-2006, 02:35 PM   #9
dacoyle
Member
 
dacoyle's Avatar
 
Join Date: Aug 2005
Location: Arlington, VA (across the river from Washington, DC)
Posts: 560
Default

Quote:
Originally Posted by Steve Rindsberg View Post
Hey, skip all this; google HTML-Kit
Quite a box of tools and among other things, it looks like it'll run Tidy on batches of files. I'm not sure how much control it gives you over Tidy options, but it looks like it's worth checking out.

Price is right too. 0 EuroBuckYenPiastreLira
Steve, it looks like a nice application, but the only option I can find for batching Tidy is to generate a report but not update the files. I'll keep playing with it, though. Thanks for the tip.

   
__________________
Dennis
dacoyle is offline   Reply With Quote
Old 11-25-2006, 03:06 PM   #10
Steve Rindsberg
Staff
 
Join Date: Nov 2004
Posts: 6,709
Default

This is funny ... a bit of prodding at the FAQ reveals that they don't feel it's wise to batch process with tidy, so they disable it. Then go on to explain how you can do it from the command line. We're getting close to where we came in ... watch for it when it comes round again. Here's the brass ring:

http://www.chami.com/html-kit/faq/pa...h_process.html

(where it gives the magic cmd line trick)

for %i in (*.html) do c:\temp\tidy.exe -m "%i"

   
__________________
Steve Rindsberg
====================
www.pptfaq.com
www.pptools.com
and stuff
Steve Rindsberg is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tidy Help CarlSeiler Web Site Building & Maintenance 11 02-26-2007 03:41 PM
TIDY for CSS? dthomsen8 Web Site Building & Maintenance 27 03-27-2006 09:54 AM


All times are GMT -8. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Contents copyright 2004–2014 Desktop Publishing Forum and its members.