Exdot.Html (exdot v0.1.0) View Source

Convenience macros to create HTML string.

It takes attributes and body as input and returns HTML a map which represent the html. html_label/1 then converts it to correct string which can used as HTML like label

It is of the form:

html_tag attribute_list do
  body
end

Macros have more verbose name than the corresponding html tag to avoid unintentional name collision.

Example:

table bgcolor: "#D0E0D0", border: "0", cellborder: "1", cellspacing: "0" do
  table_row do
    table_data align: "LEFT" do
      "Foo"
    end
  end

  table_row do
    table_data align: "LEFT" do
      "Bar"
    end
  end
end

Produces

<TABLE BGCOLOR="#D0E0D0" BORDER="0" CELLBORDER="1" CELLSPACING="0" >
  <TR ><TD ALIGN="LEFT" >Foo</TD></TR>
  <TR ><TD ALIGN="LEFT" >Bar</TD></TR>
</TABLE>

See Exdot.ERD for example

Link to this section Summary

Functions

takes attributes and do-block and returns <b> HTML tag

takes attributes and do-block and returns <br> HTML tag

takes attributes and do-block and returns <font> HTML tag

takes attributes and do-block and returns <hr> HTML tag

Takes html map constructed using the macros and produces formatted string which can be used as html_label

takes attributes and do-block and returns <img> HTML tag

takes attributes and do-block and returns <i> HTML tag

takes attributes and do-block and returns <o> HTML tag

takes attributes and do-block and returns <s> HTML tag

takes attributes and do-block and returns <sub> HTML tag

takes attributes and do-block and returns <sup> HTML tag

takes attributes and do-block and returns <table> HTML tag

takes attributes and do-block and returns <td> HTML tag

takes attributes and do-block and returns <th> HTML tag

takes attributes and do-block and returns <tr> HTML tag

takes attributes and do-block and returns <u> HTML tag

takes attributes and do-block and returns <vr> HTML tag

Link to this section Types

Specs

html_tag() :: map()

Link to this section Functions

Link to this macro

bold(attrs \\ [], list)

View Source (macro)

Specs

bold(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <b> HTML tag

Link to this macro

break(attrs \\ [], list)

View Source (macro)

Specs

break(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <br> HTML tag

Link to this macro

font(attrs \\ [], list)

View Source (macro)

Specs

font(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <font> HTML tag

Link to this macro

horizontal_rule(attrs \\ [], list)

View Source (macro)

Specs

horizontal_rule(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <hr> HTML tag

Specs

html_label(html_tag()) :: String.t()

Takes html map constructed using the macros and produces formatted string which can be used as html_label

html_label(
  font "point-size": "16", face: "Helvetica" do
    "Foo "
  end
)

Produces

"<<FONT POINT-SIZE=\"16\" FACE=\"Helvetica\" >Foo</FONT>>"
Link to this macro

img(attrs \\ [], list)

View Source (macro)

Specs

img(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <img> HTML tag

Link to this macro

italic(attrs \\ [], list)

View Source (macro)

Specs

italic(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <i> HTML tag

Link to this macro

overline(attrs \\ [], list)

View Source (macro)

Specs

overline(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <o> HTML tag

Link to this macro

strike_through(attrs \\ [], list)

View Source (macro)

Specs

strike_through(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <s> HTML tag

Link to this macro

sub(attrs \\ [], list)

View Source (macro)

Specs

sub(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <sub> HTML tag

Link to this macro

sup(attrs \\ [], list)

View Source (macro)

Specs

sup(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <sup> HTML tag

Link to this macro

table(attrs \\ [], list)

View Source (macro)

Specs

table(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <table> HTML tag

Link to this macro

table_data(attrs \\ [], list)

View Source (macro)

Specs

table_data(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <td> HTML tag

Link to this macro

table_header(attrs \\ [], list)

View Source (macro)

Specs

table_header(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <th> HTML tag

Link to this macro

table_row(attrs \\ [], list)

View Source (macro)

Specs

table_row(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <tr> HTML tag

Link to this macro

underline(attrs \\ [], list)

View Source (macro)

Specs

underline(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <u> HTML tag

Link to this macro

vertical_rule(attrs \\ [], list)

View Source (macro)

Specs

vertical_rule(keyword(), term()) :: html_tag()

takes attributes and do-block and returns <vr> HTML tag