Skip to content

Two consecutive (p ...) makes writing backward #99

@arouene

Description

@arouene

Hello,

I'm trying to write a Jinja template like this:

(if "{% if " (p "Prefix: " pre) (p "Var: " var) " is defined %}" n
    (s var) " = {{ " (s pre) (s var) " }}" n
    "{% endif %}")

This also don't work:

(if (p "Prefix: " pre t) "{% if " (s pre) (p var) " is defined %}" n
    (s var) " = {{ " (s pre) (s var) " }}" n
    "{% endif %}")

I want to generate something like this:

{% if prefix.var is defined %}
var = {{ prefix.var }}
{% endif %}

# or like this:

{% if prefix_var is defined %}
var = {{ prefix_var }}
{% endif %}

but I end up with:

{% if ra.xiferpvVar:  is defined %}
Var:  is = {{ ra.xiferpvVar:  is }}
{% endif %}

It seems like, when two (p) or (s) are consecutive without a string to separate them, the cursor always come back to the begin of the first field.

Thanks @minad for Tempel, it's simple and yet powerfull !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions