///|
struct Book {
  title : String
  author : String
  year : Int32
  tags : Array[String]
} derive(ToJson)

///|
struct Shelf {
  shelf : String
  books : Array[Book]
} derive(ToJson)

///|
fn main {
  let books = [
    Book::{
      title: "The Hobbit",
      author: "Tolkien",
      year: 1937,
      tags: ["fantasy"],
    },
    Book::{
      title: "Dune",
      author: "Herbert",
      year: 1965,
      tags: ["science fiction", "classic"],
    },
  ]
  let page =
    #|

{{ shelf }}

#| let out = @moonpug.render(page, Shelf::{ shelf: "Reading ", books, }) catch { e => "refused: \{e}" } println(out) }