Search in sources :

Example 26 with TemplateHashModel

use of freemarker.template.TemplateHashModel in project jbehave-core by jbehave.

the class TemplateableOutput method afterStory.

@Override
public void afterStory(boolean givenStory) {
    if (!givenStory) {
        Map<String, Object> model = newDataModel();
        model.put("story", outputStory);
        model.put("keywords", new OutputKeywords(keywords));
        TemplateHashModel enumModels = BeansWrapper.getDefaultInstance().getEnumModels();
        TemplateHashModel escapeEnums;
        try {
            String escapeModeEnum = EscapeMode.class.getCanonicalName();
            escapeEnums = (TemplateHashModel) enumModels.get(escapeModeEnum);
            model.put("EscapeMode", escapeEnums);
        } catch (TemplateModelException e) {
            throw new IllegalArgumentException(e);
        }
        write(file, templatePath, model);
    }
}
Also used : TemplateModelException(freemarker.template.TemplateModelException) TemplateHashModel(freemarker.template.TemplateHashModel)

Aggregations

TemplateHashModel (freemarker.template.TemplateHashModel)26 TemplateScalarModel (freemarker.template.TemplateScalarModel)9 TemplateMethodModelEx (freemarker.template.TemplateMethodModelEx)8 TemplateModelException (freemarker.template.TemplateModelException)8 Test (org.junit.Test)8 TemplateSequenceModel (freemarker.template.TemplateSequenceModel)7 TemplateModel (freemarker.template.TemplateModel)6 TemplateNumberModel (freemarker.template.TemplateNumberModel)4 TemplateException (freemarker.template.TemplateException)3 Version (freemarker.template.Version)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 BeansWrapper (freemarker.ext.beans.BeansWrapper)2 Configuration (freemarker.template.Configuration)2 SimpleScalar (freemarker.template.SimpleScalar)2 IOException (java.io.IOException)2 URL (java.net.URL)2 MultiTemplateLoader (freemarker.cache.MultiTemplateLoader)1 StringTemplateLoader (freemarker.cache.StringTemplateLoader)1 TemplateLoader (freemarker.cache.TemplateLoader)1