/** * Gets the relative path inside the docs directory that this * documentation template file is in. * * @return The template path. */ default String getTemplatePath() { return getPath(); }
public static void generateDocumentation(DocumentationProvider provider) { File docFile = new File(getRootDirectory(), "source/" + provider.getPath() + ".rst"); docFile.getParentFile().mkdirs(); File template = new File(getRootDirectory(), "templates/" + provider.getTemplatePath() + ".rst"); if (!template.exists()) { CraftBookAPI.inst().getLogger().warn("Failed to find template for " + provider.getPath()); return; } String output = makeReplacements(loadFile(template), provider); try(PrintWriter writer = new PrintWriter(docFile)) { writer.write(output); } catch(IOException e) { CraftBookAPI.inst().getLogger().error("An IO Exception occured.", e); } }