Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python ttp parser and empty results #86

Open
liposs opened this issue Sep 29, 2022 · 1 comment
Open

python ttp parser and empty results #86

liposs opened this issue Sep 29, 2022 · 1 comment

Comments

@liposs
Copy link

liposs commented Sep 29, 2022

Here's a sample of something that works well:

Template:

<input load="text">
vlan 1234 
 name some_vlan
vlan 5678
vlan 910 
 name one_more
vlan 777
</input>

<group name="vlans.{{ vlan }}">
vlan {{ vlan }} 
 name {{ name }}
</group>

Output (all empty data are listed):

[
    {
        "vlans": {
            "777": {},
            "910": {
                "name": "one_more"
            },
            "1234": {
                "name": "some_vlan"
            },
            "5678": {}
        }
    },
    {}
]

Here's similar example with data in a single line that doesn't work as the one above:

Template:

<input load="text">
vlan 1234 name some_vlan
vlan 5678
vlan 910 name one_more
vlan 777
</input>

<group name="vlans.{{ vlan }}">
vlan {{ vlan }} name {{ name }}
</group>

Output (all empty data are omitted):

[
    {
        "vlans": {
            "910": {
                "name": "one_more"
            },
            "1234": {
                "name": "some_vlan"
            }
        }
    },
    {}
]

Why in the second example the empty data are not showing? Is there any way to make it working the second example to get the output of the first one?

Is that a bug? Any suggestions?

@dmulyalin
Copy link
Owner

Try using:

<input load="text">
vlan 1234 name some_vlan
vlan 5678
vlan 910 name one_more
vlan 777
</input>

<group name="vlans.{{ vlan }}">
vlan {{ vlan | _start_ }}
vlan {{ vlan | _start_ }} name {{ name }}
</group>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants