Skip to content

Releases: edgurgel/solid

Solid 1.0.0

16 Jun 09:17
Compare
Choose a tag to compare

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} unless strict_variables or strict_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

08 Apr 08:07
Compare
Choose a tag to compare
Solid 1.0.0-rc.0 Pre-release
Pre-release

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} unless strict_variables or strict_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

03 Mar 08:02
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.17.2...v0.18.0

Solid v0.17.2

28 Jan 07:20
Compare
Choose a tag to compare

What's Changed

  • Add support for key-value pair access after map iteration by @dssecret in #149

New Contributors

Full Changelog: v0.17.1...v0.17.2

Solid v0.17.1

07 Jan 09:01
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.17.0...v0.17.1

Solid 0.17.0

19 Dec 04:01
Compare
Choose a tag to compare

What's Changed

  • Use a variable to access a hash by @jmks in #143

Full Changelog: v0.16.0...v0.17.0

Solid 0.16.0

19 Nov 21:15
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.15.2...v0.16.0

Solid 0.15.2

14 Nov 19:56
Compare
Choose a tag to compare

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

07 Nov 07:57
Compare
Choose a tag to compare

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

Full Changelog: v0.15.0...v0.15.1

Solid 0.15.0

06 Sep 07:23
Compare
Choose a tag to compare

What's Changed

  • Add caching option and matchers by @esse in #127

New Contributors

  • @esse made their first contribution in #127

Full Changelog: v0.14.1...v0.15.0