SimpleForm (SimpleForm v1.0.14)
View SourceSimpleForm
provides a simple representation and manipulation of structured elements,
similar to HTML or XML, using Elixir tuples and lists.
Overview
A SimpleForm.element()
is represented as:
{tag_name, attributes, content}
Where:
tag_name
is a string representing the name of the element.attributes
is a list of key-value tuples defining element attributes.content
is a list containing strings (text content) or nested elements.
Summary
Functions
Checks if value is an attribute.
Checks if value is content.
Checks if value is an element.
Types
Functions
Checks if value is an attribute.
Examples
iex> SimpleForm.attribute?(true)
false
iex> SimpleForm.attribute?({"p", [{"class", "intro"}], [{"strong", [], ["Hello"]}, " world!"]})
false
iex> SimpleForm.attribute?({"class", "strong"})
true
iex> SimpleForm.attribute?("Hello World!")
false
Checks if value is content.
Examples
iex> SimpleForm.content?(true)
false
iex> SimpleForm.content?({"p", [{"class", "intro"}], [{"strong", [], ["Hello"]}, " world!"]})
true
iex> SimpleForm.content?({"class", "strong"})
false
iex> SimpleForm.content?("Hello World!")
true
Checks if value is an element.
Examples
iex> SimpleForm.element?(true)
false
iex> SimpleForm.element?({"p", [{"class", "intro"}], [{"strong", [], ["Hello"]}, " world!"]})
true
iex> SimpleForm.element?({"class", "strong"})
false
iex> SimpleForm.element?("Hello World!")
false