Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Question on Html Tidy

by vishi83 (Pilgrim)
on Nov 10, 2005 at 09:00 UTC ( #507317=perlquestion: print w/ replies, xml ) Need Help??
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 sourceforge.net. 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!!!
vishi

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

Comment on Question on Html Tidy
Select or Download Code
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 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.

    -sauoq
    "My two cents aren't worth a dime.";
    
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 http://tidy.sourceforge.net/docs/tidy_man.html
      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
        tmpl_unless

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://507317]
Approved by wfsp
Front-paged by wfsp
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2014-09-18 11:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (112 votes), past polls