Cleans up a string to be used as URL or value for a HTML attribute. The returned string constists of the following characters: a-z
, 0-9
, -
and optional dots .
. This method is safe to be used with filenames as well, since it keeps dots as suffix separators by default.
@{ variable | sanitize (removeDots, maxChars) }
false
.100
.The following example will include the template name as value for the class
attribute for a template's <body>
element to serve as an additional selector in CSS:
<body class="@{ :template | sanitize }">
...
</body>