use of org.develnext.jphp.genapi.template.SphinxTemplate in project jphp by jphp-compiler.
the class DocGenerator method generate.
public void generate(File targetDirectory, String language) {
if (!targetDirectory.exists())
if (!targetDirectory.mkdirs())
throw new IllegalStateException("Cannot create target directory");
SphinxTemplate sphinxTemplate = new SphinxTemplate(language, languages.get(language));
List<ApiDocument> documents = new ArrayList<ApiDocument>();
for (File file : files) {
ApiDocument document = new ApiDocument(parseFile(file), sphinxTemplate);
documents.add(document);
}
Map<String, ClassDescription> classMap = new HashedMap<String, ClassDescription>();
for (ApiDocument document : documents) {
classMap.putAll(document.getClasses());
}
for (ClassDescription el : classMap.values()) {
if (el.getExtends() != null) {
ClassDescription parent = classMap.get(el.getExtends().toLowerCase());
if (parent != null) {
parent.addChildClass(el);
}
}
}
for (ApiDocument document : documents) {
document.generate(targetDirectory, language, classMap);
}
}
Aggregations