Idris2Doc : Text.Html.Attributes.Validation

Text.Html.Attributes.Validation

(source)
Collection of validation functions for HTML element attributes.

All these methodes return an `Either` data type.
If there are no errors, the provided input is returnd unchanged as `Right`
value.
If there is an error, an error message is returned as `Left` value.

Definitions

isMeta : Name -> Bool
  `True` if the provided attribute name is a meta attribute.

Totality: total
Visibility: public export
isAttrOf : Name -> List Attribute -> Bool
  `True` if the provided attribute name is found.

Totality: total
Visibility: public export
metaAttrs : List Attribute -> List Name
  Extract the list of meta attributes.

Totality: total
Visibility: public export
allowed : List Name -> List Attribute -> Either String (List Attribute)
  Ensures that the attributes are all among the provided allowed attributes.

An error message is returned if one or more of the attributes are not among
the list of allowed attributes.

Totality: total
Visibility: public export
allowedGlobal : List Name -> List Attribute -> Either String (List Attribute)
  Similar to `allowed` but also allow custom global attributes.

The additional allowed attributes are the ones starting with "aria-" or
"data-".

Totality: total
Visibility: public export
allowedIfPresent : Name -> Name -> List Attribute -> Either String (List Attribute)
  Ensures that an attribute is only used if another attribute is present.

Totality: total
Visibility: public export
lengthAmong : Nat -> List Name -> List Attribute -> Either String (List Attribute)
  Check for a minimal number of attributes present among the provided list.

An error message is returned if the number of such attributes is not at
least of the provided length.

Totality: total
Visibility: public export
nonEmpty : Attribute -> Either String Attribute
  Ensures that the attribute value is not empty.

An error message is returned if the attribute value is empty or only
composed of white spaces.

Totality: total
Visibility: public export
noOtherAttrs : List Name -> List Name -> List Attribute -> Either String (List Attribute)
  Ensures that there a no other attributes among the one provided.

An error is returned if all the `attrs` are present in `allAttrs` and
there is another attribute in `allAttrs` which is also present in `among`.

@attrs Attributes to check which are a subset of `among`.
@among Attributes against which are checked all attributes.
@allAttrs All the attributes.

Totality: total
Visibility: public export
required : Name -> List Attribute -> Either String (List Attribute)
  Returns either the attributes' list or an error message.

An error message is returned if the required attribute is not present in the
list.

Totality: total
Visibility: public export
requiredIfPresent : Name -> Name -> List Attribute -> Either String (List Attribute)
  Returns either the attributes' list or an error message.

An error message is returned if the provided attribute is present in the
list while the required attribute is missing.

Totality: total
Visibility: public export
unique : List Attribute -> Either String (List Attribute)
  Ensures that all attributes are unique.

An error message is returned if a duplicate attribute name is found.

Totality: total
Visibility: public export
globalAttributes : List Attribute -> Either String (List Attribute)
  Ensures that all the attributes are global attributes.

Totality: total
Visibility: public export
standard : List Attribute -> Either String (List Attribute)
  Global attributes and unique attributes validation.

This validation is the minimal one for any HTML element.

Totality: total
Visibility: public export
areaAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **area** element.

Totality: total
Visibility: public export
baseAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **base** element.

Totality: total
Visibility: public export
dataAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **data** element.

Totality: total
Visibility: public export
embedAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **embed** element.

Totality: total
Visibility: public export
imgAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **img** element.

There must be:

- an **alt** attribute;
- a **src** and/or **srcset**.

Totality: total
Visibility: public export
labelAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **label** element.

Totality: total
Visibility: public export
liAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **li** element.

Totality: total
Visibility: public export
htmlAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **html** element.

Totality: total
Visibility: public export
metaAttributes : List Attribute -> Either String (List Attribute)
  Ensures that the attributes of a **meta** element are correctly structured.
There must be:

- only global or meta attributes;
- at least one meta attribute;
- only the meta attribute **charset** as meta attribute if present;
- both and only meta attributes **name** and **content** if one of them is
present;

Totality: total
Visibility: public export
scriptAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **script** element.

Totality: total
Visibility: public export
sourceAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **source** element.

Totality: total
Visibility: public export
trackAttributes : List Attribute -> Either String (List Attribute)
  Attributes allowed in a **track** element.

Totality: total
Visibility: public export