aboutsummaryrefslogtreecommitdiffstats
path: root/src/asciideck_to_html.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-06-12 18:30:45 +0200
committerLoïc Hoguin <[email protected]>2018-06-12 18:35:54 +0200
commit3e29ee974ebbb8774ddf9ebba4582ff465e1a087 (patch)
treec712c000c71f4e6549642f4ad032f102fd116e21 /src/asciideck_to_html.erl
parent9224a497d79acbb8ce5690bf8dd9e19855e50586 (diff)
downloadasciideck-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.erl9
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"