In section 5,
Terence Parr defines a template as:
A template is an output document with embedded actions that the engine evaluates when rendering the template.
SSI
Server-side includes can be considered templating.Print statement
How about this program:is this a template?out.println("<html>"); out.println("<body>"); out.println("<h1>Servlet test</h1>"); String name = request.getParameter("name"); out.println("Hello, "+name+"."); out.println("</body>"); out.println("</html>");
- output document
- I dont see an output document... maybe the subroutine can be considered an output document.
- The embedded actions?
- I guess string concatenation.
- Engine?
- The engine in this case is the Java programming language.
real templating
There's no question that HTML::Mason, etc are template enginesSeamstress?
I'm not so sure that HTML::Seamstress has templates. Let's look at the definition again:- output document
- an HTML file... so far so good.
- The embedded actions?
- There really are none. An XHTML compliant file doesnt necessarily have embedded actions.
- Engine?
- The engine in this case is not-fixed. There is no fixed way of
looking at an XHTML file that forces it to be dynamically produced in
any particular way. Template engines have a fixed way of looking at
embedded actions. Let's example a bit of SYNOPSIS code from the
Petal distro:
Petal has one way of processing that body tag: it will do a replacement. Seamstress has no fixed protocol between Perl and HTML. It could do a replacement there. But it could also simulate the INCLUDE mechanism of another template system and locate a file named bar.html and inline it. Or it could locate a method named bar and call it. No fixed protocol.<html xmlns:tal="http://purl.org/petal/1.0/"> <body tal:content="bar">Dummy_Content</body> </html>
Dynamic HTML production... without templating
Templating engines are designed to ease text production and may or may not have special support for HTML. HTML::Seamstress is designed solely for object-oriented HTML production. So there is some overlap between the functionality of templating systems and a dynamic HTML generation API, but they dont serve all the same purposes or have the same set of functional components.Opinions encouraged
I am curious about whether you agree or disagree with my position and why.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: HTML::Seamstress is not a templating engine?
by pKai (Priest) on Aug 03, 2009 at 19:44 UTC | |
by metaperl (Curate) on Aug 03, 2009 at 20:24 UTC |
Back to
Meditations