diff options
author | Loïc Hoguin <[email protected]> | 2018-06-12 07:45:29 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-06-12 18:35:54 +0200 |
commit | 9224a497d79acbb8ce5690bf8dd9e19855e50586 (patch) | |
tree | e6a188f6e58aa421efc60bf73fda02d1cdbf0cce /src/asciideck_to_html.erl | |
parent | ff3a48cd25a671f456614e79f1c05d77f4ca08ff (diff) | |
download | asciideck-9224a497d79acbb8ce5690bf8dd9e19855e50586.tar.gz asciideck-9224a497d79acbb8ce5690bf8dd9e19855e50586.tar.bz2 asciideck-9224a497d79acbb8ce5690bf8dd9e19855e50586.zip |
Fix table cells containing blocks
Diffstat (limited to 'src/asciideck_to_html.erl')
-rw-r--r-- | src/asciideck_to_html.erl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/asciideck_to_html.erl b/src/asciideck_to_html.erl index 6f8a393..ab0aa98 100644 --- a/src/asciideck_to_html.erl +++ b/src/asciideck_to_html.erl @@ -169,16 +169,25 @@ table({table, _, [{row, _, Head, _}|Rows], _}) -> ]. table_head(Cells) -> - [["<th>", inline(Text), "</th>\n"] - || {cell, _, Text, _} <- Cells]. + [["<th>", table_cell(AST), "</th>\n"] + || {cell, _, AST, _} <- Cells]. table_body(Rows) -> [["<tr>", table_body_cells(Cells), "</tr>\n"] || {row, _, Cells, _} <- Rows]. table_body_cells(Cells) -> - [["<td>", inline(Text), "</td>\n"] - || {cell, _, Text, _} <- Cells]. + [["<td>", table_cell(AST), "</td>\n"] + || {cell, _, AST, _} <- Cells]. + +table_cell(AST0) -> + AST = [Node || Node={Type, _, _, _} <- AST0, Type =/= comment_line], + case AST of + [{paragraph, _, Text, _}] -> + inline(Text); + _ -> + ast(AST) + end. %% Block macros. |