const classafSlim::Slim
sys::Obj afSlim::Slim
(Service) - Non-caching service methods for parsing and compiling Slim templates efan templates, and for rendering HTML.
For further information on the ctx
parameter, see efan: Template Context
Note: This class is available as a service in IoC v3 under the root
scope with an ID of afSlim::Slim
.
- compileFromFile
EfanMeta compileFromFile(File slimFile, Type? ctxType := null, Type[]? viewHelpers := null)
Compiles a renderer from the given slim file.
- compileFromStr
EfanMeta compileFromStr(Str slimTemplate, Type? ctxType := null, Type[]? viewHelpers := null, Uri? srcLocation := null)
Compiles a renderer from the given slim template.
srcLocation
may be anything - it is used for meta information only.- debugStr
Str debugStr()
- localeStr
static Str localeStr(Obj poddy, Str key, Locale? locale := null, Obj? arg1 := null, Obj? arg2 := null, Obj? arg3 := null, Obj? arg4 := null)
Returns a locale string for the given key and args. Translations are looked up in the given pod (may be a
Pod
,Str
,Type
, or instance).If
locale
is null, the thread's current Locale is used.Args may be interpolated with
${1}
. For more than 4 args, pass a list asarg1
. For named args, pass a Map asarg1
-${someKey}
- make
new make([Str:Obj]? opts := null)
Creates a
Slim
instance, setting the ending style for tags.Default opts:
name
default
desc
tagStyle
TagStyle.html
Describes how tags are ended.
components
SlimComponent[]
SlimComponents to use.
localeMethod
Slim#localeFn
The static method used to obtain L10N translations.
- parseFromFile
Str parseFromFile(File slimFile)
Parses the given slim file into an efan template.
- parseFromStr
Str parseFromStr(Str slimTemplate, Uri? srcLocation := null)
Parses the given slim template into an efan template.
srcLocation
may anything - used for meta information only.- renderFromFile
Str renderFromFile(File slimFile, Obj? ctx := null, Type[]? viewHelpers := null)
Renders the given slim template file into HTML.
- renderFromStr
Str renderFromStr(Str slimTemplate, Obj? ctx := null, Type[]? viewHelpers := null, Uri? srcLocation := null)
Renders the given slim template into HTML.
srcLocation
may anything - used for meta information only.- tagStyle
const TagStyle tagStyle
The void tag ending style for compiled templates
- toStr
virtual override Str toStr()