View Source Liquex.Parser.Object (liquex v0.13.0)

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

Link to this function

arguments(combinator \\ empty())

View Source
@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"
Link to this function

close_object_remove_whitespace(combinator \\ empty())

View Source
@spec close_object_remove_whitespace(NimbleParsec.t()) :: NimbleParsec.t()

Parses closing object tag with white space removing.

Examples

* "-}}  "
Link to this function

filter(combinator \\ empty())

View Source
@spec filter(NimbleParsec.t()) :: NimbleParsec.t()

Parses filter that starts with a pipe

Examples

* "| sort"
* "| at_most: 5"
Link to this function

keyword_field(combinator)

View Source

Parse keyword field

Examples

* "key: value"
Link to this function

keyword_fields(combinator \\ empty())

View Source
@spec keyword_fields(NimbleParsec.t()) :: NimbleParsec.t()
Link to this function

object(combinator \\ empty())

View Source
@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 -}}"