vishi83 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks !!

To check the bad style of our perl script , we can use perltidy and checkstyle..

I need something similar for html (especially the templates *.tmpl files ). When searched for such an utility i noticed a thing called 'tidy' in But this tidy cleans up only a pure html file, very effective though. But when i use this tidy to check my .tmpl files , it says ,

line 14 column 25 - Error: <tmpl_var> is not recognized!...

You can check this yourself ...

jus give this..
tidy -o output.html source.html

But i need some utilites for templates.. Can anybody with better ideas for this ...

Thank YOu!!!

A perl Script without 'strict' is like a House without Roof; Both are not Safe;

Replies are listed 'Best First'.
Re: Question on Html Tidy
by sauoq (Abbot) on Nov 10, 2005 at 10:13 UTC

    Actually, tidy can do this for you. Check the manpage and look for the new-*-tags config options. Basically, you create a config file containing a line like:

    new-empty-tags: tmpl_var
    And run tidy with the -config option pointing at that config file. I think tidy will report these as warnings, but it will still clean up the file for you.

    Also, tidy knows about ASP style tags (<% ... %>) so those who can use them have an easy out.

    "My two cents aren't worth a dime.";
Re: Question on Html Tidy
by tphyahoo (Vicar) on Nov 10, 2005 at 09:27 UTC
    Your problem, I don't know. But you might want to check out HTML::Tidy, which I believe is a perl wrapper around that utility.

    UPDATE: Actually, on closer inspection, I'm not so sure it's a wrapper around that utility... but still worth a look I think.

    UPDATE 2: Corrected the link.

Re: Question on Html Tidy
by tinita (Parson) on Nov 10, 2005 at 11:49 UTC
    HTML::Template lets you use <!-- tmpl_var ... --> which is valid html. update: (well, not always). thanks, wfsp)

      Hi ..
      I Think you got it wrong.
      I have asked for an utility and not the script to do it..

      Please read sauoq's answer before sending any replies.. He was spot on.. Thanks for your answer man!!!
      It really worked....

      This is wat i tried...
      created tidy.conf with contents...

      new-empty-tags: tmpl_var,tmpl_if,tmpl_else,tmpl_loop
      This will now work for templates...

      To summarise everything..

      Download the tgz file for tidy from sourceforge. start using it Read the man page of tidy from sourceforge site for your reference
      People who use perltidy can understand this also.. Try do lot of learning on this..

      Thank u

      A perl Script without 'strict' is like a House without Roof; Both are not Safe;
        new-empty-tags: tmpl_var,tmpl_if,tmpl_else,tmpl_loop