- refactored asciidoctor code (#2164)

- refreshed README.md
This commit is contained in:
Ante Pocedulic
2017-06-26 22:07:18 +02:00
committed by Grzegorz Piwowarek
parent d0c7340da8
commit 75e0473822
7 changed files with 60 additions and 37 deletions
-3
View File
@@ -1,3 +0,0 @@
== Introduction Section
Hi. I'm a simple test to see if this Maven build is working. If you see me in a nice PDF, then it means everything is [red]#working#.
@@ -1,33 +0,0 @@
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;
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);
}
String generateHTMLFromString(final String input) {
return asciidoctor.convert("Hello _Baeldung_!", new HashMap<String, Object>());
}
}
@@ -1,13 +0,0 @@
package com.baeldung.asciidoctor;
import org.junit.Assert;
import org.junit.Test;
public class AsciidoctorDemoTest {
@Test
public void givenString_whenConverting_thenResultingHTMLCode() {
final AsciidoctorDemo asciidoctorDemo = new AsciidoctorDemo();
Assert.assertEquals(asciidoctorDemo.generateHTMLFromString("Hello _Baeldung_!"), "<div class=\"paragraph\">\n<p>Hello <em>Baeldung</em>!</p>\n</div>");
}
}