Skip to content

My variables are not replaced in the output #843

Answered by taurr
taurr asked this question in Q&A
Discussion options

You must be logged in to vote

Reason

If the file in question is e.g. a Github Workflow yaml file, it may contain the Github variable syntax:

${{ github-variable }}

This conflicts with the Liquid syntax which is:

{{ liquid-variable }}

As Liquid can't tell the difference, it actually tries to substitude the Github variable. It fails and just leaves the syntax in the file. It actually fails handling the file entirely - it even fails at notifying cargo-generate that there were an issue.

Solution 1

One way to solve this issue, is to use the following Liquid syntax:

${{ "github-variable" | prepend: "{{" | append: "}}" }}

Solution 2

Another way is to use:

{% raw %}
${{ github-variable }}
{% endraw %}

Replies: 1 comment 1 reply

Comment options

taurr
Jan 7, 2023
Collaborator Author

You must be logged in to vote
1 reply
@AliSajid
Comment options

Answer selected by sassman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants