Feature/assign dot notation - #114
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds Jekyll-compatible dot notation support for assign tags, allowing syntax like {% assign page.canonical_url = "/about/" %} when Jekyll extensions are enabled. This feature is hidden behind a configuration flag to maintain backward compatibility with standard Shopify Liquid.
Key changes:
- Added
JekyllExtensionsconfiguration option to control dot notation support - Modified assign tag parser to handle nested property paths
- Added
SetPathmethod to render context for setting nested object properties
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| engine.go | Added EnableJekyllExtensions() method to configure Jekyll compatibility |
| render/config.go | Added JekyllExtensions boolean field to Config struct |
| render/context.go | Implemented SetPath method for setting values at nested object paths |
| expressions/statements.go | Extended Assignment struct to support property paths alongside simple variables |
| expressions/expressions.y | Modified grammar to parse dot notation in assign targets |
| expressions/y.go | Generated parser code reflecting grammar changes |
| tags/standard_tags.go | Refactored assign tag to use configuration-aware factory function |
| tags/standard_tags_test.go | Added comprehensive tests for Jekyll extensions functionality |
| README.md | Added documentation for Jekyll compatibility features |
| Multiple test files | Updated function calls to match new AddStandardTags signature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
osteele
force-pushed
the
feature/assign-dot-notation
branch
from
August 30, 2025 04:05
c8db49d to
eceaefa
Compare
Implements #113 - Support assigning to object properties with dot notation Changes: - Updated Assignment struct to support property paths - Modified parser grammar to accept dot notation (e.g., page.canonical_url) - Added SetPath method to context for nested property setting - Updated assignTag to handle both simple and dotted assignments - Added comprehensive tests for the new functionality This allows templates to use: {% assign page.canonical_url = page.url %} {% assign obj.nested.property = value %} Maintains backward compatibility with simple assignments.
…s flag Fixes #113 with proper Shopify Liquid compatibility Changes: - Added JekyllExtensions flag to render.Config (default: false) - Added EnableJekyllExtensions() method to Engine API - Dot notation in assign tags now requires Jekyll extensions to be enabled - Standard mode (default) maintains strict Shopify Liquid compatibility - Jekyll mode enables extensions for Jekyll/Gojekyll compatibility Behavior: - Standard mode: {% assign obj.prop = value %} is a syntax error - Jekyll mode: {% assign obj.prop = value %} creates/updates nested properties - Simple assignments work in both modes: {% assign var = value %} This approach ensures backward compatibility while allowing Jekyll-specific features to be enabled when needed for Gojekyll and other Jekyll-compatible implementations.
osteele
force-pushed
the
feature/assign-dot-notation
branch
from
November 6, 2025 09:59
880c139 to
06417ca
Compare
This was referenced Nov 6, 2025
Closed
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
make testpasses.make lintpasses.Description
This PR adds support for Jekyll-compatible dot notation in the
{% assign %}tag, allowing nested property assignment like{% assign page.canonical_url = "/about/" %}. This feature is gated behind theJekyllExtensionsconfiguration flag to maintain backward compatibility.Changes
Core Implementation
obj.property = value)SetPath()method to the render context for setting nested valuesJekyllExtensionsflag is set to trueParser Changes
expressions.ygrammar to parse dot notation in assign targetsAssignmentstruct to include bothVariable(for simple assignments) andPath(for dot notation)Safety & Validation
Testing
Comprehensive test coverage has been added in
TestAssignTag_JekyllExtensions:new_obj.propwhennew_objdoesn't exist)Examples
With Jekyll extensions enabled:
{% assign page.canonical_url = "/about/" %} {% assign page.meta.description = "Test description" %} {% assign new_obj.nested.deep = "value" %}Without Jekyll extensions (standard mode):
{% assign simple_var = "value" %} // ✅ Works {% assign obj.prop = "value" %} // ❌ Error: requires Jekyll extensionsBreaking Changes
None - the feature is opt-in via the
JekyllExtensionsconfiguration flag.