Skip to content

Instantly share code, notes, and snippets.

@otherjoel
Created March 16, 2018 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otherjoel/cde1aef9b582392efcdb12d74d65bf7c to your computer and use it in GitHub Desktop.
Save otherjoel/cde1aef9b582392efcdb12d74d65bf7c to your computer and use it in GitHub Desktop.
Minimal Pollen project demonstrating use of `in`
#lang pollen
◊define-meta[title]{Chapter I}
Travellers left and entered our car at every stopping of the train. Three persons, however, remained, bound, like myself, for the farthest station...
#lang pollen
◊define-meta[title]{Chapter II}
Scarcely had the old man gone when a general conversation began...
#lang pollen
◊define-meta[title]{Chapter III}
The lawyer and the lady whispered together. I was sitting beside Posdnicheff, and I maintained silence...
#lang pollen
◊define-meta[title]{The Kreutzer Sonata}
◊define-meta[template]{template-index.html}
"The weaker my hand, the greater the need that my model should be perfect."
—Leo Tolstoi
#lang pollen/ptree
◊index.html{
chapter1.html
chapter2.html
chapter3.html
}
#lang racket
(provide (all-defined-out)
in) ; from web-server/templates
(require web-server/templates
pollen/decode)
(define (root . xs)
`(root ,@(decode-paragraphs xs)))
<html>
<head><title>My Book</title></head>
<body>
<h1>◊(select-from-metas 'title here)</h1>
◊(->html (decode-paragraphs (select-from-doc 'root here)))
<ul>
◊in[c (children here)]{
<li><a href="/◊c">◊(select-from-metas 'title c)</a></li>
}
</ul>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment