Skip to content

Commit

Permalink
prepare for callable data-attributes, for bluedynamics/yafowil.plone#26
Browse files Browse the repository at this point in the history
  • Loading branch information
2silver committed Jun 22, 2019
1 parent be053aa commit 338a4da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ History
1.4 (unreleased)
----------------

- No changes yet.
- Parse values of attributes (data-Attributes) if type() is dict.
HTML5 Data-Attributes with i18n or callables are possible now
[2silver, 2019-06-12]


1.3 (2018-07-16)
Expand Down
10 changes: 9 additions & 1 deletion src/yafowil/yaml/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ def create_tree(self, data):
def call_factory(defs):
props = dict()
for k, v in defs.get('props', dict()).items():
props[k] = self.parse_definition_value(v)
if isinstance(v, dict):
dict_attrs = list()
for vk, vv in v.items():
val = self.parse_definition_value(vv)
part = [vk, val]
dict_attrs.append(part)
props[k] = dict_attrs
else:
props[k] = self.parse_definition_value(v)
custom = dict()
for custom_key, custom_value in defs.get('custom', dict()).items():
custom_props = list()
Expand Down

0 comments on commit 338a4da

Please sign in to comment.