Update example

This commit is contained in:
2025-08-02 20:33:26 +02:00
parent 4d746942f0
commit e7227c3433
+34 -7
View File
@@ -4,19 +4,46 @@ func(1, 3, 5);
title = "My Website"; title = "My Website";
posts = [ posts = [
{ name: "Post Title 1", data: "1 Jan 2025" }, {
{ name: "Post Title 2", data: "1 May 2024" }, name: "Post Title 1",
date: "1 Jan 2025",
comments: [
{ author: "User 1", date: "1 Jan 2025", content: "This is a comment" },
{ author: "User 2", date: "2 Jan 2025", content: "Second comment" },
]
},
{
name: "Post Title 2",
date: "4 July 2022",
comments: [
{ author: "User 1", date: "1 Jan 2025", content: "This is a comment" },
{ author: "User 2", date: "2 Jan 2025", content: "Second comment" },
]
},
]; ];
fun render_comment(c)
return <div class="comment">
<a>$c.author; ($c.date;)</a>
<p>$c.content;</p>
<div class="comment-children">
$for child in c.children:
render_comment(child);
</div>
</div>;
<html> <html>
<head> <head>
<title>$(title);</title> <title>$(title);</title>
</head> </head>
<body> <body>
<ul> $for post in posts: {
$ for post in posts: <div class="post">
<li>$(post.name); - $(post.date);</li> <a>$post.title; ($post.date;)</a>
</ul> $for comment in post.comments: {
$ comment(1, 3, 4); render_comment(comment);
}
</div>
}
</body> </body>
</html> </html>