Liquid template language parser engine in Swift.
Liquid is a template language that is used by several projects, such as Shopify and Jekyll (which powers GitHub pages). Liquid allows conditional injection of content into html pages through a simple and elegant syntax.
LiquidKit brings the power of Liquid to iOS and macOS. It is currently under development, so not all features are available.
This project is based on the liquid-swift project by yourtion, which provided a barebones implementation of the Lexer and the Parser. However, it was lacking any implementation of Tags, Filters, and everything else, which I have added. It has been renamed and re-hosted since I intend to maintain this project myself.
- Comment
- Raw
- Truthy and falsy
- Whitespace control
- Dot operator
dict.key[index] - Filters
- abs
- append
- at_least
- at_most
- capitalize
- ceil
- compact
- concat
- date
- default
- divided_by
- downcase
- escape
- escape_once
- first
- floor
- join
- last
- lstrip
- map
- minus
- modulo
- newline_to_br
- plus
- prepend
- remove
- remove_first
- replace
- replace_first
- reverse
- round
- rstrip
- size
- slice
- sort
- sort_natural
- split
- strip
- strip_html
- strip_newlines
- times
- truncate
- truncatewords
- uniq
- upcase
- url_decode
- url_encode
- Variable
-
assign -
capture -
increment -
decrement
-
- Operators
-
==equals -
!=does not equal -
>greater than -
<less than -
>=greater than or equal to -
<=less than or equal to -
orlogical or -
andlogical and -
containschecks substring inside a string
-
- Control flow
-
ifif a certain condition is true -
unlessif a certain condition is not met -
elsifmore conditions -
elseelse conditions -
case/whenswitch statement
-
- Iteration
-
for-
break -
continue -
limitlimits the loop (for parameters) -
offsetbegins the loop at the specified index (for parameters) -
rangedefines a range of numbers to loop through -
reversedreverses the order of the loop
-
-
cycle-
group
-
-
tablerow-
cols -
limitlimits the loop (for parameters) -
offsetbegins the loop at the specified index (for parameters) -
rangedefines a range of numbers to loop through
-
-
- Default Filter