ratchet v0.3.0 Ratchet.EEx

Generates EEx in compiled Ratchet templates

Summary

Functions

Build an EEx statement fetching attributes

Spit out an EEx ending

Build an EEx list comprehension from a scope and a property

Build an EEx statement fetching content

Functions

eex_attributes(property, attributes)

Build an EEx statement fetching attributes

iex> Ratchet.EEx.eex_attributes("lolwat", [])
"<%= Ratchet.Data.attributes(lolwat, []) %>"
eex_close()

Spit out an EEx ending

eex_comprehension_open(scope, property)

Build an EEx list comprehension from a scope and a property

iex> Ratchet.EEx.eex_comprehension_open("foo", "bar")
"<%= for bar <- Ratchet.Data.property(foo, :bar) |> Ratchet.Data.prepare do %>"
eex_content(property, default)

Build an EEx statement fetching content

iex> Ratchet.EEx.eex_content("lolwat", ["Content"])
[
  "<%= if Ratchet.Data.content?(lolwat) do %>",
  "<%= Ratchet.Data.content(lolwat) %>",
  "<% else %>",
  "Content",
  "<% end %>",
]