Add examples and move tests to the tests/ folder

This commit is contained in:
2025-10-17 21:22:36 +02:00
parent 5706b1f861
commit b0900b3592
122 changed files with 202 additions and 158 deletions
+73
View File
@@ -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>