Skip to content

Strict Liquid Syntax (Part 2)  #432

@microalps

Description

@microalps

Issue 1: Capitalize supposed to lowercase all but first

As reported in #390 comment - Liquid uses the Ruby 'Capitalize' method. The Ruby documentation (https://apidock.com/ruby/String/capitalize) clearly states only the first character should be capitalized and all later are lowercased. (The Liquid documentation says later words are not affected, but it is wrong and being corrected in Shopify/liquid#1403)

Issue 2: Sort is case-insensitive

As reported in #393 - The expected behavior of the SortNatural filter is incorrectly assigned to Sort. Resolving this includes adding SortNatural and changing the behavior of the existing Sort to match reference library.

Issue 3: Whitespace handling

As reported in #411 - Liquid uses ruby native trim which removes ascii 9-13 (tab, line feed, form feed, vertical tab, carriage return) and space.

Issue 4: Unknown Filter Exception

As reported in #413 - Liquid has a 'strict syntax' parsing that throws exceptions on incorrectly named filters. This would be HUGELY helpful in DotLiquid because we also have case differences (if using C# naming syntax) that throws designers off.

Issue 5: Variable naming ignored invalid characters

Variable parsing used a regex that allows for $x to be understood as x ignoring the special character. The only exception was the underscore and hyphen. New behavior strictly checks for valid characters and throws an exception if unexpected characters are detected.

Issue 6: Non standard shorthand formats

Comment and literal tags had an undocumented short hand format that affected performance of all templates. This was partially implemented in the native Liquid before being taken out. A new spec is being considered for commented out code but is not finalized. See Shopify/liquid#1393

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions