Add examples and move tests to the tests/ folder
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
let items = ['Apple', 'Orange', 'Strawberry']
|
||||
|
||||
let list =
|
||||
<ul>
|
||||
\for item in items:
|
||||
<li>\{escape item}</li>
|
||||
</ul>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Fruit List</title>
|
||||
</head>
|
||||
<body>
|
||||
My list:
|
||||
\{list}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
procedure my_page_template(title, content) {
|
||||
<html>
|
||||
<head>
|
||||
<title>\{escape title}</title>
|
||||
</head>
|
||||
<body>
|
||||
\{content}
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
my_page_template("Welcome to my webpage!", <article>Content of my page</article>)
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
let comments = [
|
||||
{
|
||||
'content': 'Cool post!',
|
||||
'children': [
|
||||
{
|
||||
'content': 'True!',
|
||||
'children': []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'content': 'I don\'t agree with the second section..',
|
||||
'children': [
|
||||
{
|
||||
'content': 'You\'re wrong!',
|
||||
'children': [
|
||||
{
|
||||
'content': 'No, YOU are wrong!',
|
||||
'children' : []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
procedure render_comment_subtree(comment) {
|
||||
<div class="comment">
|
||||
<p>\{escape comment.content}</p>
|
||||
<div class="comment-children">
|
||||
\for child in comment.children:
|
||||
render_comment_subtree(child)
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<style>
|
||||
.comment {
|
||||
border-left: 2px solid #ccc;
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<article>
|
||||
|
||||
<h1>A Very Cool Post</h1>
|
||||
|
||||
<h2>Section 1</h2>
|
||||
|
||||
<p>
|
||||
This language is cool
|
||||
</p>
|
||||
|
||||
<h2>Section 2</h2>
|
||||
|
||||
<p>
|
||||
You should try it out
|
||||
</p>
|
||||
|
||||
</article>
|
||||
|
||||
<div id="comments">
|
||||
\for comment in comments:
|
||||
render_comment_subtree(comment)
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user