aboutsummaryrefslogtreecommitdiffstats
path: root/src/asciideck_to_html.erl
diff options
context:
space:
mode:
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"