Templates
Gosu includes a native template system. Templates are text with embedded Gosu code within a larger block of text. The embedded Gosu code optionally calculates and generates text at the location of the code in the template text. It is also possible to store a Gosu template as a separate file. You can design your template files in either HTML or XML format, as long your HTML or XML conforms to the applicable standards.
Gosu provides the following mechanisms to use a Gosu template:
- Template syntax inside a text literal
- Inside your Gosu code, use template syntax for an in-line
Stringliteral value containing an embedded Gosu expression. Gosu template syntax combines static text that you provide with dynamic Gosu code that executes at run time and returns a result. Gosu uses the result of the Gosu expression to produce dynamic output at run time as aStringvalue. - Scriptlet syntax inside a text literal
- Inside your Gosu code, use scriptlet syntax for in-line Gosu statements.
- Separate template file
- Define a Gosu template as a separate file that you can execute from other code to perform an action and generate output. If you use a separate template file, you can use additional features such as passing custom parameters to your template.
