Skip to content

Conversation

@windli2018
Copy link

Add a new configuration option preserveParentContext that allows partials to maintain the original parent context chain instead of creating a new PartialCtx wrapper.

When enabled:

  • {{> partial this}} uses current context directly without creating new PartialCtx
  • {{> partial ..}} navigates up parent chain to access parent context
  • {{> partial ../..}} navigates up multiple parent levels
  • {{../property}} in partial can access original parent properties

Default is false for backward compatibility.

Files modified:

  • Handlebars.java: Add preserveParentContext field, getter, setter, fluent API
  • Partial.java: Add conditional logic for context navigation
  • PartialContextModeTest.java: Add 20 comprehensive tests
  • README.md: Add documentation about the new feature

Test results: 999 tests run, 0 failures, 0 errors, 3 skipped

Add a new configuration option `preserveParentContext` that allows partials
to maintain the original parent context chain instead of creating a new
PartialCtx wrapper.

When enabled:
- {{> partial this}} uses current context directly without creating new PartialCtx
- {{> partial ..}} navigates up parent chain to access parent context
- {{> partial ../..}} navigates up multiple parent levels
- {{../property}} in partial can access original parent properties

Default is false for backward compatibility.

Files modified:
- Handlebars.java: Add preserveParentContext field, getter, setter, fluent API
- Partial.java: Add conditional logic for context navigation
- PartialContextModeTest.java: Add 20 comprehensive tests
- README.md: Add documentation about the new feature

Test results: 999 tests run, 0 failures, 0 errors, 3 skipped
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.

1 participant