Introduction to Ascii doctor (#2069)
* - added classes for asciidoctor article - added tests for that article - added exclusion in pom.xml in libraries * - fixed test * - fixed formating in pom
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
7e315d8018
commit
ba4257d233
@@ -0,0 +1,33 @@
|
||||
package com.baeldung.asciidoctor;
|
||||
|
||||
import static org.asciidoctor.Asciidoctor.Factory.create;
|
||||
import static org.asciidoctor.OptionsBuilder.options;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.asciidoctor.Asciidoctor;
|
||||
|
||||
public class AsciidoctorDemo {
|
||||
|
||||
private final Asciidoctor asciidoctor;
|
||||
|
||||
public AsciidoctorDemo() {
|
||||
asciidoctor = create();
|
||||
}
|
||||
|
||||
public void generatePDFFromString(final String input) {
|
||||
|
||||
final Map<String, Object> options = options().inPlace(true)
|
||||
.backend("pdf")
|
||||
.asMap();
|
||||
|
||||
final String outfile = asciidoctor.convertFile(new File("sample.adoc"), options);
|
||||
}
|
||||
|
||||
public String generateHTMLFromString(final String input) {
|
||||
final String output = asciidoctor.convert("Hello _Baeldung_!", new HashMap<String, Object>());
|
||||
return output;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user