View Source Extractly.Toc.Renderer.AstRenderer (Extractly v0.5.4)
Summary
Functions
A structural nested array (extracted from the PushList
)
iex(2)> render_ast([{1, "I"}, {3, "I - (i)"}, {1, "II"}, {2, "II 1"}])
["I", [["I - (i)"]], "II", ["II 1"]]
Transform a normalized tuple list (that is a list of tuples of the form {n, text}) in which there exists an entry of the form {m, text} for all m betwenn min(n) and max(n)
Functions
A structural nested array (extracted from the PushList
)
iex(2)> render_ast([{1, "I"}, {3, "I - (i)"}, {1, "II"}, {2, "II 1"}])
["I", [["I - (i)"]], "II", ["II 1"]]
Transform a normalized tuple list (that is a list of tuples of the form {n, text}) in which there exists an entry of the form {m, text} for all m betwenn min(n) and max(n)
Two formats are supported
The simple PushList
where the tuple list is transformed into a linear structural
representation of the different levels by representing opening and closing brackets by
the symbols :open
and :close
iex(1)> render_push_list([{1, "I"}, {3, "I - (i)"}, {1, "II"}, {2, "II 1"}])
["I", :open, :open, "I - (i)", :close, :close, "II", :open, "II 1", :close]
This format is ideal to be transformed into, e.g. an HTML representation