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

Nested variable as argument to filter is reversed #9

Open
brendanhay opened this issue Nov 1, 2014 · 2 comments
Open

Nested variable as argument to filter is reversed #9

brendanhay opened this issue Nov 1, 2014 · 2 comments
Labels

Comments

@brendanhay
Copy link
Owner

Example:

{{ field.value.name | justifyRight(field.value.indent) }} :: {{ field.value.type }}

Error:

error: variable indent.value.field doesn't exist.
@brendanhay brendanhay added the bug label Nov 1, 2014
@mmhat
Copy link

mmhat commented Aug 21, 2018

Is that still an issue?
I cannot reproduce it...
JSON context used:

{"field": {"value": {"name": "FieldName", "indent": 20, "type": "FieldType"}}}

@mredaelli
Copy link

I also have a problem with variables in filter arguments, which seems different but perhaps is related.

Take this template, where match is a filter that matches the input to a regex and returns an object with a boolean field ok if the match worked, and a series of fields b0, b1, ... for each capturing group.
Also, ifelse is a function that returns the first argument if the input is true, the second otherwise:

{% let X = description | match(", (.+) ([0-9]+\\.[0-9]+) per CHF ([0-9]+\\.[0-9]+)") %}
{% let Y = { "ok": true, "g0": "ciao" } %}
  category                     {% if X.ok %} {{X.g0}} {% else %} {{currency}} {% endif %}
  {{ X | show }}
  {{ Y | show }}
{{ Y.ok | ifelse(Y.g0, 1) }}
{% endlet %}
{% endlet %}

Both show print an object with ok and g0, and everything works.
However, if I replace ifelse(X.g0, 1) for ifelse(Y.g0, 1) I get the error

variable X.g0 doesn't exist

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

3 participants