use of org.wso2.siddhi.doc.gen.commons.metadata.NamespaceMetaData in project siddhi by wso2.
the class DocumentationUtils method updateHeadingsInMarkdownFile.
/**
* Update the documentation home page
*
* @param inputFile The path to the input file
* @param outputFile The path to the output file
* @param extensionRepositoryName The name of the extension repository
* @param latestDocumentationVersion The version of the latest documentation generated
* @param namespaceMetaDataList Metadata in this repository
* @throws MojoFailureException if the Mojo fails to find template file or create new documentation file
*/
public static void updateHeadingsInMarkdownFile(File inputFile, File outputFile, String extensionRepositoryName, String latestDocumentationVersion, List<NamespaceMetaData> namespaceMetaDataList) throws MojoFailureException {
// Retrieving the content of the README.md file
List<String> inputFileLines = new ArrayList<>();
try {
inputFileLines = Files.readLines(inputFile, Constants.DEFAULT_CHARSET);
} catch (IOException ignored) {
}
// Generating data model
Map<String, Object> rootDataModel = new HashMap<>();
rootDataModel.put("inputFileLines", inputFileLines);
rootDataModel.put("extensionRepositoryName", extensionRepositoryName);
rootDataModel.put("latestDocumentationVersion", latestDocumentationVersion);
rootDataModel.put("metaData", namespaceMetaDataList);
rootDataModel.put("formatDescription", new FormatDescriptionMethod());
generateFileFromTemplate(Constants.MARKDOWN_HEADINGS_UPDATE_TEMPLATE + Constants.MARKDOWN_FILE_EXTENSION + Constants.FREEMARKER_TEMPLATE_FILE_EXTENSION, rootDataModel, outputFile.getParent(), outputFile.getName());
}
Aggregations