Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: All
Jun 1, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Pretty Print Your HTML and ASP Code for Visitors

If you are preparing Active Server Pages code for printing or for code review it helps to make the script as tidy as possible. A free utility called HTML Tidy from http://www.w3.org/People/Raggett/tidy/ does an excellent job of putting HTML in order. Unfortunately, Tidy doesn't preserve ASP code. For example, it converts ASP delimiters into HTML escape codes so that <% turns into &lt;%. However, if you make a backup and then note the conversions, you can use your editor's Search and Replace feature to reverse key changes and get back your ASP code. Just replace &lt; with < and so on. In addition to the delimiters, watch for changes to the ampersand (&).

HTML Tidy runs from the command prompt. Here's the contents of a batch file called dotidy.bat:

tidy -i -m -u -raw -f  errors.txt -wrap 200 %1
Call the batch file by passing the filename to it as in:
dotidy.bat myfile.asp
I've asked the author of HTML Tidy to add a switch that protects ASP code. Perhaps additional requests at his Web page will provide an incentive.
Ken Cox
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date