Skip to content

HectorCastelli/handlebars-js-issue-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handlebars-js-issue-sample

Related to this issue

Issue Description

I have found a case where the library behaves differently than handlebars.js:

Here is the setup:

Template

# {{data.name}}

{{#each data.related as |related|}}
{{#with (lookup ../other.contents @key) as | other_related |}}
## [{{other_related.name}}](/{{@key}})
{{related.relationship}}
{{/with}}
{{/each}}

Data

{
    "data": {
        "name": "John",
        "related": {
            "mary": {
                "relationship": "Siblings"
            }
        }
    },
    "other": {
        "contents": {
            "john": {
                "name": "John",
                "related": {
                    "mary": {
                        "relationship": "Siblings"
                    }
                }
            },
            "mary": {
                "name": "Mary"
            }
        }
    }
}

Expected output

# John

## [Mary](/mary)
Siblings

Actual output

# John

## [Mary](/)
Siblings

This is a link to the handlebars' playground showing what I am attempting to do: here.

This is a link to a repository that can be cloned to reproduce the issue: here.

Further notes

The main issue seems to be referencing @key inside a {{#with}} block.

Do you have any insights on why this is the case, if there is a setting I overlooked in the library, or if there are workarounds?

I am more than happy to help, albeit a little bad inexperienced with rust.

Thanks in advance!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages