Lab42.Html v0.1.3 Lab42.Html View Source
Very simple generators for HTML Elements
Link to this section Summary
Functions
iex(0)> data = [
...(0)> ["header1", "header2"],
...(0)> ["cell1", "cell2"]]
...(0)> gen_table(data)
{:ok, "<table>\n<thead>\n<tr>\n<th>\nheader1\n</th>\n<th>\nheader2\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>\ncell1\n</td>\n<td>\ncell2\n</td>\n</tr>\n</tbody>\n</table>\n", []}
Headers can, but probably shall not, be avoided, also we expose Lab42.Html.Table.gen/2
as gen_table/2
Link to this section Functions
iex(0)> data = [
...(0)> ["header1", "header2"],
...(0)> ["cell1", "cell2"]]
...(0)> gen_table(data)
{:ok, "<table>\n<thead>\n<tr>\n<th>\nheader1\n</th>\n<th>\nheader2\n</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>\ncell1\n</td>\n<td>\ncell2\n</td>\n</tr>\n</tbody>\n</table>\n", []}
Headers can, but probably shall not, be avoided, also we expose Lab42.Html.Table.gen/2
as gen_table/2
iex(1)> data = [
...(1)> ~w(no_header no_header),
...(1)> ~w(cell21 cell22)]
...(1)> gen_table(data, false)
{:ok,
"<table>
",
[]}