http://asciidoctor.org/ ist laut Webseite “an open source Ruby processor for converting AsciiDoc markup into HTML 5, DocBook 4.5 and other formats”. Die Software ist in Ruby implementiert und so plattformunabhängig programmiert, dass auch eine Ausführung mit JRuby möglich ist. https://github.com/asciidoctor/asciidoctorj kapselt das in einem netten Projekt, sodass eine Konvertierung direkt mit einer Java-API möglich ist:
import static org.asciidoctor.Asciidoctor.Factory.create; import org.asciidoctor.Asciidoctor; ... Asciidoctor asciidoctor = create();...
String rendered = asciidoctor.render("*This* is it.", Collections.EMPTY_MAP); System.out.println(rendered);
...
String rendered = asciidoctor.renderFile(new File("target/test-classes/rendersample.asciidoc"), Collections.EMPTY_MAP);
System.out.println(rendered);
...
Mit Optionen:
Map<String, Object> attributes = new HashMap<>();
attributes.put("backend", "docbook");
Map<String, Object> options = new HashMap<>();
options.put("in_place", true);
options.put("attributes", attributes);
String render = asciidoctor.renderFile("target/test-classes/rendersample.asciidoc", options);

Nach mehr als zwei Jahren gibt es ein Update der Insel: