View Source Liquex.Parser.Object (liquex v0.13.1)
Helper methods for parsing object tags and arguments used by objects
Summary
Functions
Parse arguments. Arguments are key/value pairs, but a key may have multiple values separated by commas.
Parses closing object tag with white space removing.
Parses filter that starts with a pipe
Parse keyword field
Parses object. May contain arguments, literals, and filters.
Functions
@spec arguments(NimbleParsec.t()) :: NimbleParsec.t()
Parse arguments. Arguments are key/value pairs, but a key may have multiple values separated by commas.
Examples
* "img_url: '400x400', crop: 'bottom', filter: 'blur'"
* "img_size: 800, 600"
@spec close_object_remove_whitespace(NimbleParsec.t()) :: NimbleParsec.t()
Parses closing object tag with white space removing.
Examples
* "-}} "
@spec filter(NimbleParsec.t()) :: NimbleParsec.t()
Parses filter that starts with a pipe
Examples
* "| sort"
* "| at_most: 5"
Parse keyword field
Examples
* "key: value"
@spec keyword_fields(NimbleParsec.t()) :: NimbleParsec.t()
@spec object(NimbleParsec.t()) :: NimbleParsec.t()
Parses object. May contain arguments, literals, and filters.
It special cases space removing tags such as {{-
and -}}
to properly
remove any spaces leading and trailing spaces if requested.
Examples
* "{{ 'hello world' }}"
* "{{ 5 + 5 }}"
* "{{ variable_a | at_most: 5 }}"
* "{{- my_array | sort -}}"