(use-modules (haunt reader))
The purpose of a reader is to translate the markup within a post file into an SXML tree representing the HTML structure and associate some metadata with it.
Create a new reader. The reader is to be activated when
matcher, a procedure that accepts a file name as its only
argument, returns #t
. When a post file matches, the procedure
proc, which also accepts a file name as its only argument, reads
the contents and returns a post object (see Posts).
Return #t
if object is a reader.
Return the match procedure for reader.
Return the read procedure for reader.
Return #t
if file-name is a file supported by
reader.
Return the first reader in readers that can parse
file-name, or #f
if there is no such reader.
Parse file-name using reader and return two values: an alist of metadata and an SXML tree.
Read a post object from file-name using reader, merging its metadata with default-metadata, or the empty list if not specified.
Read all of the files in directory that match keep? as post objects. The readers list must contain a matching reader for every post.
Create a procedure that returns #t
when a file name ends with
“.ext”.
A basic reader for posts written as Scheme code that evaluates to an
an association list. The special key content
contains the post
body as an SXML tree.
Example:
(use-modules (haunt utils)) `((title . "Hello, world!") (date . ,(string->date* "2015-04-10 23:00")) (tags "foo" "bar") (summary . "Just a test") (content ((h2 "Hello!") (p "This is Haunt. A static site generator for GNU Guile."))))
A basic reader for posts written in plain ol’ HTML. Metadata is
encoded as the key: value
pairs, one per line, at the beginning
of the file. A line with the ---
sentinel marks the end of the
metadata section and the rest of the file is encoded as HTML.
Example:
title: A Foo Walks Into a Bar date: 2015-04-11 20:00 tags: bar --- <p> This is an example using raw HTML, because Guile doesn't have a Markdown parser. </p>