commit da003e45ced4991b1bae282169dcf942e1e4b235
parent 04b582a737335842925ae998fe3137110088552a
Author: Drew DeVault <sir@cmpwn.com>
Date: Sat, 26 Nov 2022 13:47:11 +0100
strings::template: improve README
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/strings/template/README b/strings/template/README
@@ -2,11 +2,12 @@ This module provides support for formatting of large or complex strings beyond
the scope of [[fmt]]. A template is compiled using [[compile]], then executed
with [[execute]] to print formatted text to an [[io::handle]].
-The template format is a string with variable substituted using "$". Variable
+The template format is a string with variables substituted using "$". Variable
names must be alphanumeric ASCII characters (i.e. for which [[ascii::isalnum]]
returns true). A literal "$" may be printed by using it twice: "$$". Variables
may also be used with braces, i.e. ${variable}, so that they can be placed
-immediately next to alphanumeric characters.
+immediately next to alphanumeric characters; such variables may include
+non-alphanumeric characters other than '_'.
const src = "Hello, $user! Your balance is $$$balance.\n";
const template = template::compile(src)!;