Splits Liquid <: Helpers out of the LiquidHTML ohm grammar
Adds a new ohm grammar, LiquidStatement <: Liquid, with slightly different rules:
space is /[ \t]/ instead of /[ \t\r\n]/
liquidTagRule is $name $tagMarkup(?=newline) instead of {%-? $name $tagMarkup -?%}
Means we now have 4 grammars:
Helpers
Liquid <: Helpers
LiquidStatement <: Liquid
LiquidHTML <: Liquid
Means we have a generic Liquid grammar we could use for non-HTML cases (!).
Adds support for the {% liquid %} tag
Decisions:
At most one empty line between statements
No leading empty lines
No trailing empty lines
Indent as you would
Print other tags as you would, but replace new lines with spaces
%} on a new line, like the other tags
Examples
It should parse tags properly and print them properly
printWidth: 1
{% liquid
assign x = thing.property | filter1 | fitler2
echo x | filter1 | filter2
capture var
if null
echo true
else
echo false
endif
endcapture
cycle 'one', 'two', 'three'
for x in col reversed limit: 10
echo x
else
echo 'nope'
endfor
form 'cart', cart
echo 'huh?'
endform
increment i
section 'string'
layout 'string'
paginate col by 10, window_size: 50
render 'icon' with x as bar, foo: bar
endpaginate
%}
In this PR
Helpers
out of theLiquidHTML
ohm grammarLiquid <: Helpers
out of theLiquidHTML
ohm grammarLiquidStatement <: Liquid
, with slightly different rules:space
is/[ \t]/
instead of/[ \t\r\n]/
liquidTagRule
is$name $tagMarkup(?=newline)
instead of{%-? $name $tagMarkup -?%}
Helpers
Liquid <: Helpers
LiquidStatement <: Liquid
LiquidHTML <: Liquid
{% liquid %}
tagDecisions:
%}
on a new line, like the other tagsExamples
Fixes #6