in src/main/java/org/apache/struts/annotations/taglib/apt/TagAnnotationProcessor.java [240:275]
private void saveTemplates() {
// freemarker configuration
Configuration config = new Configuration(Configuration.VERSION_2_3_31);
config.setClassForTemplateLoading(getClass(), "");
config.setObjectWrapper(new DefaultObjectWrapper(Configuration.VERSION_2_3_31));
try {
// load template
Template tagDescription = config.getTemplate("tag-description.ftl");
Template tagAttributes = config.getTemplate("tag-attributes.ftl");
String outTemplatesDir = getOption("outTemplatesDir");
if (outTemplatesDir == null) {
throw new IllegalArgumentException("outTemplatesDir was not defined!");
}
String rootDir = (new File(outTemplatesDir)).getAbsolutePath();
for (Tag tag : tags.values()) {
if (tag.isInclude()) {
// model
HashMap<String, Tag> root = new HashMap<>();
root.put("tag", tag);
try (BufferedWriter writer = new BufferedWriter(new FileWriter(
new File(rootDir, tag.getName() + "-description.html")))) {
tagDescription.process(root, writer);
}
try (BufferedWriter writer = new BufferedWriter(new FileWriter(
new File(rootDir, tag.getName() + "-attributes.html")))) {
tagAttributes.process(root, writer);
}
}
}
} catch (Exception e) {
// oops we cannot throw checked exceptions
throw new RuntimeException(e);
}
}