From 510f4ae9df75ede3c62e8a5264091972f8d1b8c6 Mon Sep 17 00:00:00 2001 From: Francesco Cozzuto Date: Wed, 6 Aug 2025 00:32:45 +0200 Subject: [PATCH] Update README --- README.md | 3 ++- main.c | 1 + main.wl | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 49c5a2b..c4f9fb6 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ WL is a powerful and flexible templating language for the web. Here's an example template in WL with a recursive comment view element: ```html -posts = [ +let posts = [ { author: "UserA", title: "I'm the first post", content: "Sup everyone!", + date: "1 Jan 2025", comments: [ { author: "UserB", diff --git a/main.c b/main.c index d393b5d..28cfede 100644 --- a/main.c +++ b/main.c @@ -49,6 +49,7 @@ int main(int argc, char **argv) case WL_ERROR: done = true; + printf("%s\n", err); break; case WL_VAR: diff --git a/main.wl b/main.wl index 1c51696..9f9ec81 100644 --- a/main.wl +++ b/main.wl @@ -1,5 +1,53 @@ -let set = {a: "G", b: "T", c: "K"} +let posts = [ + { + author: "UserA", + title: "I'm the first post", + content: "Sup everyone!", + date: "1 Jan 2025", + comments: [ + { + author: "UserB", + content: "Hello! This is a comment!", + comments: [ + { + author: "UserA", + content: "Hello to you!", + comments: [] + } + ] + } + ] + } +] -for item, i in set: { -
  • \item \i \set[item]
  • -} +fun comment(c) +
    + \c.author +

    \c.content

    + \for subc in c.comments: + comment(subc) +
    + + + + List of posts + + + \for post in posts: +
    +

    + \post.title +

    + + Posted on \post.date by \post.author + +

    + \post.content +

    +
    + \for c in post.comments: + comment(c) +
    +
    + + \ No newline at end of file