-
Notifications
You must be signed in to change notification settings - Fork 0
Syntax Reference
Jacob Jensen edited this page Oct 13, 2017
·
2 revisions
Here is a complete list of the current syntax as of 0.2.32
@{
// Any piece of D code will fit here
// You can declare functions, classes, variables etc.
}
@{
auto getFoo() {
return "bar";
}
}
@(Text or symbols to escape, this can even be D code or Diamond expressions)
@(<span>The tags are escaped</span>)
@$=variable_to_escape;
@$=(expression_to_escape);
@=escape(variable_to_escape);
@=escape(expression_to_escape);
@:auto foo = "<span>Bar</span>";
@$=foo;
@:auto foo = "<span>Bar</span>";
@=escape(foo);
@=variable_to_not_escape;
@=(expression_to_not_escape);
@:auto foo = "<span>Bar</span>";
@=foo;
@:linear_code
@:linear_code {
Html or Diamond expressions here
}
// Linear code will work with nested {}, [] or ()
@:foreach (person; persons) {
<span>Person: @=person.name;</span>
}
@* Comment here *
@*
Comment here
*
// Alternative using linear expressions
@:// Comment here
@*
Hello World!
*
@[
// Metadata here
]
@[
layout:
layout
]
@<placeholder_here>
@<title>