const classafEfan::EfanCompiler
sys::Obj afEfan::EfanCompiler
Compiles efan templates into EfanRenderer classes. Call render() on the returned objects 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, Type[] viewHelpers := Type[])Type#.emptyList()Standard compilation usage; compiles and instantiates a new renderer from the given efanTemplate. The compiled renderer extends the given view helper mixins.
This method compiles a new Fantom Type so use judiciously to avoid memory leaks.
srcLocationis only used for reporting Err msgs.- compileWithModel
BaseEfanImpl compileWithModel(Uri srcLocation, Str efanTemplate, Type? ctxType, PlasticClassModel model, |Type,EfanMetaData->BaseEfanImpl? makeFunc := null)Advanced compiler usage; compiles and instantiates a new renderer from the given Plastic model.
The (optional)
makeFuncis used to create anEfanRendererinstance from the supplied Type and meta data.This method compiles a new Fantom Type so use judiciously to avoid memory leaks.
srcLocationis only used for reporting Err msgs.- ctxVarName
const Str ctxVarName := "ctx"The name given to the
ctxvariable 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 plasticCompilerExpose
PlasticCompilerso 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.