diff --git a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java index 4cfbb378..3076e202 100644 --- a/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java +++ b/asciidoctor-parser-doxia-module/src/main/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessor.java @@ -97,7 +97,7 @@ private void processCaption(StructuralNode node, Sink sink) { // getCaption returns // - "" when '[caption=]' // - null when ':table-caption!: - sink.text(title); + sink.rawText(title); sink.tableCaption_(); } } diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java index 4ced15b8..bd75b9a6 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/ParagraphNodeProcessorTest.java @@ -1,5 +1,8 @@ package org.asciidoctor.maven.site.parser.processors; +import java.io.StringWriter; +import java.util.Collections; + import org.asciidoctor.Asciidoctor; import org.asciidoctor.Options; import org.asciidoctor.ast.StructuralNode; @@ -7,9 +10,7 @@ import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; -import java.io.StringWriter; -import java.util.Collections; - +import static org.asciidoctor.maven.site.parser.processors.test.Html.p; import static org.assertj.core.api.Assertions.assertThat; @NodeProcessorTest(ParagraphNodeProcessor.class) @@ -26,7 +27,7 @@ void should_convert_minimal_paragraph() { String html = process(content); assertThat(html) - .isEqualTo("
SomeText
"); + .isEqualTo(p("SomeText")); } @Test @@ -36,7 +37,7 @@ void should_convert_paragraph_with_bold_markup() { String html = process(content); assertThat(html) - .isEqualTo("Some text
"); + .isEqualTo(p("Some text")); } @Test @@ -46,7 +47,7 @@ void should_convert_paragraph_with_italics_markup() { String html = process(content); assertThat(html) - .isEqualTo("Some text
"); + .isEqualTo(p("Some text")); } @Test @@ -56,17 +57,17 @@ void should_convert_paragraph_with_monospace_markup() { String html = process(content); assertThat(html) - .isEqualTo("Some text
text
"));
}
@Test
void should_convert_paragraph_with_inline_image() {
- String content = documentWithParagraph("image:images/tiger.png[Kitty]");
+ String content = documentWithParagraph("An inline image image:images/tiger.png[Kitty] here!");
String html = process(content);
assertThat(html)
- .isEqualTo(""); + .isEqualTo(p("An inline image here!")); } private String documentWithParagraph(String text) { @@ -75,8 +76,8 @@ private String documentWithParagraph(String text) { private String process(String content) { StructuralNode node = asciidoctor.load(content, Options.builder().build()) - .findBy(Collections.singletonMap("context", ":paragraph")) - .get(0); + .findBy(Collections.singletonMap("context", ":paragraph")) + .get(0); nodeProcessor.process(node); diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java index 99712620..32eccd16 100644 --- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java +++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/PreambleNodeProcessorTest.java @@ -10,6 +10,7 @@ import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest; import org.junit.jupiter.api.Test; +import static org.asciidoctor.maven.site.parser.processors.test.Html.p; import static org.assertj.core.api.Assertions.assertThat; @NodeProcessorTest(PreambleNodeProcessor.class) @@ -26,9 +27,7 @@ void should_convert_preamble() { String html = process(content); assertThat(html) - .isEqualTo("
This is a preamble." + - System.lineSeparator() + - "With two lines.
"); + .isEqualTo(p("This is a preamble." + System.lineSeparator() + "With two lines.")); } @Test @@ -38,7 +37,29 @@ void should_convert_preamble_with_markup() { String html = process(content); assertThat(html) - .isEqualTo("This is a simple preamble
.
preamble
."));
+ }
+
+ @Test
+ void should_convert_preamble_with_link() {
+ final String link = "https://docs.asciidoctor.org/";
+ String content = documentWithPreamble("There's link " + link + " in the preamble.");
+
+ String html = process(content);
+
+ assertThat(html)
+ .isEqualTo(p("There’s link https://docs.asciidoctor.org/ in the preamble."));
+ }
+
+ @Test
+ void should_convert_preamble_with_inline_image() {
+ final String inlineImage = "image:images/tiger.png[Kitty]";
+ String content = documentWithPreamble("An inline image " + inlineImage + " here!");
+
+ String html = process(content);
+
+ assertThat(html)
+ .isEqualTo(p("An inline image here!"));
}
private String documentWithPreamble() {
diff --git a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java
index 662bd653..3e7b8666 100644
--- a/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java
+++ b/asciidoctor-parser-doxia-module/src/test/java/org/asciidoctor/maven/site/parser/processors/TableNodeProcessorTest.java
@@ -4,6 +4,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
import org.asciidoctor.Asciidoctor;
@@ -11,11 +12,15 @@
import org.asciidoctor.ast.StructuralNode;
import org.asciidoctor.maven.site.parser.NodeProcessor;
import org.asciidoctor.maven.site.parser.processors.test.NodeProcessorTest;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import static java.util.Collections.emptyList;
import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.CaptionOptions.*;
import static org.asciidoctor.maven.site.parser.processors.TableNodeProcessorTest.DocumentBuilder.documentWithTable;
+import static org.asciidoctor.maven.site.parser.processors.test.Html.Attributes.STYLE;
+import static org.asciidoctor.maven.site.parser.processors.test.Html.td;
+import static org.asciidoctor.maven.site.parser.processors.test.Html.tr;
import static org.asciidoctor.maven.site.parser.processors.test.StringTestUtils.removeLineBreaks;
import static org.assertj.core.api.Assertions.assertThat;
@@ -135,6 +140,65 @@ void should_convert_table_with_labels_disabled_globally() {
.isEqualTo(expectedTableWithoutLabel());
}
+ @Nested
+ class WhenCellContains {
+
+ @Test
+ void formatted_text() {
+ final String formattedContent = "This *is* _a_ simple `cell`";
+ String content = documentWithTable(false, noCaption, List.of(formattedContent, "Something else"));
+
+ String html = process(content);
+
+ assertThat(html)
+ .isEqualTo("