const classafEfan::EfanCompiler
sys::Obj afEfan::EfanCompiler
Compiles efan templates into EfanRenderers. Call render()
to render the efan template into a Str.
template := ... renderer := EfanCompiler().compile(`index.efan`, template) htmlStr := renderer.render(...)
- compile
EfanRenderer compile(Uri srcLocation, Str efanTemplate, Type? ctxType := null)
Standard compilation usage; compiles a new renderer from the given efanTemplate.
This method compiles a new Fantom Type so use judiciously to avoid memory leaks.
srcLocation
is only used for reporting Err msgs.- compileWithHelpers
EfanRenderer compileWithHelpers(Uri srcLocation, Str efanTemplate, Type? ctxType := null, Type[] viewHelpers := Type[])Type#.emptyList()
Intermediate compilation usage; the compiled renderer extends the given view helper mixins.
This method compiles a new Fantom Type so use judiciously to avoid memory leaks.
srcLocation
is only used for reporting Err msgs.- compileWithModel
EfanRenderer compileWithModel(Uri srcLocation, Str efanTemplate, Type? ctxType, PlasticClassModel model, |Type,EfanMetaData->EfanRenderer? makeFunc := null)
Advanced compiler usage; the efan render methods are added to the given afPlastic model.
The (optional)
makeFunc
is used to create anEfanRenderer
instance from the supplied Type and meta data.This method compiles a new Fantom Type so use judiciously to avoid memory leaks.
srcLocation
is only used for reporting Err msgs.- ctxVarName
const Str ctxVarName := "ctx"
The name given to the
ctx
variable in the render method.- make
new make(|This? in := null)
Create an
EfanCompiler
.- makeWithServices
new makeWithServices(PlasticCompiler plasticCompiler, |This? in := null)
For use by afIoc.
- plasticCompiler
const PlasticCompiler plasticCompiler
Expose
PlasticCompiler
so it (and it's mutable srcCodePadding value) may be re-used by other projects, such as afSlim.- rendererClassName
const Str rendererClassName := "EfanRendererImpl"
The class name given to compiled efan renderer instances.