Closed iyaozhen closed 2 years ago
Try map1[var2]
.
Try ‘map1[var2]’, this should work.
Yao Zhen @.***> schrieb am Fr. 8. Juli 2022 um 14:26:
Demo
context := map[string]any{ "map1": map[string]string{"key1": "value1", "key2": "value2"}, "var2": "key1", }
{{map1.{{var2}}}} fail, error = [Error (where: parser) in | Line 1 Col 8 near '{{'] This token is not allowed within a variable name
{{map1.var2}} got = , want value1
— Reply to this email directly, view it on GitHub https://github.com/flosch/pongo2/issues/304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEWIDGHHPHNJDRRA5L2VDVTAM7LANCNFSM53A2SQHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Demo
{{map1.{{var2}}}}
fail, error = [Error (where: parser) in{{map1.var2}}
got = , want value1