derkork / simplegen

A simple yet powerful general-purpose code generator
Other
9 stars 1 forks source link

Add a built-in filter for extracting the keys of a map #12

Open derkork opened 6 years ago

derkork commented 6 years ago

When you have a structure like this

foo:
   key1: value1
   key2: value2

there is currently no easy way of extracting the keys of this map structure (key1, key2) inside of a template. This seems to be however something that is frequently useful so there should be a built-in filter for this.

{% set keys = node.foo | keys %}