Skip to content

Conversation

@steve-ky
Copy link

Checklist

  • I have read the contribution guidelines.
  • make test passes.
  • make lint passes.
  • New and changed code is covered by tests.
  • Performance improvements include benchmarks.
  • Changes match the documented (not just the implemented) behavior of Shopify.

Support double quoted string unescape, single quoted string won't unescape.

@danog
Copy link
Collaborator

danog commented Oct 17, 2024

Mind rebasing pls?

@osteele osteele requested a review from Copilot May 21, 2025 06:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for string unescaping and updates several parts of the codebase to use the new any type in place of interface{} while also refining number operations and filter definitions.

  • Updated parser functions to accept a precompiled token matcher.
  • Modified tests and filters to use int64 and any for improved consistency.
  • Adjusted string unescaping logic to differentiate between single‐ and double‐quoted strings.

Reviewed Changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
parser/scanner.go Updated Scan signature to accept tokenMatcher, ensuring callers supply a precompiled regular expression.
parser/parser_test.go & parser/parser.go Updated Config instantiation to use NewConfig and pointer receivers for consistency.
parser/config.go Introduced private delims and tokenMatcher fields along with a new Delims method.
liquid_test.go, engine_test.go, engine_examples_test.go Replaced interface{} with any in test bindings to match new code conventions.
filters/standard_filters.go Converted numeric filters to handle int64 values and adjusted filter logic for arithmetic operations.
expressions/* Revised scanner and parser tests to expect int64 numeric values and improved string unescaping in double-quoted literals.
drops.go & drops_test.go Updated Drop interface method return types to use any instead of interface{}.

if ia == 0 {
return math.NaN()
}
return math.Inf(int(ia))
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using math.Inf(int(ia)) in the 'divided_by' filter introduces a mix of integer and floating-point return types. Consider standardizing the return type to float64 for division so that consumers consistently receive one numeric type.

Copilot uses AI. Check for mistakes.
// TODO unescape \x
out.val = string(lex.data[lex.ts+1:lex.te-1])
// unescape double quoted string
if lex.data[lex.ts] == '"' {
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Adding a comment here to clarify that only double-quoted strings are unescaped—while single-quoted strings are left intact—would improve code clarity for future maintainers.

Copilot uses AI. Check for mistakes.
osteele pushed a commit that referenced this pull request Nov 6, 2025
- Added Unreleased section to CHANGELOG.md with recent features:
  - Jekyll Extensions Support (PR #114)
  - Auto-Escape Feature (PR #111)
  - Modernized Build Tooling (PR #115)
- Added steve-ky as contributor for ideas/feedback on PR #89

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
osteele pushed a commit that referenced this pull request Nov 6, 2025
Updated CHANGELOG.md to include all merged PRs since version 1.3.0 (2020-02-13):

Added features:
- Jekyll Extensions Support (#114)
- Auto-Escape Feature (#111)
- Template Loader (#107)
- BasicEngine (#104)
- JSON Filter (#84)
- Strict Variables Mode (#74)
- Custom Writer Support (#86)
- Template AST Access (#59, #66)
- For-Else Support (#93)
- Unless-Else Support (#68)
- General Range Expressions (#65)
- Loop Modifier Expressions (#67)

Fixes:
- Size filter, slice bounds, division by zero
- Nil pointer handling
- Whitespace control
- Multiline slice
- Block errors
- Map filter with structs
- And more

Also added steve-ky as contributor for ideas/feedback on PR #89.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants