Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not appear to support mixed case template identifiers? #38

Closed
shadowmint opened this issue Dec 12, 2017 · 3 comments
Closed

Does not appear to support mixed case template identifiers? #38

shadowmint opened this issue Dec 12, 2017 · 3 comments

Comments

@shadowmint
Copy link

This template:

{{ blob.kkk }}
{{ blob.KKK }}
{{ tableName }}
{{ tablename }}

With this code:

var template = Template.Parse(input);
var rendered = template.Render(new
{
    blob = new
    {
        KKK = "123",
        kkk = "456",
    },
    tablename = "789",
    tableName = "000",
});

Renders:

123


789

Is this deliberate?

It appears that any identifiers with MixedCase are not rendered into templates?

I can't see anything specific about this in https://github.com/lunet-io/scriban/blob/master/doc/language.md, the closest I can see is:

A global/property variable like {{ name }} is a liquid like handle, starting by a letter or underscore _ and following by a letter A-Z a-z, a digit 0-9, an underscore _

Which seems to suggest this is a bug?

@shadowmint shadowmint changed the title Does not appear to support mixed case template values? Does not appear to support mixed case template identifiers? Dec 12, 2017
@xoofx
Copy link
Member

xoofx commented Dec 12, 2017

You are having the same issue than #33

So I need to fix the documentation, put some warnings around, because obviously, this is not enough.

xoofx added a commit that referenced this issue Dec 12, 2017
xoofx added a commit that referenced this issue Dec 12, 2017
@xoofx
Copy link
Member

xoofx commented Dec 12, 2017

I have updated the documentation, front readme, there are now more than 6 duplicated notices about this behavior.

@ghost
Copy link

ghost commented Sep 19, 2019

I just spent an hour on this problem because after looking at the very simple Hello, World use case I thought everything seemed pretty obvious. I skipped the next 2 examples because they were talking about liquid stuff that I didn't really care about. That's why I didn't even see the greyed out NOTICE at the bottom of the first section of the README...

However, before even trying Scriban, I did scan through the rest of the docs and somewhere I saw a warning about something about a ScriptObject and renaming, so I thought that didn't apply to me. Then I spent the hour banging my head against the wall because some of my tokens worked and others didn't... it was extremely frustrating and I thought that this library must be broken so I started looking for issues. Then I remembered that one warning and decided to comb through the docs again.

Moving on... now I'm just wondering - what is even the point of renaming members and why is that the default behavior? It's just an extremely counter-intuitive default to have in my opinion. Also, I'd like to see a feature to just disable it everywhere by default without having to modify every call to Render or wrap the library. Perhaps I'll submit an issue for that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants