1-03

Papercraft: Layouts

default_layout = ->(**props) {
  html(lang: 'en') {
    head {
      title(props[:title])
    }
    body {
      container {
        render_children(**props)
      }
    }
  }
}

...
Papercraft.html(default_layout) {
  h1 'foo'
}
article_layout =
  Papercraft.apply(default_layout) { |**a|
    article {
      h1 a[:title]
      markdown a[:md]
    }
  }

...
Papercraft.html(article_layout, **article)