Codebase list erlang-asciideck / e96b15d
Fix table and line breaks in man pages Loïc Hoguin 5 years ago
1 changed file(s) with 11 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
8181 io:format("Ignored AST node ~p~n", [Node]),
8282 []
8383 end
84 catch _:_ ->
85 io:format("Ignored AST node ~p~n", [Node]),
84 catch C:E ->
85 io:format("Ignored AST node ~p~nReason: ~p:~p~nStacktrace: ~p~n",
86 [Node, C, E, erlang:get_stacktrace()]),
8687 []
8788 end.
8889
168169
169170 %% @todo Currently acts as if options="headers" was always set.
170171 table_apply_options([{row, RAttrs, Headers0, RAnn}|Tail]) ->
171 Headers = [{cell, CAttrs, [{strong, #{}, CText, CAnn}], CAnn}
172 Headers = [{cell, CAttrs#{style => <<"strong">>}, CText, CAnn}
172173 || {cell, CAttrs, CText, CAnn} <- Headers0],
173174 [{row, RAttrs, Headers, RAnn}|Tail].
174175
177178 || {row, _, Cells, _} <- Rows].
178179
179180 table_style_cells(Cells) ->
180 ["lt " || {cell, _, _, _} <- Cells].
181 [case CAttrs of
182 #{style := <<"strong">>} -> "ltb ";
183 _ -> "lt "
184 end || {cell, CAttrs, _, _} <- Cells].
181185
182186 table_contents(Rows) ->
183187 [[table_contents_cells(Cells), "\n"]
187191 [table_contents_cell(FirstCell),
188192 [[":", table_contents_cell(Cell)] || Cell <- Cells]].
189193
190 table_contents_cell({cell, _, Text, _}) ->
194 table_contents_cell({cell, _, [{paragraph, _, Text, _}], _}) ->
191195 ["T{\n", inline(Text), "\nT}"].
192196
193197 %% Comment lines are printed in the generated file
218222 %% Xref links appear as plain text in manuals.
219223 inline({xref, _, Text, _}) ->
220224 inline(Text);
225 inline({line_break, _, _, _}) ->
226 "\n.br\n";
221227 inline(Text) when is_list(Text) ->
222228 [inline(T) || T <- Text].