This commit is contained in:
Jonathan Cook
2019-10-23 15:01:44 +02:00
parent db85c8f275
commit 684ec0d2e3
20486 changed files with 1642483 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
:icons: font
= Generating book with AsciiDoctorj
Baeldung
[abstract]
This is the actual content.
== First Section
This is first section of the book where you can include some nice icons like icon:comment[].
You can also create http://www.baeldung.com[links]
@@ -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;
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>());
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -0,0 +1,13 @@
package com.baeldung.asciidoctor;
import org.junit.Assert;
import org.junit.Test;
public class AsciidoctorDemoIntegrationTest {
@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>");
}
}
+29
View File
@@ -0,0 +1,29 @@
title_page:
align: left
page:
layout: portrait
margin: [0.75in, 1in, 0.75in, 1in]
size: A4
base:
font_color: #333333
line_height_length: 17
line_height: $base_line_height_length / $base_font_size
link:
font_color: #009900
header:
height: 0.5in
line_height: 1
recto_content:
center: '{document-title}'
verso_content:
center: '{document-title}'
footer:
height: 0.5in
line_height: 1
recto_content:
right: '{chapter-title} | *{page-number}*'
verso_content:
left: '*{page-number}* | {chapter-title}'