diff --git a/src/main/resources/ast2markdown.xsl b/src/main/resources/ast2markdown.xsl index dcae2f7..5cebbd7 100644 --- a/src/main/resources/ast2markdown.xsl +++ b/src/main/resources/ast2markdown.xsl @@ -219,6 +219,105 @@ + + < + + + + + =" + + " + + > + + </ + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ +
+ diff --git a/src/main/resources/tables.xsl b/src/main/resources/tables.xsl index e1211d9..4bce9c9 100644 --- a/src/main/resources/tables.xsl +++ b/src/main/resources/tables.xsl @@ -120,6 +120,9 @@ + + + diff --git a/src/test/java/com/elovirta/dita/markdown/AstToMarkdownTest.java b/src/test/java/com/elovirta/dita/markdown/AstToMarkdownTest.java index d06de9d..cd1ba9e 100644 --- a/src/test/java/com/elovirta/dita/markdown/AstToMarkdownTest.java +++ b/src/test/java/com/elovirta/dita/markdown/AstToMarkdownTest.java @@ -1,9 +1,10 @@ package com.elovirta.dita.markdown; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import com.elovirta.dita.utils.ClasspathURIResolver; import java.io.*; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import javax.xml.transform.Transformer; @@ -55,6 +56,7 @@ public class AstToMarkdownTest { "reference", "short", "shortdesc", + "table-block", "table-width", "table", "task", @@ -71,7 +73,7 @@ public class AstToMarkdownTest { public void testAst(String name) throws Exception { final byte[] act = run("output/ast/" + name + ".xml"); final byte[] exp = read("output/markdown/" + name + ".md"); - assertArrayEquals(exp, act); + assertEquals(new String(exp, StandardCharsets.UTF_8), new String(act, StandardCharsets.UTF_8)); } private byte[] run(final String input) throws Exception { diff --git a/src/test/java/com/elovirta/dita/markdown/DitaToAstTest.java b/src/test/java/com/elovirta/dita/markdown/DitaToAstTest.java index 6196ec0..61619f5 100644 --- a/src/test/java/com/elovirta/dita/markdown/DitaToAstTest.java +++ b/src/test/java/com/elovirta/dita/markdown/DitaToAstTest.java @@ -77,6 +77,7 @@ public DitaToAstTest() { "reference", "short", "shortdesc", + "table-block", "table-width", "table", "task", diff --git a/src/test/resources/dita/table-block.dita b/src/test/resources/dita/table-block.dita new file mode 100644 index 0000000..75aa2b2 --- /dev/null +++ b/src/test/resources/dita/table-block.dita @@ -0,0 +1,70 @@ + + + Table with block content + + + + + + + + + A + B + C + + + + + +

A1 bold

+

A1

+
+ +

B1

+

bold B1

+
+ +

C1

+

C1

+
+
+ + +

A2 bold

+
+ +

B2

+
+ +

C2

+
+
+ + +

A3

+

B3

+
+ +

C3

+
+
+ + + A4 + + +
    +
  1. B4
  2. +
+
+
+ + +
+ +
diff --git a/src/test/resources/output/ast/ast.xml b/src/test/resources/output/ast/ast.xml index 02800e7..e9f4f4d 100644 --- a/src/test/resources/output/ast/ast.xml +++ b/src/test/resources/output/ast/ast.xml @@ -1,14 +1,14 @@ -
Test
Paragraph test and list list list list list list list list list list list list list - list list list list list list list list list list or code. This is a very long line. - This is a very long line. This is a very long line. This is a very long line. This is a very long line. This is - a very long line. This is a very long line. This is a very long line. This is a very long line. This is a very - long line. This is a very long line. + list list list list list list list list list list + or code. This is a very long line. This is a very long line. This is a very long line. This + is a very long line. This is a very long line. This is a very long line. This is a very long line. This is a + very long line. This is a very long line. This is a very long line. This is a very long line. + Paragraph with block content codeblock codeblock @@ -20,16 +20,20 @@ codeblock Asterisk \* bracket \[foo\]. - \\\`\*\_\{\}\[\]\(\)\>\#+-.!<> + \\\`\*\_\{\}\[\]\(\)\>\#+-.!<> Hyphen:
  • hyphen list list list list list list list list list list list list list list list list list list list - list list list list + list list list list +
  • - start with inline - elements + + start + with inline + elements + para
  • @@ -57,7 +61,8 @@ codeblock Asterix:
  • - inline bold normal + inline bold normal +
  • inline @@ -156,7 +161,8 @@ codeblock
    Example
    - Code example on for loop: + Code example on for loop: + for i in items: println(i) @@ -168,7 +174,8 @@ codeblock
    Images
    - An inline Alt. + An inline Alt. + Alt @@ -223,30 +230,30 @@ codeblock - Right - Left + Right + Left Default - Center + Center + 12 + 12 12 - 12 - 12 - 12 + 12 + 123 + 123 123 - 123 - 123 - 123 + 123 + 1 + 1 1 - 1 - 1 - 1 + 1 @@ -257,27 +264,29 @@ codeblock - First Header - Second Header Very long data entry Very long data entry Very long data entry Very long data - entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data - entry - Third Header + First Header + Second Header Very long data entry Very long data entry Very long data entry + Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry + Very long data entry + + Third Header - First row - Data - Very long data entry Very long data entry Very long data entry Very long data entry Very long - data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long - data entry + First row + Data + Very long data entry Very long data entry Very long data entry Very long data + entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data + entry Very long data entry + - Second row - + Second row + Cell - + Cell @@ -322,4 +331,4 @@ codeblock
    - + \ No newline at end of file diff --git a/src/test/resources/output/ast/table-block.xml b/src/test/resources/output/ast/table-block.xml new file mode 100644 index 0000000..8710bf4 --- /dev/null +++ b/src/test/resources/output/ast/table-block.xml @@ -0,0 +1 @@ +
    Table with block content
    ABCA1 bold A1B1 bold B1C1 C1A2 boldB2C2A3 B3C3A4
  • B4
  • \ No newline at end of file diff --git a/src/test/resources/output/ast/table.xml b/src/test/resources/output/ast/table.xml index eddbdee..2cce7ae 100644 --- a/src/test/resources/output/ast/table.xml +++ b/src/test/resources/output/ast/table.xml @@ -1 +1,159 @@ -
    Tables
    RightLeftDefaultCenter121212121231231231231111
    First HeaderSecond HeaderThird HeaderFirst rowDataVery long data entrySecond rowCellCell
    Table 1. simple_table
    PHP Table:First HeaderSecond Header Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entryThird HeaderFirst rowDataVery long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very long data entrySecond rowCellCell
    ABCA1B1C1A2B2A3A4C4
    ABCA5A6A7
    \ No newline at end of file + + +
    +
    Tables
    +
    + + + + + + + + Right + Left + Default + Center + + + + + 12 + 12 + 12 + 12 + + + 123 + 123 + 123 + 123 + + + 1 + 1 + 1 + 1 + + +
    + + + + + + + + First Header + Second Header + Third Header + + + + + First row + Data + Very long data entry + + + Second row + + Cell + + + Cell + + + +
    + Table 1. simple_table +
    + PHP Table: + + + + + + + First Header + Second Header Very long data entry Very long data entry Very long data entry Very + long data entry Very long data entry Very long data entry Very long data entry Very long data entry Very + long data entry + + Third Header + + + + + First row + Data + Very long data entry Very long data entry Very long data entry Very long data entry + Very long data entry Very long data entry Very long data entry Very long data entry Very long data entry + Very long data entry + + + + Second row + + Cell + + + Cell + + + +
    + + + + + + + A + B + C + + + + + A1 + B1 + C1 + + + A2 + B2 + + + A3 + + + A4 + C4 + + +
    + + + + + + + A + B + C + + + + + A5 + + + A6 + A7 + + +
    +
    +
    +
    \ No newline at end of file diff --git a/src/test/resources/output/markdown/table-block.md b/src/test/resources/output/markdown/table-block.md new file mode 100644 index 0000000..43f8e09 --- /dev/null +++ b/src/test/resources/output/markdown/table-block.md @@ -0,0 +1,66 @@ +# Table with block content {#tables} + + +
    + +A + + + +B + + + +C + +
    + +A1 **bold** + + A1 + + + +B1 + + **bold** B1 + + + +**C1** + + C1 + +
    + +A2 **bold** + + + +B2 + + + +**C2** + +
    + +A3 + + B3 + + + +C3 + +
    + +``` +A4 +``` + + + +1. B4 + +
    \ No newline at end of file