Skip to content

Instantly share code, notes, and snippets.

@gastaldi
Created October 7, 2015 21:53
Show Gist options
  • Save gastaldi/a771c04df00917307de6 to your computer and use it in GitHub Desktop.
Save gastaldi/a771c04df00917307de6 to your computer and use it in GitHub Desktop.
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
import java.nio.file.Files;
import java.nio.file.Paths;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Options;
import org.asciidoctor.SafeMode;
import org.asciidoctor.internal.JRubyAsciidoctor;
/**
*
* @author <a href="mailto:[email protected]">George Gastaldi</a>
*/
public class RunAsciidoc
{
public static void main(String[] args) throws Exception
{
Asciidoctor adoc = JRubyAsciidoctor.create("gems/asciidoctor-0.1.4/lib");
adoc.extensionRegistry().includeProcessor(GridIncludeProcessor.class);
Options options = new Options();
options.setSafe(SafeMode.SAFE);
String content = new String(Files.readAllBytes(
Paths.get("/home/ggastald/workspace/docs/tutorials/forge-hol/docs/chapters/introduction.adoc")));
System.out.println(adoc.render(content, options));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment