aboutsummaryrefslogtreecommitdiff
path: root/test/lang.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-18 14:44:15 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-18 14:44:15 -0400
commitf4b04a1b8cd882e25fee592c819650c9b7e8566b (patch)
treedcecb8b4f83d569ebb00beb79988222d195b8f4c /test/lang.tm
parent04603308af3a2984d42eaa9e301cac0ffbded2a4 (diff)
Improved syntax for dollar-string literals
Diffstat (limited to 'test/lang.tm')
-rw-r--r--test/lang.tm14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/lang.tm b/test/lang.tm
index 01551e27..dfe1c663 100644
--- a/test/lang.tm
+++ b/test/lang.tm
@@ -1,5 +1,5 @@
lang HTML:
- HEADER := $HTML$"<!DOCTYPE HTML>"
+ HEADER := $HTML"<!DOCTYPE HTML>"
func escape(t:Text)->HTML:
t = t:replace("&", "&amp;")
t = t:replace("<", "&lt;")
@@ -9,25 +9,25 @@ lang HTML:
return HTML.from_unsafe_text(t)
func escape_int(i:Int)->HTML:
- return HTML.from_unsafe_text("{i}")
+ return HTML.from_unsafe_text("$i")
func paragraph(content:HTML)->HTML:
- return $HTML$"<p>$content</p>"
+ return $HTML"<p>$content</p>"
func main():
>> HTML.HEADER
= $HTML"<!DOCTYPE HTML>"
>> user := "I <3 hax"
- >> html := $HTML$"Hello $user!"
+ >> html := $HTML"Hello $user!"
= $HTML"Hello I &lt;3 hax!"
- >> html ++ $HTML$"<br>"
+ >> html ++ $HTML"<br>"
= $HTML"Hello I &lt;3 hax!<br>"
- >> $HTML{}"{1 + 2}"
+ >> $HTML"$(1 + 2)"
= $HTML"3"
- >> $HTML{}"{3_i8}"
+ >> $HTML"$(3_i8)"
= $HTML"3"
>> html:paragraph()