Add more advice on escaping {{ to readme (#356)

This commit is contained in:
Casey Rodarmor 2018-09-18 20:53:10 -07:00 committed by GitHub
parent 3e181614d3
commit c39d88cc2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,11 +224,22 @@ publish:
rm -rf {{tarball}} {{tardir}}
```
To write a recipe containing `{{` or `}}`, use a string literal inside of `{{...}}`:
==== Escaping `{{`
To write a recipe containing `{{`, use `{{ "{{" }}`:
```make
braces:
echo 'I {{ "{{" }}LOVE{{ "}}" }} curly braces!'
echo 'I {{ "{{" }}LOVE}} curly braces!'
```
(An unmatched `}}` is ignored, so it doesn't need to be escaped.)
Another option is to put all the text you'd like to escape inside of an interpolation:
```make
braces:
echo '{{'I {{LOVE}} curly braces!'}}'
```
=== Strings