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 16, 2023
1 parent c5f74bc commit c45216e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ 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 c45216e

Please sign in to comment.