Welcome to WebmasterWorld Guest from 54.166.152.121

Forum Moderators: open

Message Too Old, No Replies

HTML code "beautifier"?

Maintaining 3rd party code

     
3:00 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I found myself in the position to maintain someone else's HTML code. His coding style can only be called "interesting".

Can anyone recommend an external HTML formatter/beautifier that at least indents and structures spagetthi-code a bit?

3:48 pm on Jan 23, 2006 (gmt 0)

10+ Year Member



Dreamweaver and HomeSite both have this kind of functionality. The open source HTML Tidy would probably be your best bet.
4:18 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll second HTMLTidy - really a neat tool. I use it all the time. You can create your own config file with your preferences for markup indents/capitalization/anything you can imagine and use it for all your projects.
9:53 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another vote for html tidy. DW won't do a good job unless you reign it in a little. It's nicknamed 'the Beaver' for a reason ;)
9:57 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, got the message :-)

Actually there was an online version of it which worked quite well, though it complained about some Javascript issues. I'm going to have a look at the standalone version since I want some more formatting (like a blank line in front of <Hx> tags).

10:03 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Actually there was an online version of it which worked quite well, though it complained about some Javascript issues. I'm going to have a look at the standalone version since I want some more formatting (like a blank line in front of <Hx> tags).

You can do this with FrontPage too. Go into Page Options and configure the formatting for tags. Once you do that, open the page in FrontPage and switch to HTML (Code) view. Right click the page while in Code view. Select Reformat HTML from the menu and it's done. I've been using it for years and it will clean even the most difficult of pages. One thing to be careful of though are empty attributes. FrontPage does not like empty attributes when using the Reformat HTML command. It will basically take this ...alt=""> and change it to ...alt>.

P.S. FrontPage 2003 does not exhibit the above behavior so it appears to have been addressed.

[edited by: pageoneresults at 10:10 pm (utc) on Jan. 23, 2006]

10:05 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Find and replace in your favourite Dev tool will do that easy enough - if HTML tidy wont, notepad ++ will. Loving Regular expression searches since I discovered them.

and what p1r said ;)

10:09 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



@pageoneresults: Frontpage is a commercial tool. Since I own GoLive which came with the Adobe bundle, I don't want to invest in another commercial editor (especially since I barely have the need for one). Most of my pages come from a CMS (Typo3), and on those rare occasions I need to write some code myself I use Scite which does identation as I code.

Only for 3rd party code I would need some cleanup.

10:17 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Since I own GoLive which came with the Adobe bundle, I don't want to invest in another commercial editor (especially since I barely have the need for one).

I just opened up my copy of GoLive CS2 and it looks like you have complete control over HTML code formatting and can probably set up a similar routine. I'm not that familiar with the GoLive product, but if you have it, and can figure it out, you already have one of the best page cleaners available.

I don't want to invest in another commercial editor.

$76.00 to $200.00

Would typically pay for itself after one cleaning. ;)

[edited by: pageoneresults at 10:20 pm (utc) on Jan. 23, 2006]

10:20 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mine is CS1 (or only "CS") and I looked hard to see if it can clean imported code - which does not seem to be true.

But the issue is already solved, so no need to dig deeper (though I appreciate your feedback).

8:42 am on Jan 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well the price of Frontpage seems low, but then we get into TCO discussion: I never worked with it before so I need time to learn it. As a typical MS program, it will most likely want to install gazillion new libraries and frameworks on my PC thus endangering future stability etc...
9:42 am on Jan 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Considering the pro's and cons of FP and DW I know where my choice would lie - No contest. Copies of DW4 are very cheap to buy + upgrade.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month