Markup
Last updated
Last updated
Trillo's language is based on HTML, so it has to define how it handles its quirks and how it tries to make our life easier where possible.
Missing tags are automatically inserted and a well formed document is always generated.
Because the server loads pages in simulated DOM, it fills in the blanks like browsers do. The output markup will therefore include <!DOCTYPE html>
and the missing <head>
and <body>
tags.
Any tag can be self-closing, e.g. <br/>
and <div/>
are both valid and will generate <br>
and <div></div>
, respectively.
Basically this extends the common habit of adding />
(with or without leading space) at the end of to any kind of tag, void or not. Both kinds will be generated correctly in the output page.
Comments starting with <!---
(three dashes) are stripped from the page.
Sometimes we want our comments to stay private. Plus, by enforcing this rule, Trillo can use its own <!---
comments in generated markup as markers for its internal working, knowing they cannot conflict with ours.
Attribute values can contain multiline text and unescaped <
and >
characters, so it's easy to put JavaScript code inside them. They can be quoted with '
, "
, and the [[
+ ]]
special markers. Unquoted attribute values are not supported. In the output all attributes will be standards-compliant of course.
Note that the
attribute=[[...]]
syntax removes the need to escape either'
or"
in attribute values, which is convenient when writing JavaScript code. Code editors don't natively support it though, so you may choose to use"[[...]]"
or'[[...]]'
and avoid using the quotes inside the expressions, or escape them as per HTML specs, with"
and&apos
.
Attribute names starting with :
are valid (they're used to declare ) although they won't directly appear in output pages.