Signed-off-by: Noam Preil <noam@pixelhero.dev>
---
strings/template/README | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/strings/template/README b/strings/template/README
index 30d8d68f..98a95f45 100644
--- a/strings/template/README+++ b/strings/template/README
@@ -7,7 +7,7 @@ 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; such variables may include
-non-alphanumeric characters other than '_'.+non-alphanumeric characters other than '}'. const src = "Hello, $user! Your balance is $$$balance.\n";
const template = template::compile(src)!;
--
2.38.1
- Noam Preil
Signed-off-by: Noam Preil <noam@pixelhero.dev>
---
strings/template/README | 2 +-strings/template/template.ha | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/strings/template/README b/strings/template/README
index 98a95f45..d693d45b 100644
--- a/strings/template/README+++ b/strings/template/README
@@ -7,7 +7,7 @@ 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; such variables may include
-non-alphanumeric characters other than '}'.+non-alphanumeric characters other than '{' and '}'. const src = "Hello, $user! Your balance is $$$balance.\n";
const template = template::compile(src)!;
diff --git a/strings/template/template.ha b/strings/template/template.ha
index 2dd335e1..2ce586bc 100644
--- a/strings/template/template.ha+++ b/strings/template/template.ha
@@ -132,7 +132,9 @@ fn parse_variable(
};
if (brace) {
- if (rn != '}') {+ if (rn == '{') {+ return errors::invalid;+ } else if (rn != '}') { strio::appendrune(buf, rn)!;
} else {
break;
--
2.38.1
- Noam Preil