Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

diff for H::T and TT

by miyagawa (Chaplain)
on Apr 24, 2002 at 13:21 UTC ( [id://161595]=perlmeditation: print w/replies, xml ) Need Help??

Anyone sick of your co-workin' designers breaking your templates when they fix-up your bare bone template into production ready HTML? I've made simple tools to prevent the issue.

  • htdiff -- diff for HTML::Template template structures
  • ttdiff -- diff for Template Toolkit template structures
These tools re-build bare-bone structure of your templates and compares them, output the difference if any. It'll be quite useful in template-design migration. What you should do is just run (h|t)tdiff against your bare bone template and the final template (which may be full of TABLE tags or something like that) to see if there's any typos or losing in migration.

Any suggestions and patches welcome (via email is okay to me).

Update: put an emphasis about that these utils work on the structures of the template, rather than contents. Thanks to tomhukins for pointing it.

--
Tatsuhiko Miyagawa
miyagawa@cpan.org

Replies are listed 'Best First'.
Re: diff for H::T and TT
by tomhukins (Curate) on Apr 24, 2002 at 15:21 UTC

    This is a good solution if you're not running a version control system, but in my experience it's a good idea to use version control for Web/software development.

    Sure, developers and designers require training to use tools like CVS, but you could have a nightly job update the CVS repository from a working directory to reap some of the benefits of version control without people having to learn new skills.

    There are good CVS clients available for a wide range of platforms. CVSWeb lets you find out who changed what, when and why without needing any specialised software.

    If you can't use CVS or some other version control system, your scripts could be useful, but I believe you'd be better off with a more generic solution.

      Oh well, I do use CVS! Note that these tools find difference of structure of the template. (My first post was just a little ambiguous for this point. Thanks for pointing this)

      What this tool (possibly) solves is the situation below:

      Programmers make a simple template

      First you'd make a bare bone template like this:
      <TABLE> [% FOREACH p = product %] <TR><TD>name: [% p.name %]</TD></TR> [% END %] </TABLE>
      okay, this HTML is very simple.

      Designers migrate this template into production ready style

      Their HTML is kind of hell, with various TABLE tags or something. (Oh well, stop argueing about style-sheet vs TABLE tag here). They possibly have difficulty in migrating the barebone template into production ready design. They'd make typos in template variable name, or forget to paste some code chunks in the template.

      Then ttdiff and htdiff will find the structual differences between the two template. It can work more nicely with CVS, off course!

      --
      Tatsuhiko Miyagawa
      miyagawa@cpan.org

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://161595]
Approved by rob_au
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found