Escape Sequences

Mercurial’s templating engine recognizes the most commonly used escape sequences in strings. When it sees a backslash (\) character, it looks at the following character and substitutes the two characters with a single replacement, as described below:

  • \: Backslash, \, ASCII 134.

  • \n: Newline, ASCII 12.

  • \r: Carriage return, ASCII 15.

  • \t: Tab, ASCII 11.

  • \v: Vertical tab, ASCII 13.

  • \{: Open curly brace, {, ASCII 173.

  • \}: Close curly brace, }, ASCII 175.

As indicated above, if you want the expansion of a template to contain a literal \, {, or { character, you must escape it.

Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.