Interface ITemplateEngine
Engine which parses a template containing placeholders and replaces them with values from sources.
[WorkInProgressApi("namespace not final")]
public interface ITemplateEngine
Remarks
Released in 18.03
Methods
GetSources(NoParamOrder, int)
Get a list of underlying sources, mainly for debugging.
IEnumerable<ILookUp> GetSources(NoParamOrder npo = default, int depth = 0)
Parameters
npoNoParamOrderdepthint
Returns
Parse(string)
Basic Parse functionality. This is the variant without parameters, which should be used in basic cases and also for passing into function calls, like into CMS HTML Tweaks.
string Parse(string template)
Parameters
templatestringThe string containing the token placeholders like
Hello [User:FirstName]
Returns
Parse(string, NoParamOrder, bool, IEnumerable<ILookUp>?, int)
Basic Parse functionality with more options.
string Parse(string template, NoParamOrder npo = default, bool allowHtml = false, IEnumerable<ILookUp>? sources = null, int recursions = 0)
Parameters
templatestringThe string containing the token placeholders like
Hello [User:FirstName]npoNoParamOrderallowHtmlboolallow adding html to the string - if false (default) will html encode anything found for safety before replacing something
sourcesIEnumerable<ILookUp>A list of sources to use for this parse - otherwise use the sources provided on creation of the template engine
recursionsintRecursion depth for tokens-in-tokens. Could leak unexpected information, if a token contains user provided data or url-parameters so use with caution. Defaults to
0for safety, added v20.09