Sign in Join
FPDoc Onlineexperiment

fpTemplate unit

Simple template parsing mechanism.

fpTemplate implements a class TTemplateParser which can replace variables in a template text. The template variables are enclosed in delimiters. When a variable is encountered, it can be replaced by a string value. An event is called to get the value for a template variable. It does not contain loops or conditionals, but parametrized templates are possible.

The unit also contains TFPCustomTemplate and its descendant TFPTemplate. Which is a basic implementation that uses the template parser to substitute variables in a text.

Classes and records

ETemplateParserclassException for template parser errors.
TFPCustomTemplateclassBase class for templates.
TFPTemplateclassTemplate component.
TTemplateParserclassA class to parse templates.

Types

TGetParamEventprocedure typeEvent to get a value for a template variable.
TParseDelimitertypeType for a delimiter string.
TReplaceTagEventprocedure typeEvent to replace a tag.

Constants

DefaultParseDepthconstantDefault maximum recursion depth for parsing.
MaxDelimLengthconstantMaximum length for a delimiter string.

Variables

DefaultEndDelimitervariableDefault end delimiter for a template variable.
DefaultParamEndDelimitervariableDefault end delimiter for a template variable parameter.
DefaultParamStartDelimitervariableDefault start delimiter for a template variable parameter.
DefaultParamValueSeparatorvariableDefault separator for a template variable parameter and its value.
DefaultStartDelimitervariableDefault start delimiter for a template variable.
MaxParseDepthvariableMaximum recursion depth for parsing.

Topics

Basic Template UsagetopicBasic usage of the template parser
Parametrized Template UsagetopicUsing templates with parameters

Uses

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.