Ruby equiv of Perl's HTML::Template module?

Discussion in 'Ruby' started by ChrisO, Sep 15, 2004.

  1. ChrisO

    ChrisO Guest

    Hopefully someone here fairly familiar with Perl can point me to a Ruby
    HTML templating system that works like Perl's HTML::Template. The next
    closest perferred equivalent would be Perl Template Toolkit. But I
    really like HTML::Template a lot.

    I'm relatively new to Ruby (very slight dabbling since v1.6 circa 2001),
    so my opinions may not hold water, but I don't really consider eRuby a
    templating system. Maybe someone can help me see how it's not anything
    more than PHP or ASP except Ruby is used instead of PHP or VBScript...?

    Anyway, my main interest is in finding something like Perl's
    HTML::Template. Hopefully it exists somewhere in the Ruby world.

    Thanks,
    -ceo
    ChrisO, Sep 15, 2004
    #1
    1. Advertising

  2. > Hopefully someone here fairly familiar with Perl can point me to a Ruby
    > HTML templating system that works like Perl's HTML::Template. The next
    > closest perferred equivalent would be Perl Template Toolkit. But I
    > really like HTML::Template a lot.
    >
    > I'm relatively new to Ruby (very slight dabbling since v1.6 circa 2001),
    > so my opinions may not hold water, but I don't really consider eRuby a
    > templating system. Maybe someone can help me see how it's not anything
    > more than PHP or ASP except Ruby is used instead of PHP or VBScript...?
    >
    > Anyway, my main interest is in finding something like Perl's
    > HTML::Template. Hopefully it exists somewhere in the Ruby world.


    I don't think there's a direct port, but there are some Ruby HTML
    templating libraries around (RDoc, cs/template, Amrita, ...). Can you
    describe the benefits of the Perl solution? Maybe one of these (and there
    are heaps more, I'm sure) is a close match.

    I use and like Amrita for generating static pages. Can't comment on
    anything else.

    Cheers,
    Gavin
    Gavin Sinclair, Sep 15, 2004
    #2
    1. Advertising

  3. ChrisO

    Kent Sibilev Guest

    Take a look at rdoc/template.rb file which defines TemplatePage class.
    I think it pretty much resembles HTML::Template system.

    Cheers,
    Kent.

    On Sep 15, 2004, at 1:14 AM, ChrisO wrote:

    > Hopefully someone here fairly familiar with Perl can point me to a
    > Ruby HTML templating system that works like Perl's HTML::Template.
    > The next closest perferred equivalent would be Perl Template Toolkit.
    > But I really like HTML::Template a lot.
    >
    > I'm relatively new to Ruby (very slight dabbling since v1.6 circa
    > 2001), so my opinions may not hold water, but I don't really consider
    > eRuby a templating system. Maybe someone can help me see how it's not
    > anything more than PHP or ASP except Ruby is used instead of PHP or
    > VBScript...?
    >
    > Anyway, my main interest is in finding something like Perl's
    > HTML::Template. Hopefully it exists somewhere in the Ruby world.
    >
    > Thanks,
    > -ceo
    >
    Kent Sibilev, Sep 15, 2004
    #3
  4. On Wed, 15 Sep 2004 14:56:11 +0900, Kent Sibilev <> wrote:
    > Take a look at rdoc/template.rb file which defines TemplatePage class.
    > I think it pretty much resembles HTML::Template system.


    Also, Ruwiki has lib/ruwiki/template.rb that has an adapted form of
    that (I have a new, updated version that is going in) which supports
    labels as distinct from variables and some one-line forms of the
    conditional and looping code.

    -austin
    --
    Austin Ziegler *
    * Alternate:
    : as of this email, I have [ 6 ] Gmail invitations
    Austin Ziegler, Sep 15, 2004
    #4
  5. ChrisO

    Chris Guest

    Gavin Sinclair wrote:
    >>Hopefully someone here fairly familiar with Perl can point me to a Ruby
    >>HTML templating system that works like Perl's HTML::Template. The next
    >>closest perferred equivalent would be Perl Template Toolkit. But I
    >>really like HTML::Template a lot.
    >>
    >>I'm relatively new to Ruby (very slight dabbling since v1.6 circa 2001),
    >> so my opinions may not hold water, but I don't really consider eRuby a
    >>templating system. Maybe someone can help me see how it's not anything
    >>more than PHP or ASP except Ruby is used instead of PHP or VBScript...?
    >>
    >>Anyway, my main interest is in finding something like Perl's
    >>HTML::Template. Hopefully it exists somewhere in the Ruby world.

    >
    >
    > I don't think there's a direct port, but there are some Ruby HTML
    > templating libraries around (RDoc, cs/template, Amrita, ...). Can you
    > describe the benefits of the Perl solution?


    I'm not sure I am able to accurately articulate what I perceive the
    benefits to be. The main "advantage" that I feel -- it's kind of a
    "gut" thing -- is that the templates are, in a logical way, truly only
    markup. There is no "code" per se, loosely speaking. Strictly
    speaking, I realize there are the loop and conditional tags, but still
    it "feels" like only HTML markup. I really like that because the
    separation between logic and presentation is about as good as it gets.

    All my opinion of course but those that use HTML::Template in the Perl
    world, I think would agree. I'm definitely going to check out some of
    the suggestions. I've held this infatuation with Ruby for a long time,
    and even adopted some "Ruby ways" in my Perl coding for a few years now.
    I've decided the only real way to bridge the gap is to force myself to
    stop using Perl (which I still really like) and just use Ruby full out.
    So I'm trying to find things that ease the transition, like
    HTML::Template. I can't afford a lot of downtime, which has been the
    biggest strike against using Ruby -- I'm pretty fast, tight and accurate
    in hitting targets using Perl (if I may be so bold). But there are
    several "Wow!" factors in Ruby that keep me hanging around... wishing... :)

    -ceo
    Chris, Sep 15, 2004
    #5
  6. The second URL here offers up an ruby equivalent of HTML::Template. I've
    used the standard html-template in Ruby, which is philosophically
    identical to Perl's HTML::Template, but uses different syntax for the
    <TMPL_VAR> tags (that's the first URL below). Using it is still familiar
    if you are a fan of HTML::Template.

    The newer html-template2 claims to be compatible with HTML::Template,
    though I haven't used it myself.

    http://raa.ruby-lang.org/project/html-template/
    http://raa.ruby-lang.org/project/html-template2/



    On Wed, 15 Sep 2004, Chris wrote:

    > Gavin Sinclair wrote:
    > >>Hopefully someone here fairly familiar with Perl can point me to a Ruby
    > >>HTML templating system that works like Perl's HTML::Template. The next
    > >>closest perferred equivalent would be Perl Template Toolkit. But I
    > >>really like HTML::Template a lot.
    > >>
    > >>I'm relatively new to Ruby (very slight dabbling since v1.6 circa 2001),
    > >> so my opinions may not hold water, but I don't really consider eRuby a
    > >>templating system. Maybe someone can help me see how it's not anything
    > >>more than PHP or ASP except Ruby is used instead of PHP or VBScript...?
    > >>
    > >>Anyway, my main interest is in finding something like Perl's
    > >>HTML::Template. Hopefully it exists somewhere in the Ruby world.

    > >
    > >
    > > I don't think there's a direct port, but there are some Ruby HTML
    > > templating libraries around (RDoc, cs/template, Amrita, ...). Can you
    > > describe the benefits of the Perl solution?

    >
    > I'm not sure I am able to accurately articulate what I perceive the
    > benefits to be. The main "advantage" that I feel -- it's kind of a
    > "gut" thing -- is that the templates are, in a logical way, truly only
    > markup. There is no "code" per se, loosely speaking. Strictly
    > speaking, I realize there are the loop and conditional tags, but still
    > it "feels" like only HTML markup. I really like that because the
    > separation between logic and presentation is about as good as it gets.
    >
    > All my opinion of course but those that use HTML::Template in the Perl
    > world, I think would agree. I'm definitely going to check out some of
    > the suggestions. I've held this infatuation with Ruby for a long time,
    > and even adopted some "Ruby ways" in my Perl coding for a few years now.
    > I've decided the only real way to bridge the gap is to force myself to
    > stop using Perl (which I still really like) and just use Ruby full out.
    > So I'm trying to find things that ease the transition, like
    > HTML::Template. I can't afford a lot of downtime, which has been the
    > biggest strike against using Ruby -- I'm pretty fast, tight and accurate
    > in hitting targets using Perl (if I may be so bold). But there are
    > several "Wow!" factors in Ruby that keep me hanging around... wishing... :)
    >
    > -ceo
    >


    --
    Kurt Williams
    Senior Engineer
    http://www.nationalgeographic.com
    Kurt Williams, Sep 15, 2004
    #6
  7. ChrisO

    Mark Probert Guest

    Hi, Chris.

    Chris <> wrote:

    > So I'm trying to find things that ease the transition, like
    > HTML::Template. I can't afford a lot of downtime, which has been the
    > biggest strike against using Ruby -- I'm pretty fast, tight and
    > accurate in hitting targets using Perl (if I may be so bold). But
    > there are several "Wow!" factors in Ruby that keep me hanging
    > around... wishing... :)
    >


    I been using IOWA and finding it really powerful. Of course, if you are
    going down the Web App route, almost all of which contain a templating
    system, then there are a number of options to consider, like:

    + IOWA
    + Rails
    + Cerise

    etc.

    I guess it depends on the why you need the templates in the first place.

    --
    -mark. (probertm @ acm dot org)
    Mark Probert, Sep 15, 2004
    #7
  8. ChrisO

    Brian Wisti Guest

    --- Chris <> wrote:

    > Gavin Sinclair wrote:
    > >>Hopefully someone here fairly familiar with Perl can point me to a

    > Ruby
    > >>HTML templating system that works like Perl's HTML::Template. The

    > next
    > >>closest perferred equivalent would be Perl Template Toolkit. But I
    > >>really like HTML::Template a lot.
    > >>
    > >>I'm relatively new to Ruby (very slight dabbling since v1.6 circa

    > 2001),
    > >> so my opinions may not hold water, but I don't really consider

    > eRuby a
    > >>templating system. Maybe someone can help me see how it's not

    > anything
    > >>more than PHP or ASP except Ruby is used instead of PHP or

    > VBScript...?
    > >>
    > >>Anyway, my main interest is in finding something like Perl's
    > >>HTML::Template. Hopefully it exists somewhere in the Ruby world.

    > >
    > >
    > > I don't think there's a direct port, but there are some Ruby HTML
    > > templating libraries around (RDoc, cs/template, Amrita, ...). Can

    > you
    > > describe the benefits of the Perl solution?

    >
    > I'm not sure I am able to accurately articulate what I perceive the
    > benefits to be. The main "advantage" that I feel -- it's kind of a
    > "gut" thing -- is that the templates are, in a logical way, truly
    > only
    > markup. There is no "code" per se, loosely speaking. Strictly
    > speaking, I realize there are the loop and conditional tags, but
    > still
    > it "feels" like only HTML markup. I really like that because the
    > separation between logic and presentation is about as good as it
    > gets.
    >
    > All my opinion of course but those that use HTML::Template in the
    > Perl
    > world, I think would agree. I'm definitely going to check out some
    > of
    > the suggestions. I've held this infatuation with Ruby for a long
    > time,
    > and even adopted some "Ruby ways" in my Perl coding for a few years
    > now.
    > I've decided the only real way to bridge the gap is to force myself
    > to
    > stop using Perl (which I still really like) and just use Ruby full
    > out.
    > So I'm trying to find things that ease the transition, like
    > HTML::Template. I can't afford a lot of downtime, which has been the
    >
    > biggest strike against using Ruby -- I'm pretty fast, tight and
    > accurate
    > in hitting targets using Perl (if I may be so bold). But there are
    > several "Wow!" factors in Ruby that keep me hanging around...
    > wishing... :)
    >
    > -ceo


    You can always take a poke at my own PageTemplate library. It was a
    sort of self-instructional project designed (ha! "Designed"? Right!) to
    address the homesickness I felt when using Ruby kept me away from
    HTML::Template.

    http://coolnamehere.com/products/pagetemplate/

    You may find that it is incredibly raw and simplistic, and it might not
    even be what you were thinking of, but hey - what's one more templating
    library out there? Feel free to poke at it all you want :)

    Kind Regards,

    Brian Wisti
    http://coolnamehere.com/
    Brian Wisti, Sep 15, 2004
    #8
  9. ChrisO

    ChrisO Guest

    Kurt Williams wrote:
    > The second URL here offers up an ruby equivalent of HTML::Template. I've
    > used the standard html-template in Ruby, which is philosophically
    > identical to Perl's HTML::Template, but uses different syntax for the
    > <TMPL_VAR> tags (that's the first URL below). Using it is still familiar
    > if you are a fan of HTML::Template.
    >
    > The newer html-template2 claims to be compatible with HTML::Template,
    > though I haven't used it myself.
    >
    > http://raa.ruby-lang.org/project/html-template/
    > http://raa.ruby-lang.org/project/html-template2/
    >


    Perfect. I'll check them out!

    -ceo
    ChrisO, Sep 15, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kevinm3574

    java regex equiv to perl !~

    kevinm3574, Aug 2, 2005, in forum: Java
    Replies:
    7
    Views:
    1,263
    kevinm3574
    Aug 3, 2005
  2. Tom Allison

    perl equiv.

    Tom Allison, Feb 20, 2006, in forum: Ruby
    Replies:
    3
    Views:
    103
    Austin Ziegler
    Feb 26, 2006
  3. snacktime

    ruby equiv of perl pos

    snacktime, Aug 12, 2006, in forum: Ruby
    Replies:
    14
    Views:
    197
    Thomas, Mark - BLS CTR
    Aug 17, 2006
  4. Amittai Aviram

    Perl equiv to PHP file() ?

    Amittai Aviram, Aug 18, 2003, in forum: Perl Misc
    Replies:
    4
    Views:
    107
    Gunnar Hjalmarsson
    Aug 18, 2003
  5. Aidan

    Perl equiv to PHP print_r

    Aidan, Mar 17, 2005, in forum: Perl Misc
    Replies:
    2
    Views:
    659
    Aidan
    Mar 18, 2005
Loading...

Share This Page