A unit of an indent must be 2 spaces.
html
body
div
p
becomes
<html>
<body>
<div></div>
<p></p>
</body>
</html>
A head word of a line is interpreted as an HTML tag. The rest words of the same line are interpreted as attributes or a text. An attribute value which contains spaces must be surrounded by double quotes. An attribute without value (like "check" and "required") can be defined by specifying no value and ending with an equal (=).
div id=container style="font-size: 12px; color: blue;"
p class=row This is interpreted as a text.
a href=https://github.com/ Go to GitHub
input type=checkbox checked=
becomes
<div id="container" style="font-size: 12px; color: blue;">
<p class="row">This is interpreted as a text.</p>
<a href="https://github.com/">Go to GitHub</a>
<input type="checkbox" checked>
</div>
ID and classes can be defined with a head word of a line.
p#foo.bar
#container
.wrapper
becomes
<p id="foo" class="bar"></p>
<div id="container"></div>
<div class="wrapper"></div>
Block texts can be defined as a child element of an HTML tag by appending a dot (.) or double dot (..) to the head word of a line. BR tags are inserted to each line except for the last line by appending a double dot (..) to the head word of a line.
script.
var msg = 'Hello Ace';
alert(msg);
p..
This is a block text.
BR tags are inserted
automatically.
becomes
<script>
var msg = 'Hello Ace';
alert(msg);
</script>
<p>
This is a block text.<br>
BR tags are inserted<br>
automatically.
</p>
A line which starts with a pipe (|) or double pipe (||) is interpreted as a block of plain texts. BR tags are inserted to each line except for the last line by having a line start with a double pipe (||).
div
| This is a single line.
div
|
This is a
block line.
div
||
This is a
block line
with BR tags.
becomes
<div>
This is a single line.
</div>
<div>
This is a
block line.
</div>
<div>
This is a<br>
block line<br>
with BR tags.
</div>
A line which starts withs an equal (=) is interpreted as a helper method.
= helperMethodName
The following helper methods are available.
A conditional comment helper method generates a conditional comment.
= conditionalComment commentType condition
The following comment types are acceptable:
Comment Type | Generated HTML |
---|---|
hidden | |
revealed | <![if expression]> HTML <![endif]> |
= conditionalComment hidden IE 6
<p>You are using Internet Explorer 6.</p>
= conditionalComment revealed !IE
<link href="non-ie.css" rel="stylesheet">
becomes
<!--[if IE 6]>
<p>You are using Internet Explorer 6.</p>
<![endif]-->
<![if !IE]>
<link href="non-ie.css" rel="stylesheet">
<![endif]>
A content helper method defines a block content which is embedded in the base template. This helper method must be used only in the inner template.
= content main
h2 Inner Template - Main : {{.Msg}}
= content sub
h3 Inner Template - Sub : {{.Msg}}
A css helper method generates a style tag which has "text/css" type.
= css
body {
margin: 0;
}
h1 {
font-size: 200%;
color: blue;
}
becomes
<style type="text/css">
body {
margin: 0;
}
h1 {
font-size: 200%;
color: blue;
}
</style>
A doctype helper method generates a doctype tag.
= doctype doctypeName
The following doctype names are acceptable:
Doctype Name | Generated HTML |
---|---|
html | |
xml | |
transitional | |
strict | |
frameset | |
1.1 | |
basic | |
mobile |
= doctype html
becomes
<!DOCTYPE html>
An include helper method includes another template. You can pass a pipeline (parameter) from the including template to the included template.
= include templatePathWithoutExtension pipeline
A javascript helper method generates a script tag which has "text/javascript" type.
= javascript
var msg = 'Hello Ace';
alert(msg);
becomes
<script type="text/javascript">
var msg = 'Hello Ace';
alert(msg);
</script>
A yield helper method generates the HTML tags which are defined in the inner template. This helper method must be used only in the base template.
= yield main
| This message is rendered if the "main" content is not defined in the inner template.
= yield sub
| This message is rendered if the "sub" content is not defined in the inner template.
A line which starts with a slash (/) or double slash (//) is interpreted as a comment. A line which starts with a slash (/) is not rendered. A line which starts with a double slash (//) is renderd as an HTML comment.
/ This is a single line comment which is not rendered.
/
This is a multiple lines comment
which is not rendered.
// This is a single line comment which is rendered as an HTML comment.
//
This is a multiple lines comment
which is rendered as an HTML comment.
becomes
<!-- This is a single line comment which is rendered as an HTML comment. -->
<!--
This is a multiple lines comment
which is rendered as an HTML comment.
-->
Actions of the template package can be embedded in Ace templates.
body
h1 Base Template : {{.Msg}}
{{if true}}
p Conditional block
{{end}}
The following functions are predefined.
HTML function returns a non-escaped string.
{{"<br>"}}
{{HTML "<br>"}}
becomes
<br>
<br>