aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-06-27 11:45:19 +0200
committerLoïc Hoguin <[email protected]>2018-06-27 11:45:19 +0200
commite96b15d966af2ca8ff69b1d2ade162a225407f12 (patch)
tree3ca51c30b5ab9863fdf0f192bf0af65ceb5b42b8
parentf2779d1fd0f2bf62fb06d19d578c392c3f6845d5 (diff)
downloadasciideck-e96b15d966af2ca8ff69b1d2ade162a225407f12.tar.gz
asciideck-e96b15d966af2ca8ff69b1d2ade162a225407f12.tar.bz2
asciideck-e96b15d966af2ca8ff69b1d2ade162a225407f12.zip
Fix table and line breaks in man pages
-rw-r--r--src/asciideck_to_manpage.erl16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/asciideck_to_manpage.erl b/src/asciideck_to_manpage.erl
index 37e4e73..4c623be 100644
--- a/src/asciideck_to_manpage.erl
+++ b/src/asciideck_to_manpage.erl
@@ -82,8 +82,9 @@ ast_node(Node={Type, _, _, _}) ->
io:format("Ignored AST node ~p~n", [Node]),
[]
end
- catch _:_ ->
- io:format("Ignored AST node ~p~n", [Node]),
+ catch C:E ->
+ io:format("Ignored AST node ~p~nReason: ~p:~p~nStacktrace: ~p~n",
+ [Node, C, E, erlang:get_stacktrace()]),
[]
end.
@@ -169,7 +170,7 @@ table({table, _, Rows0, _}) ->
%% @todo Currently acts as if options="headers" was always set.
table_apply_options([{row, RAttrs, Headers0, RAnn}|Tail]) ->
- Headers = [{cell, CAttrs, [{strong, #{}, CText, CAnn}], CAnn}
+ Headers = [{cell, CAttrs#{style => <<"strong">>}, CText, CAnn}
|| {cell, CAttrs, CText, CAnn} <- Headers0],
[{row, RAttrs, Headers, RAnn}|Tail].
@@ -178,7 +179,10 @@ table_style(Rows) ->
|| {row, _, Cells, _} <- Rows].
table_style_cells(Cells) ->
- ["lt " || {cell, _, _, _} <- Cells].
+ [case CAttrs of
+ #{style := <<"strong">>} -> "ltb ";
+ _ -> "lt "
+ end || {cell, CAttrs, _, _} <- Cells].
table_contents(Rows) ->
[[table_contents_cells(Cells), "\n"]
@@ -188,7 +192,7 @@ table_contents_cells([FirstCell|Cells]) ->
[table_contents_cell(FirstCell),
[[":", table_contents_cell(Cell)] || Cell <- Cells]].
-table_contents_cell({cell, _, Text, _}) ->
+table_contents_cell({cell, _, [{paragraph, _, Text, _}], _}) ->
["T{\n", inline(Text), "\nT}"].
%% Comment lines are printed in the generated file
@@ -219,5 +223,7 @@ inline({inline_literal_passthrough, _, Text, _}) ->
%% Xref links appear as plain text in manuals.
inline({xref, _, Text, _}) ->
inline(Text);
+inline({line_break, _, _, _}) ->
+ "\n.br\n";
inline(Text) when is_list(Text) ->
[inline(T) || T <- Text].