From 3d2f6cf429aeef63b2456ae0793adf16d862060f Mon Sep 17 00:00:00 2001 From: Francesco Cozzuto Date: Mon, 4 Aug 2025 15:49:46 +0200 Subject: [PATCH] Add README --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.wl | 11 ++++++++--- 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..49c5a2b --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# WL +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 = [ + { + author: "UserA", + title: "I'm the first post", + content: "Sup everyone!", + comments: [ + { + author: "UserB", + content: "Hello! This is a comment!", + comments: [ + { + author: "UserA", + content: "Hello to you!", + comments: [] + } + ] + } + ] + } +] + +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 diff --git a/main.wl b/main.wl index 57344a1..be4f2e6 100644 --- a/main.wl +++ b/main.wl @@ -1,5 +1,10 @@ -fun a(name) - My name is \(name) +fun comment(data) +
+ \data.author +

\data.content

+ \for sub_comment in data.sub_comments: + comment(sub_comment) +
-a("Francesco") +comment() \ No newline at end of file