Skip to content

Commit

Permalink
templates.md docs: Document string literal format
Browse files Browse the repository at this point in the history
We are a little weird about which string escapes we support, and we don't
support raw strings.  I thought this might be worth documenting.

Inspired by #2251
  • Loading branch information
ilyagr committed Sep 14, 2023
1 parent 2177dc0 commit a6c7749
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ defined.
* `.remove_suffix(needle: Template) -> String`: Removes the passed suffix, if present
* `.substr(start: Integer, end: Integer) -> String`: Extract substring. Negative values count from the end.

#### String literals

String literals must be surrounded by double quotes (`"`). The following escape
sequences starting with a backslash have their usual meaning: `\"`, `\\`, `\n`,
`\r`, `\t`, `\0`. Other escape sequences are not supported. Any UTF-8 characters
are allowed inside a string literal, with two exceptions: unescaped `"`-s and
uses of `\` that don't form a valid escape sequence.


### Template type

Most types can be implicitly converted to `Template`. No methods are defined.
Expand Down

0 comments on commit a6c7749

Please sign in to comment.