-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Hi, Denis!
Given with data:
[Slot1]
[Main]
[Board properties]
serial = serial10
[Board11]
[Board properties]
serial = serial11
[Slot2]
[Main]
[Board properties]
serial = serial20
[Board21]
[Board properties]
serial = serial21
and this template:
<group name='{{ slot }}'>
[Slot{{ slot | prepend('Slot') }}]
<group name='boards'>
[{{ _line_ }}]
</group>
</group>
I get the results as expected, where each value in square brackets is matched for the nested group (a bit more processing required to filter 'Board properties' but it is omitted for simplicity):
[[{'Slot1': {'boards': [{'_line_': 'Main'},
{'_line_': 'Board properties'},
{'_line_': 'Board11'},
{'_line_': 'Board properties'}]},
'Slot2': {'boards': [{'_line_': 'Main'},
{'_line_': 'Board properties'},
{'_line_': 'Board21'},
{'_line_': 'Board properties'}]}}]]
But if I replace _line_ indicator with variable name I get nothing:
<group name='{{ slot }}'>
[Slot{{ slot | prepend('Slot') }}]
<group name='boards'>
[{{ var }}]
</group>
</group>
[[{}]]
More over, adding PHRASE filter works as expecting
<group name='{{ slot }}'>
[Slot{{ slot | prepend('Slot') }}]
<group name='boards'>
[{{ var | PHRASE }}]
</group>
</group>
[[{'Slot1': {'boards': [{'var': 'Board properties'},
{'var': 'Board properties'}]},
'Slot2': {'boards': [{'var': 'Board properties'},
{'var': 'Board properties'}]}}]]
But ORPHRASE filter (that is combination of either PHRASE or WORD) brings nothing again. It expects that result should include 'Board properties' and 'Main' at least.
<group name='{{ slot }}'>
[Slot{{ slot | prepend('Slot') }}]
<group name='boards'>
[{{ var | ORPHRASE }}]
</group>
</group>
[[{}]]
I investigated the docs from the left to the right and from the right to the left but still have no idea why ttp does so.
Environment:
Python 3.9.16
ttp 0.10.0
Metadata
Metadata
Assignees
Labels
No labels