Loading README.rst +2 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ The following Jinja filters were added: - :code:`from_json`: Convert from json. - :code:`pprint`: Pretty print variable. - :code:`combine`: Combine 2 dictionaries. - :code:`to_toml`: Convert to toml. - :code:`from_toml`: Convert from toml. - :code:`jmespath`: Queries data using the `JMESPath <http://jmespath.org/>`_ query language. Loading Loading @@ -87,4 +89,3 @@ TODO - Release on tagged commits to PyPI in Travis CI (https://docs.travis-ci.com/user/deployment/pypi/ and https://docs.travis-ci.com/user/encryption-keys/). - Add TOML support? setup.py +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ setup( ], keywords='config configuration jinja template environment', packages=find_packages(), install_requires=['Jinja2', 'PyYAML', 'jmespath'], install_requires=['Jinja2', 'PyYAML', 'jmespath', 'toml'], extras_require={ 'dev': ['tox'], }, entry_points={ Loading template/filters.py +23 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,29 @@ def combine(default, override): return combined def from_toml(value): ''' Returns a data structure from the TOML string given. Examples: >>> from_toml('[table]\\nkey = "value"\\n') == {'table': {'key': 'value'}} True ''' from toml import loads return loads(value) def to_toml(value): ''' Returns a string of the TOML representation for the data structure given. Examples: >>> import six >>> to_toml({'key': [1, 2]}) == six.text_type("key = [ 1, 2,]\\n") True ''' from toml import dumps return dumps(value) def jmespath(value, query): ''' Queries the data using the JMESPath query language. Loading Loading
README.rst +2 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ The following Jinja filters were added: - :code:`from_json`: Convert from json. - :code:`pprint`: Pretty print variable. - :code:`combine`: Combine 2 dictionaries. - :code:`to_toml`: Convert to toml. - :code:`from_toml`: Convert from toml. - :code:`jmespath`: Queries data using the `JMESPath <http://jmespath.org/>`_ query language. Loading Loading @@ -87,4 +89,3 @@ TODO - Release on tagged commits to PyPI in Travis CI (https://docs.travis-ci.com/user/deployment/pypi/ and https://docs.travis-ci.com/user/encryption-keys/). - Add TOML support?
setup.py +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ setup( ], keywords='config configuration jinja template environment', packages=find_packages(), install_requires=['Jinja2', 'PyYAML', 'jmespath'], install_requires=['Jinja2', 'PyYAML', 'jmespath', 'toml'], extras_require={ 'dev': ['tox'], }, entry_points={ Loading
template/filters.py +23 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,29 @@ def combine(default, override): return combined def from_toml(value): ''' Returns a data structure from the TOML string given. Examples: >>> from_toml('[table]\\nkey = "value"\\n') == {'table': {'key': 'value'}} True ''' from toml import loads return loads(value) def to_toml(value): ''' Returns a string of the TOML representation for the data structure given. Examples: >>> import six >>> to_toml({'key': [1, 2]}) == six.text_type("key = [ 1, 2,]\\n") True ''' from toml import dumps return dumps(value) def jmespath(value, query): ''' Queries the data using the JMESPath query language. Loading