HTML Tidy

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
BATMan_Phln
Rank I - Novice
Posts: 12
Joined: Tue Jun 16, 2009 7:34 pm

HTML Tidy

Post by BATMan_Phln »

First of all, I searched the forum and got this...

The following words in your search query were ignored because they are too common words: html tidy.

...not much help there.

Anyway, is there a way to have HTML Tidy break at a tag instead of in the tag?

EXAMPLE:
Wrap set at 80 (any other setting just changes which part wraps but it's still incorrect)
Current break:

<a href="mailto:info@shakycoastaviation.com"><font size="4" color=
"#00FF00"><strong>Email</strong></font></a> | <a href=
"Aircraft/index.htm"><font size="4" color=
"#00FF00"><strong>Projects</strong></font></a> | <a href=
"Products.htm"><font size="4" color=
"#00FF00"><strong>Products</strong></font></a> | <a href=
"AboutUs.htm"><font size="4" color="#00FF00"><strong>About
Us</strong></font></a>

How I want it to look:

<a href="mailto:info@shakycoastaviation.com">
<font size="4" color="#00FF00"><strong>Email</strong></font></a> |
<a href="Aircraft/index.htm">
<font size="4" color="#00FF00"><strong>Projects</strong></font></a> |
<a href="Products.htm">
<font size="4" color="#00FF00"><strong>Products</strong></font></a> |
<a href="AboutUs.htm">
<font size="4" color="#00FF00"><strong>About Us</strong></font></a>

BTW, it's not my code so please don't criticize. I know it's crap. LOL

Thanks for the help,
B.A.T.Man
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: HTML Tidy

Post by Albert Wiersch »

Hello,

I checked the HTML Tidy quick-ref page:
http://tidy.sourceforge.net/docs/quickref.html

I didn't see any wrap options that will do what you want (look at the options beginning with "wrap"). :(
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
BATMan_Phln
Rank I - Novice
Posts: 12
Joined: Tue Jun 16, 2009 7:34 pm

Re: HTML Tidy

Post by BATMan_Phln »

Well, I went through the settings and played with all of those. Nothing worked so I guess I'm stuck doing it manually. :cry: I was hoping someone knew of a back-end that will make it work.

Thanks for the reply! :)
User avatar
MikeGale
Rank VI - Professional
Posts: 726
Joined: Mon Dec 13, 2004 1:50 pm
Location: Tannhauser Gate

Re: HTML Tidy

Post by MikeGale »

Like you, I have on occasion needed to process other people's markup.

On big jobs I have found Tidy able to do a lot of the work, but it has limits. It used to conflate different settings into one. Making it impossible to make it do exactly what you want. (Last time I checked it still worked like that.)

After a rough clean up with tidy I found that a little work with regular expressions on multiple files can often just about finish the job. It pays to test your regular expressions first and save them in a library for re-use.

For a small job, page by page editing, maybe by hand, can be most productive.

When doing a big job, setting up a CSE batch increases productivity.
ormaaj
Rank I - Novice
Posts: 10
Joined: Mon Nov 15, 2010 8:25 am

Re: HTML Tidy

Post by ormaaj »

It's a little old and not so maintained. Also huge with lots of options. It's nice for transforming a big mess into something resembling (x)html so you can finish the job with sed / some editor.

If you happen to be a Vim user have a look at :h makeprg and :h equalprg for filtering a buffer through tidy. :%! can be handy too.