NIHVIVO-2479 Dump templates
This commit is contained in:
parent
20e65852d5
commit
2f884cec25
5 changed files with 103 additions and 39 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue