You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a .docx file, if a variable defined as {{ foo }} , the get_undeclared_template_variables method returns me foo which is what I expect. But if the variable is defined as {{ foo.bar }}, it still returns only foo. It does not recursively look for nested variables.
In the method implementation, I noticed that, first jinja AST is built and passed to find_undeclared_variables of the meta module of jinja2. I don't get it why the AST does not help us getting the nested variables.
Solution
I do not have any idea of how this can be solved. Therefore I'm opening this issue in a hope that someone from community will help me out.
The text was updated successfully, but these errors were encountered:
I think I have a (Maybe) Related Issue, although with a different Outcome.
If I have {{ foo }} in the template, then the get_undeclared_template_variables method returns nothing if foo is defined.
However, if I have {{ foo["Bar"] }} in the template, then the get_undeclared_template_variables method returns foo, even though foo["Bar"] is defined and the Template renders correctly (and replaces those Occurrences with the required Values).
Although maybe the Usual Python Dict way of accessing elements foor["Bar"] is NOT correct in Microsoft Word / Libreoffice (since both Single Quotes and Double Quotes are "weird", i.e. NOT the "normal" Single or Double quotes you would use in Python, BASH Scripts, etc).
Feature Details
In a
.docx
file, if a variable defined as{{ foo }}
, theget_undeclared_template_variables
method returns mefoo
which is what I expect. But if the variable is defined as{{ foo.bar }}
, it still returns onlyfoo
. It does not recursively look for nested variables.In the method implementation, I noticed that, first jinja AST is built and passed to
find_undeclared_variables
of themeta
module ofjinja2
. I don't get it why the AST does not help us getting the nested variables.Solution
I do not have any idea of how this can be solved. Therefore I'm opening this issue in a hope that someone from community will help me out.
The text was updated successfully, but these errors were encountered: