private InputStream processSingleFile(File source, Asciidoctor asciidoctor, ExtensionGroup group, Preprocessor preprocessor, Options options) throws IOException { options.setBaseDir(source.getParentFile().getAbsolutePath()); try(FileInputStream fis= new FileInputStream(source)) { List<String> content = IOUtils.readLines(fis, getConfiguredCharset()); StringBuilder contentBuilder = new StringBuilder(); for (String contentline : content) { if (contentline.contains(INCLUDE) && shouldIncludeStatementRemain(contentline)) contentline = contentline.replace(INCLUDE, "include##"); contentBuilder.append(contentline); contentBuilder.append("\r\n"); } asciidoctor.convert(contentBuilder.toString(), options); group.unregister(); List<String> lines = preprocessor.getContentLines(); StringBuilder newContentBuilder = new StringBuilder(); for (String line : lines) { line = line.replace("include##", INCLUDE); newContentBuilder.append(line); newContentBuilder.append(System.lineSeparator()); } return IOUtils.toInputStream(newContentBuilder.toString(), getConfiguredCharset()); } }
private void generateDocumentation(DocumentAttributes documentAttributes, File adocFile, Asciidoctor asciidoctor) { OptionsBuilder ob; ob = OptionsBuilder.options().backend(documentAttributes.getBackend()); ob.safe(SafeMode.UNSAFE); if (allowUriRead) { Attributes attr = new Attributes(); attr.setAllowUriRead(true); ob.attributes(attr); } ExtensionGroup cukedoctorExtensionGroup = asciidoctor.createGroup(CUKEDOCTOR_EXTENSION_GROUP_NAME); if ("pdf".equals(documentAttributes.getBackend())) { cukedoctorExtensionGroup.unregister(); } asciidoctor.convertFile(adocFile, ob); //remove auxiliary files if ("pdf".equals(documentAttributes.getBackend())) { FileUtil.removeFile(adocFile.getParent() + "/" + outputFileName + "-theme.yml"); } getLog().info("Generated documentation at: " + adocFile.getParent()); }
ExtensionGroup cukedoctorExtensionGroup = asciidoctor.createGroup(CUKEDOCTOR_EXTENSION_GROUP_NAME); if (attrs.getBackend().equalsIgnoreCase("pdf")) { cukedoctorExtensionGroup.unregister();
extensionGroup.unregister();
extensionGroup.unregister(); String contentWithoutBlock = asciidoctor.convertFile( classpath.getResource("sample-with-yell-block.ad"),
extensionGroup.unregister(); String contentWithoutBlock = asciidoctor.convertFile( classpath.getResource("sample-with-yell-block.ad"),
extensionGroup.unregister();;
extensionGroup.unregister();