- Web template hook styles
:"This article is a supplement to the Delimiting and embedding strategies."
On
web template s the separation of concerns (content from presentation) require a low-level separation strategy to isolate template language from output language.Template syntax need special care with the "border" between languages, to avoid mixing and to supply scaping forms. There are well defined tags, marks or characteres, named "hooks", that intend to separate (compatibilize) the two languages.
Types of hook:
* "Script hooks": encloses blocks of developer-supplied program logic.
* "Sub-template hooks": to fix the frontiers of the sub-template block.
* "Expression hooks": to encode scalar variables, sub-template references, or expressions.Note: formally, all template language need clear rules for "clean-up (or extract) the "template language" from the "output language". Hooks, scripts and expressions are extracted with the Clear(T) function.
There are a height diversity of implemented styles for hook encoding, and there are also
web template system s with options to reconfigure "hooks".The listings below show the hooks styles used on the
web template system 's examples.Hook implemented notations
There are many styles of notations implemented (or configurable) on
web template system s. To referentiate then on other articles, "style labels" was supplied.cript hooks
Usual script hooks:, for instructions block.
ub-template hooks
See also Directive hooks with sub-templates, where, usually, the sub-templates are not-referenciable.
(referenciable) Sub-template hooks, to sub-template block definition:
Many template inlanguages offer also an internal syntax expression to interpolate strings. They use internal notation, like "string-hooks", for separation. Examples for specific expressions with interpolations:
Hook diversity
Basic factors:
# It is very ease to implementtemplate engine s to simple substitution template languages. If the application grow, and need more sophisticated language, it will be compatible with the first versions.
# Theweb template final user is, usually, aweb designer . He/she deals with the templates through a web editor, like Dreamweaver. There are many editors and web designer needs may force template language to adapt to the editor's restrictions.XML hook uniformazation tendency
There are a tendency on template languages to compatibilize hooks with the
XML syntax rules. On XML it is possible to embed many languages together. A language namespace for tag names, are defined by prefix.JSP example, for "specific hook notation" Versus "XML notation" (from the [http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPX3.html#wp118565 J2EE 1.4 tutorial] ):
Another way to embed template language on XML languages, is to add special/reserved attributes. See Attribute languages.
Wikimedia Foundation. 2010.