[Docs flaw] How to escape `@set` value?

According to my tests, you need to double every {. Doubling } also leads to incorrect results. Example: @set foo=a{{$bar}b. But is that all? Please document this (probably here), as I couldn't find anything about it.

There should be a way to escape %, because, if what's written between two instances of this character is the name of an environment variable, this text is replaced.

Yes, that's how to do it, not just with @set.

The parser fills in the placeholders and copies the rest verbatim. We can trick it like this:

@set myVar1=Hello %temp%
@set myVar2=Hello {="%" + "temp%"=}
@output:{$myVar1}
@output:{$myVar2}

1 Like

We'll make it so the parser accepts %% to escape a literal % in the next update.

3 Likes

For the record: This was taken back:

  • Reverted change in the previous beta to allow escaping of % characters in command lines. Potentially causes too many issues with existing commands.

So, this would make {="%"=} the best way to escape % now, it seems.

Please tell me if there's anything else than { and % that'd need to be escaped.