Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Jg_template2.Loaded
SourceA Loaded.t
stores a parsed template in memory so it can be evaluated multiple times against different models more efficiently.
from_file env template_filename
return result t.
env
is environment parameters defined in Jg_types.environment. environment parameters consist of template_dirs, autoescape_flag etc.
from_chan env chan
return result t.
same as from_file but read template from Stdlib.in_channel
.
from_string env source_string
return result t.
same as from_file but read template from source string.
eval context models t
evaluates the loaded template in the given context with the given models(defined by closure). return result string.
models
is getter function for some data-sources. For example, let models = fun key -> List.assoc key ("name", Tstr "taro"); ("age", Tint 20)
let models2 = function "name" -> Tstr "taro" | "age" -> Tint 20 | _ -> Tnull