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

Source

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. srcLocation is only used for reporting Err msgs.

compileWithModel

Source

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) makeFunc is used to create an EfanRenderer 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

Source

const Str ctxVarName := "ctx"

The name given to the ctx variable in the render method.

make

Source

new make(|This? in := null)

Create an EfanCompiler.

makeWithServices

Source

new makeWithServices(PlasticCompiler plasticCompiler, |This? in := null)

For use by afIoc.

plasticCompiler

Source

const PlasticCompiler plasticCompiler

Expose PlasticCompiler so it (and it's mutable srcCodePadding value) may be re-used by other projects, such as afSlim.

rendererClassName

Source

const Str rendererClassName := "EfanRendererImpl"

The class name given to compiled efan renderer instances.