diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-11-28 16:39:29 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-11-29 19:11:46 +0700 |
| commit | 57eac176cf5fb438bdb749913026da25642f1676 (patch) | |
| tree | 66b1a0fc0bcf65d13147b4903dbe2ad9e37b2b92 /testdata | |
| parent | ea961ec7d812554365ff418de9ee1e1cf75d9831 (diff) | |
| download | asciidoctor-go-57eac176cf5fb438bdb749913026da25642f1676.tar.xz | |
all: implement cell formatting
One of the most hardest task to finished after inline markup. It take
three refactoring until we get the current implementation.
To make the cell formatting works, we breaking down all table contents
into cells. When parsing a cells, we lookup the content before '|' and
after '\n'. If its a valid cell format, it will be set as cell format
for the next cell, otherwise it will considered as normal text.
Diffstat (limited to 'testdata')
| -rw-r--r-- | testdata/got.test.html | 73 | ||||
| -rw-r--r-- | testdata/test.adoc | 37 | ||||
| -rw-r--r-- | testdata/test.html | 64 |
3 files changed, 164 insertions, 10 deletions
diff --git a/testdata/got.test.html b/testdata/got.test.html index 0002074..d33cd86 100644 --- a/testdata/got.test.html +++ b/testdata/got.test.html @@ -77,6 +77,7 @@ <li><a href="#_table">19. Table</a> <ul class="sectlevel2"> <li><a href="#_column_formatting">19.1. Column Formatting</a></li> +<li><a href="#_cell_formatting">19.2. Cell formatting</a></li> </ul> </li> <li><a href="#_horizontal_rules">20. Horizontal rules</a></li> @@ -1323,8 +1324,9 @@ Hard drive </thead> <tbody> <tr> -<td class="tableblock halign-left valign-top"><p class="tableblock">C</p></td> -<td class="tableblock halign-left valign-top"><p class="tableblock">D</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C +D</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">E</p></td> </tr> </tbody> </table> @@ -1344,8 +1346,12 @@ Hard drive </thead> <tbody> <tr> -<td class="tableblock halign-left valign-top"><p class="tableblock">C</p></td> -<td class="tableblock halign-left valign-top"><p class="tableblock">D</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C + +D + +E</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">F</p></td> </tr> </tbody> </table> @@ -1449,7 +1455,7 @@ Hard drive </div></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><em>emphasis</em></p></td> <th class="tableblock halign-left valign-top"><p class="tableblock">header</p></th> -<td class="tableblock halign-left valign-top"><div class="literal"><pre>literal</pre></div></td> +<td class="tableblock halign-left valign-top"><div class="literal"><pre> literal </pre></div></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><code>mono</code></p></td> <td class="tableblock halign-left valign-top"><p class="tableblock">default</p></td> <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>strong</strong></p></td> @@ -1458,6 +1464,61 @@ Hard drive </tbody> </table> </div> +<div class="sect2"> +<h3 id="_cell_formatting"><a class="anchor" href="#_cell_formatting"></a><a class="link" href="#_cell_formatting">19.2. Cell formatting</a></h3> +<div class="paragraph"> +<p>Cell duplicated across three columns,</p> +</div> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 33.3333%;"> +<col style="width: 33.3333%;"> +<col style="width: 33.3333%;"> +</colgroup> +<tbody> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C1</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A2-B2-C2</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">A2-B2-C2</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">A2-B2-C2</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C3</p></td> +</tr> +</tbody> +</table> +<div class="paragraph"> +<p>Cell spanning three columns,</p> +</div> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 33.3333%;"> +<col style="width: 33.3333%;"> +<col style="width: 33.3333%;"> +</colgroup> +<tbody> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C1</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top" colspan="3"><p class="tableblock">A2…C2</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C3</p></td> +</tr> +</tbody> +</table> +</div> </div> </div> <div class="sect1"> @@ -2198,7 +2259,7 @@ this sidebar.</p> <div id="footer"> <div id="footer-text"> 1.1.1<br> -Last updated 2020-11-24 02:04:53 +0700 +Last updated 2020-11-29 17:22:38 +0700 </div> </div> </body> diff --git a/testdata/test.adoc b/testdata/test.adoc index c700e90..34cb642 100644 --- a/testdata/test.adoc +++ b/testdata/test.adoc @@ -542,7 +542,11 @@ With row columns less than header, | C -| D | E +D + +E + +| F | G |=== With row columns greater than header, @@ -588,6 +592,37 @@ With column styles, |Asciidoc | emphasis | header | literal | mono | default | strong | verse |=== +=== Cell formatting + +Cell duplicated across three columns, + +|=== + +|A1 |B1 |C1 + +3*|A2-B2-C2 + +|A3 +|B3 +|C3 + +|=== + + +Cell spanning three columns, + +|=== + +|A1 |B1 |C1 + +3+|A2...C2 + +|A3 +|B3 +|C3 + +|=== + == Horizontal rules diff --git a/testdata/test.html b/testdata/test.html index 4c2e3a6..36827d5 100644 --- a/testdata/test.html +++ b/testdata/test.html @@ -77,6 +77,7 @@ <li><a href="#_table">19. Table</a> <ul class="sectlevel2"> <li><a href="#_column_formatting">19.1. Column Formatting</a></li> +<li><a href="#_cell_formatting">19.2. Cell formatting</a></li> </ul> </li> <li><a href="#_horizontal_rules">20. Horizontal rules</a></li> @@ -1348,8 +1349,10 @@ D</p></td> </thead> <tbody> <tr> -<td class="tableblock halign-left valign-top"><p class="tableblock">C</p></td> -<td class="tableblock halign-left valign-top"><p class="tableblock">D</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C</p> +<p class="tableblock">D</p> +<p class="tableblock">E</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">F</p></td> </tr> </tbody> </table> @@ -1459,6 +1462,61 @@ D</p></td> </tbody> </table> </div> +<div class="sect2"> +<h3 id="_cell_formatting"><a class="anchor" href="#_cell_formatting"></a><a class="link" href="#_cell_formatting">19.2. Cell formatting</a></h3> +<div class="paragraph"> +<p>Cell duplicated across three columns,</p> +</div> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 33.3333%;"> +<col style="width: 33.3333%;"> +<col style="width: 33.3334%;"> +</colgroup> +<tbody> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C1</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A2-B2-C2</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">A2-B2-C2</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">A2-B2-C2</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C3</p></td> +</tr> +</tbody> +</table> +<div class="paragraph"> +<p>Cell spanning three columns,</p> +</div> +<table class="tableblock frame-all grid-all stretch"> +<colgroup> +<col style="width: 33.3333%;"> +<col style="width: 33.3333%;"> +<col style="width: 33.3334%;"> +</colgroup> +<tbody> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B1</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C1</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top" colspan="3"><p class="tableblock">A2…​C2</p></td> +</tr> +<tr> +<td class="tableblock halign-left valign-top"><p class="tableblock">A3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">B3</p></td> +<td class="tableblock halign-left valign-top"><p class="tableblock">C3</p></td> +</tr> +</tbody> +</table> +</div> </div> </div> <div class="sect1"> @@ -2196,7 +2254,7 @@ this sidebar.</p> <div id="footer"> <div id="footer-text"> 1.1.1<br> -Last updated 2020-11-24 02:04:52 +0700 +Last updated 2020-11-29 17:22:38 +0700 </div> </div> </body> |
