Releases: edgurgel/solid
Releases · edgurgel/solid
Solid 1.0.0
What's changed
Parsing has been rewritten and there are a few breaking changes.
Check this PR for a bit more information.
Enhancements
- Error messages are now more detailed;
- Parsing can now fail with a list of errors instead of stopping on the first error;
liquid
and the inline comment tag are now supported;
Bug fixes
Too many to list here.
Breaking changes
- Parsing engine has been rewritten from scratch. Any custom tags will need to re-implemented using the
Solid.Parser
&Solid.Lexer
functions. See existing tags as example; Solid.parse/2
returns more meaningful errors and it tries to parse the whole file even when some errors are found. Example:
"""
{{ - }}
{% unknown %}
{% if true %}
{% endunless %}
{% echo 'yo' %}
"""
|> Solid.parse!()
** (Solid.TemplateError) Unexpected character '-'
1: {{ - }}
^
Unexpected tag 'unknown'
3: {% unknown %}
^
Expected one of 'elsif', 'else', 'endif' tags. Got: Unexpected tag 'endunless'
6: {% endunless %}
^
Unexpected tag 'endunless'
6: {% endunless %}
^
(solid 1.0.0-rc.0) lib/solid.ex:77: Solid.parse!/2
iex:2: (file)
Solid.render/3
now always return{:ok, result, errors}
unlessstrict_variables
orstrict_filters
are enabled and a filter or a variable was not found during rendering. See examples below:
"""
{{ 1 | base64_url_safe_decode }}
"""
|> Solid.parse!()
|> Solid.render(%{})
{:ok,
["Liquid error (line 1): invalid base64 provided to base64_url_safe_decode",
"\n"],
[
%Solid.ArgumentError{
message: "invalid base64 provided to base64_url_safe_decode",
loc: %Solid.Parser.Loc{line: 1, column: 8}
}
]}
"{{ missing_var }} 123"
|> Solid.parse!()
|> Solid.render(%{})
{:ok, ["", " 123"], []}
"{{ missing_var }}"
|> Solid.parse!()
|> Solid.render(%{}, strict_variables: true)
{:error,
[
%Solid.UndefinedVariableError{
variable: ["missing_var"],
loc: %Solid.Parser.Loc{line: 1, column: 4}
}
], [""]}
"{{ 1 | my_sum }}"
|> Solid.parse!()
|> Solid.render(%{})
{:ok, ["1"], []}
"{{ 1 | my_sum }}"
|> Solid.parse!()
|> Solid.render(%{}, strict_filters: true)
{:error,
[
%Solid.UndefinedFilterError{
filter: "my_sum",
loc: %Solid.Parser.Loc{line: 1, column: 8}
}
], ["1"]}
Solid.FileSystem.read_template_file/2
now must return a tuple with the file content or an error tuple.
Solid 1.0.0-rc.0
What's changed
Parsing has been rewritten and there are a few breaking changes.
Check this PR for a bit more information.
Enhancements
- Error messages are now more detailed;
- Parsing can now fail with a list of errors instead of stopping on the first error;
liquid
and the inline comment tag are now supported;
Bug fixes
Too many to list here.
Breaking changes
- Parsing engine has been rewritten from scratch. Any custom tags will need to re-implemented using the
Solid.Parser
&Solid.Lexer
functions. See existing tags as example; Solid.parse/2
returns more meaningful errors and it tries to parse the whole file even when some errors are found. Example:
"""
{{ - }}
{% unknown %}
{% if true %}
{% endunless %}
{% echo 'yo' %}
"""
|> Solid.parse!()
** (Solid.TemplateError) Unexpected character '-'
1: {{ - }}
^
Unexpected tag 'unknown'
3: {% unknown %}
^
Expected one of 'elsif', 'else', 'endif' tags. Got: Unexpected tag 'endunless'
6: {% endunless %}
^
Unexpected tag 'endunless'
6: {% endunless %}
^
(solid 1.0.0-rc.0) lib/solid.ex:77: Solid.parse!/2
iex:2: (file)
Solid.render/3
now always return{:ok, result, errors}
unlessstrict_variables
orstrict_filters
are enabled and a filter or a variable was not found during rendering. See examples below:
"""
{{ 1 | base64_url_safe_decode }}
"""
|> Solid.parse!()
|> Solid.render(%{})
{:ok,
["Liquid error (line 1): invalid base64 provided to base64_url_safe_decode",
"\n"],
[
%Solid.ArgumentError{
message: "invalid base64 provided to base64_url_safe_decode",
loc: %Solid.Parser.Loc{line: 1, column: 8}
}
]}
"{{ missing_var }} 123"
|> Solid.parse!()
|> Solid.render(%{})
{:ok, ["", " 123"], []}
"{{ missing_var }}"
|> Solid.parse!()
|> Solid.render(%{}, strict_variables: true)
{:error,
[
%Solid.UndefinedVariableError{
variable: ["missing_var"],
loc: %Solid.Parser.Loc{line: 1, column: 4}
}
], [""]}
"{{ 1 | my_sum }}"
|> Solid.parse!()
|> Solid.render(%{})
{:ok, ["1"], []}
"{{ 1 | my_sum }}"
|> Solid.parse!()
|> Solid.render(%{}, strict_filters: true)
{:error,
[
%Solid.UndefinedFilterError{
filter: "my_sum",
loc: %Solid.Parser.Loc{line: 1, column: 8}
}
], ["1"]}
Solid.FileSystem.read_template_file/2
now must return a tuple with the file content or an error tuple.
Solid v0.18.0
Solid v0.17.2
Solid v0.17.1
Solid 0.17.0
Solid 0.16.0
What's Changed
- chore: update docs around render/3 and README by @msutkowski in #134
- Update Elixir requirement to ~> 1.16 by @edgurgel in #139
- Echo tag, test cases restructure and custom matcher by @edgurgel in #141
New Contributors
- @msutkowski made their first contribution in #134
Full Changelog: v0.15.2...v0.16.0
Solid 0.15.2
What's Changed
- refactor: new approach for attempting to apply custom filters by @bceskavich in #132
Full Changelog: v0.15.1...v0.15.2
Solid 0.15.1
What's Changed
- fix: consistent support for integers in 'floor' + 'ceil' filter methods by @bceskavich in #130
- Update default filter to return fallback value for empty strings by @davidelias in #129
New Contributors
- @bceskavich made their first contribution in #130
- @davidelias made their first contribution in #129
Full Changelog: v0.15.0...v0.15.1