NIHVIVO-2479 Dump templates

This commit is contained in:
ryounes 2011-04-21 17:17:28 +00:00
parent 20e65852d5
commit 2f884cec25
5 changed files with 103 additions and 39 deletions

View file

@ -50,18 +50,16 @@ public class HelpDirective extends BaseDumpDirective {
TemplateHashModel dataModel = env.getDataModel();
Object templateModel = dataModel.get(varName);
if (templateModel == null) {
throw new TemplateModelException(
"Value of parameter '" + varName + "' must be the name of a directive or method");
}
if (! (templateModel instanceof TemplateMethodModel || templateModel instanceof TemplateDirectiveModel)) {
throw new TemplateModelException(
"Value of parameter '" + varName + "' must be the name of a directive or method");
}
Map<String, Object> map = getTemplateVariableDump(varName, env);
dump(TEMPLATE_DEFAULT, map, env);
String type = templateModel instanceof TemplateMethodModel ? "method" : "directive";
String title = "Help for " + type;
dump(map, env, title);
}
@Override