diff options
author | Loïc Hoguin <[email protected]> | 2018-06-12 18:30:45 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-06-12 18:35:54 +0200 |
commit | 3e29ee974ebbb8774ddf9ebba4582ff465e1a087 (patch) | |
tree | c712c000c71f4e6549642f4ad032f102fd116e21 /src/asciideck_to_html.erl | |
parent | 9224a497d79acbb8ce5690bf8dd9e19855e50586 (diff) | |
download | asciideck-3e29ee974ebbb8774ddf9ebba4582ff465e1a087.tar.gz asciideck-3e29ee974ebbb8774ddf9ebba4582ff465e1a087.tar.bz2 asciideck-3e29ee974ebbb8774ddf9ebba4582ff465e1a087.zip |
Parse table cols specs and add caption if any
Diffstat (limited to 'src/asciideck_to_html.erl')
-rw-r--r-- | src/asciideck_to_html.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/asciideck_to_html.erl b/src/asciideck_to_html.erl index ab0aa98..70c90c0 100644 --- a/src/asciideck_to_html.erl +++ b/src/asciideck_to_html.erl @@ -160,9 +160,14 @@ labeled_list_item({list_item, #{label := Label}, AST, _}) -> %% Tables. -table({table, _, [{row, _, Head, _}|Rows], _}) -> +table({table, Attrs, [{row, _, Head, _}|Rows], _}) -> [ - "<table rules=\"all\" width=\"100%\" frame=\"border\" cellspacing=\"0\" cellpadding=\"4\">\n" + "<table rules=\"all\" width=\"100%\" frame=\"border\" + cellspacing=\"0\" cellpadding=\"4\">\n", + case Attrs of + #{<<"title">> := Caption} -> ["<caption>", inline(Caption), "</caption>"]; + _ -> [] + end, "<thead><tr>", table_head(Head), "</tr></thead>" "<tbody>", table_body(Rows), "</tbody>" "</table>\n" |