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

NoViableAlt thrown when assign tag has another tag name in it #14

Closed
nhoughto opened this issue Nov 8, 2015 · 2 comments
Closed

NoViableAlt thrown when assign tag has another tag name in it #14

nhoughto opened this issue Nov 8, 2015 · 2 comments
Assignees
Labels

Comments

@nhoughto
Copy link

nhoughto commented Nov 8, 2015

When an assign tag tries to assign a value from an object, but the name of the objects property matches the name of another liquid tag, a NoViableAltException is thrown.

Easy to replicate with the following AssignTag test case

    @Test
    public void assignTestWithOtherTagName() throws Exception {

        assertThat(
                Template.parse("var2:{{var2}} {%assign var2 = var.comment%} var2:{{var2}}")
                        .render(" { \"var\": { \"comment\": \"content\" } } "),
                is("var2:  var2:content"));

        assertThat(
                Template.parse("var2:{{var2}} {%assign var2 = var.end%} var2:{{var2}}")
                        .render(" { \"var\": { \"end\": \"content\" } } "),
                is("var2:  var2:content"));
    }

Presumably some form of escaping needs to happen to not treat that value as a tag? Or maybe its something else entirely?

@bkiers
Copy link
Owner

bkiers commented Nov 8, 2015

Thanks for the report and the test! I will have a look at this.

@bkiers bkiers self-assigned this Nov 8, 2015
@bkiers bkiers added the bug label Nov 8, 2015
@bkiers
Copy link
Owner

bkiers commented Nov 10, 2015

Fixed in d0fe566

@bkiers bkiers closed this as completed Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants