From f02f92613cc346c4c45dfcbffe15b01ae0084646 Mon Sep 17 00:00:00 2001 From: Antonio Gelameris Date: Sun, 30 May 2021 16:12:04 +0200 Subject: [PATCH] Documenting template comment syntax --- docs/03/00.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/03/00.md b/docs/03/00.md index 60dd7a73..5cd16302 100644 --- a/docs/03/00.md +++ b/docs/03/00.md @@ -94,7 +94,7 @@ Dollar signs can be escaped to avoid resolution: ``` val foo = "foo" val bar = "bar" -println(s"\\$foo\\$bar") +println(s"\\\$foo\\\$bar") ``` This would yield to: @@ -105,6 +105,31 @@ val bar = "bar" println(s"\$foo\$bar") ``` +### Template comments + +Sometimes it's useful to put a comment into a template that is intended for +template maintainers, and should not be included in the generated output. + +Wrapping comments between `\$!` and `!\$` won't make them appear in the output. + +``` +\$! This comment won't appear in the output !\$ +// This comment will appear in the output +\$! +This multiline comment won't appear either +No matter how +long it is + +Internal \$substitutions\$ are ignored. + +Even \$invalid\$ ones. + +!\$ +/* + * This comment is output and can contain \$substitutions\$ + */ +``` + ### Conditionals All fields have a property named `truthy` to be used in [conditional expressions][conditionals].