private Attributes getAttributes() { Attributes attributes = new Attributes(); attributes.setAttribute("projectdir", new File(".").getAbsolutePath()); return attributes; }
@Test public void snippetsAttributeFromDocumentPreambleIsNotOverridden() { Options options = new Options(); options.setAttributes(new Attributes("projectdir=../../..")); String converted = Asciidoctor.Factory.create() .convert(":snippets: custom\n{snippets}", options); assertThat(converted).contains("custom"); }
@Test public void snippetsAttributeIsSet() { Options options = new Options(); options.setAttributes(new Attributes("projectdir=../../..")); String converted = Asciidoctor.Factory.create().convert("{snippets}", options); assertThat(converted) .contains("build" + File.separatorChar + "generated-snippets"); }
@Test public void snippetsAttributeFromConvertArgumentIsNotOverridden() { Options options = new Options(); options.setAttributes(new Attributes("snippets=custom projectdir=../../..")); String converted = Asciidoctor.Factory.create().convert("{snippets}", options); assertThat(converted).contains("custom"); }
@PostConstruct private void init() { // Set the default attributes: attributes = new Attributes(); attributes.setSourceHighlighter("highlightjs"); // Set the default separator: separator = "/"; }
private Map<String, Object> parseCmdLineAttributes(List<String> attributeArgs) { return new Attributes(attributeArgs.toArray(new String[attributeArgs.size()])).map(); }
private Options getOptions() { Options options = new Options(); options.setCompact(true); options.setDocType("inline"); Attributes attributes = new Attributes(); attributes.setExperimental(true); attributes.setDataUri(true); options.setAttributes(attributes); return options; } }
private Options getOptions() { Options options = new Options(); options.setCompact(true); options.setDocType("inline"); Attributes attributes = new Attributes(); attributes.setExperimental(true); attributes.setDataUri(true); options.setAttributes(attributes); return options; } }
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()); }
private Options getOptions() { Options options = new Options(); options.setCompact(true); options.setDocType("inline"); Attributes attributes = new Attributes(); attributes.setExperimental(true); attributes.setDataUri(true); options.setAttributes(attributes); return options; } }
Attributes attr = new Attributes(); attr.setAllowUriRead(true); ob.attributes(attr);
private void createDocs() { String version = "2.0.0-SNAPSHOT"; Asciidoctor asciidoctor = create(); try { File file = new File("sqlg-doc/docs/" + version + "/sqlg.adoc"); File html = new File("sqlg-doc/docs/" + version + "/index.html"); Attributes attributes = new Attributes(); attributes.setBackend("html5"); attributes.setStyleSheetName("asciidoctor-default.css"); attributes.setDocType("book"); attributes.setSourceHighlighter("highlightjs"); Map<String, Object> options = OptionsBuilder.options() .attributes(attributes) .toFile(new File(html.getPath())) .headerFooter(true) .safe(SafeMode.SERVER) .asMap(); options.put("location", ":footer"); Docinfo docinfo = new Docinfo(options); asciidoctor.javaExtensionRegistry().docinfoProcessor(docinfo); asciidoctor.convertFile( file, options ); } catch (Exception e) { throw new RuntimeException(e); } }