Skip to content

How can I keep {{ }} in stencil? #172

Answered by djbe
wulinman asked this question in Q&A
Discussion options

You must be logged in to vote

In Stencil, {{ stuff }} refers to a variable. In your case you're referring to the variable named (key).

Stencil is based on the templating language in Django, which has the same issue. Note that Stencil does not support every feature that Django supports.

Anyway, quick solution is {{ '{' }} to print a { character. Stencil even has a test for this "case": https://github.com/stencilproject/Stencil/blob/master/Tests/StencilTests/LexerSpec.swift#L129-L140

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by djbe
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
Converted from issue

This discussion was converted from issue #170 on August 26, 2023 01:19.