Résumé
A template processor (also known as a template engine or template parser) is software designed to combine templates with a data model to produce result documents. The language that the templates are written in is known as a template language or templating language. For purposes of this article, a result document is any kind of formatted output, including documents, web pages, or source code (in source code generation), either in whole or in fragments. A template engine is ordinarily included as a part of a web template system or application framework, and may be used also as a preprocessor or filter. Template engines typically include features common to most high-level programming languages, with an emphasis on features for processing plain text. Such features include: variables and functions text replacement file inclusion (or transclusion) conditional evaluation and loops While template processors are typically a separate piece of software, used as part of a system or framework, simple templating languages are commonly included in the string processing features of general-purpose programming languages, and in text processing programs, notably text editors or word processors. The templating languages are generally simple substitution-only languages, in contrast to the more sophisticated facilities in full-blown template processors, but may contain some logic. Simple examples include ‘printf’ print format strings, found in many programming languages, and snippets, found in a number of text editors and source code editors. In word processors, templates are a common feature, while automatic filling in of the templates is often referred to as mail merge. An illustrative example of the complementary nature of parsing and templating is the s (substitute) command in the sed text processor, originating from search-and-replace in the ed text editor. Substitution commands are of the form s/regexp/replacement/, where regexp is a regular expression, for parsing input, and replacement is a simple template for output, either literal text, or a format string containing the characters & for "entire match" or the special escape sequences \1 through \9 for the nth sub-expression.
À propos de ce résultat
Cette page est générée automatiquement et peut contenir des informations qui ne sont pas correctes, complètes, à jour ou pertinentes par rapport à votre recherche. Il en va de même pour toutes les autres pages de ce site. Veillez à vérifier les informations auprès des sources officielles de l'EPFL.