Skip to content

Commit

Permalink
Support all AST block types
Browse files Browse the repository at this point in the history
Signed-off-by: Jarno Elovirta <[email protected]>
  • Loading branch information
jelovirt committed Dec 25, 2023
1 parent 664140a commit 0263891
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/ast2markdown.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
<xsl:value-of select="."/>
</xsl:template>

<xsl:template match="table[*/tr/tablecell/para]" mode="ast" priority="10">
<xsl:template match="table[*/tr/tablecell/(para | plain | codeblock | rawblock | blockquote | orderedlist | bulletlist | definitionlist | header | table | div)]" mode="ast" priority="10">
<xsl:variable name="html" as="element()*">
<table>
<xsl:copy-of select="@*"/>
Expand Down
6 changes: 4 additions & 2 deletions src/test/resources/dita/table-block.dita
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@
</row>
<row class="- topic/row ">
<entry class="- topic/entry ">
<p class="- topic/p ">A4</p>
<codeblock class="+ topic/pre pr-d/codeblock ">A4</codeblock>
</entry>
<entry class="- topic/entry ">
<p class="- topic/p ">B4</p>
<ol class="- topic/ol ">
<li class="- topic/li ">B4</li>
</ol>
</entry>
</row>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/output/ast/table-block.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><pandoc><div><header id="tables" level="1">Table with block content</header><div><table><col/><col/><col/><thead><tr><tablecell>A</tablecell><tablecell>B</tablecell><tablecell>C</tablecell></tr></thead><tbody><tr><tablecell><para>A1 <strong>bold</strong></para> <para>A1</para></tablecell><tablecell><para>B1</para> <para><strong>bold</strong> B1</para></tablecell><tablecell><para><strong>C1</strong></para> <para>C1</para></tablecell></tr><tr><tablecell align="left"><para>A2 <strong>bold</strong></para></tablecell><tablecell align="center"><para>B2</para></tablecell><tablecell align="right"><para><strong>C2</strong></para></tablecell></tr><tr><tablecell colspan="2"><para>A3</para> <para>B3</para></tablecell><tablecell rowspan="2"><para>C3</para></tablecell></tr><tr><tablecell><para>A4</para></tablecell><tablecell><para>B4</para></tablecell></tr></tbody></table></div></div></pandoc>
<?xml version="1.0" encoding="UTF-8"?><pandoc><div><header id="tables" level="1">Table with block content</header><div><table><col/><col/><col/><thead><tr><tablecell>A</tablecell><tablecell>B</tablecell><tablecell>C</tablecell></tr></thead><tbody><tr><tablecell><para>A1 <strong>bold</strong></para> <para>A1</para></tablecell><tablecell><para>B1</para> <para><strong>bold</strong> B1</para></tablecell><tablecell><para><strong>C1</strong></para> <para>C1</para></tablecell></tr><tr><tablecell align="left"><para>A2 <strong>bold</strong></para></tablecell><tablecell align="center"><para>B2</para></tablecell><tablecell align="right"><para><strong>C2</strong></para></tablecell></tr><tr><tablecell colspan="2"><para>A3</para> <para>B3</para></tablecell><tablecell rowspan="2"><para>C3</para></tablecell></tr><tr><tablecell><codeblock xml:space="preserve">A4</codeblock></tablecell><tablecell><orderedlist><li><plain>B4</plain></li></orderedlist></tablecell></tr></tbody></table></div></div></pandoc>
4 changes: 3 additions & 1 deletion src/test/resources/output/markdown/table-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ C3

</td></tr><tr><td>

```
A4
```

</td><td>

B4
1. B4

</td></tr></tbody>
</table>

0 comments on commit 0263891

Please sign in to comment.