summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2016-01-17 12:54:39 +0100
committerrekado <rekado@elephly.net>2016-01-17 12:54:39 +0100
commit810de6e38b92c801a533e42c607737402328cb1d (patch)
tree698e3d6ba204b3109e955094d2e1544faa59b8da
parent5850869f2637fe8df7f4ec08c9c4a87edec2025f (diff)
Use new skribe reader in haunt.
-rw-r--r--haunt.scm18
-rw-r--r--skribe.scm58
2 files changed, 4 insertions, 72 deletions
diff --git a/haunt.scm b/haunt.scm
index 157935b..b2dd1e0 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -4,8 +4,8 @@
(srfi srfi-26) ; cut
(ice-9 ftw) ; file system
(ice-9 match) ; match-lambda
- (skribe)
(haunt reader)
+ (haunt reader skribe)
(haunt site)
(haunt asset)
(haunt post) ;post-file-name
@@ -17,19 +17,9 @@
(define skribe-reader
- (make-reader (make-file-extension-matcher "skr")
- (lambda (file-name)
- (let ((contents (load (absolute-file-name file-name) %skribe-reader)))
- (values meta contents)))))
-
-;; Create stubs for each sxml tag
-;; This is needed for the skribe to sxml conversion.
-(for-each
- (lambda (tag)
- (eval `(define (,tag . content)
- (list (quote ,tag) content))
- (current-module)))
- '(a blockquote p img h1 h2 h3 code pre strong em ul li dl dt dd))
+ (make-skribe-reader #:modules '((haunt skribe utils)
+ (haunt utils)
+ (skribe-utils))))
(define (photo-snippet post)
diff --git a/skribe.scm b/skribe.scm
deleted file mode 100644
index c7d8380..0000000
--- a/skribe.scm
+++ /dev/null
@@ -1,58 +0,0 @@
-(define-module (skribe)
- #:use-module ((system reader) #:renamer (symbol-prefix-proc 'r:))
- #:export (%skribe-reader))
-
-;; Taken from Skribilo
-(define (make-colon-free-token-reader tr)
- ;; Stolen from `guile-reader' 0.3.
- "If token reader @var{tr} handles the @code{:} (colon) character, remove it
-from its specification and return the new token reader."
- (let* ((spec (r:token-reader-specification tr))
- (proc (r:token-reader-procedure tr)))
- (r:make-token-reader (filter (lambda (chr)
- (not (char=? chr #\:)))
- spec)
- proc)))
-
-(define &sharp-reader
- ;; The reader for what comes after a `#' character.
- (let* ((dsssl-keyword-reader ;; keywords à la `#!key'
- (r:make-token-reader #\!
- (r:token-reader-procedure
- (r:standard-token-reader 'keyword)))))
- (r:make-reader (cons dsssl-keyword-reader
- (map r:standard-token-reader
- '(character srfi-4 vector
- number+radix boolean
- srfi30-block-comment
- srfi62-sexp-comment)))
- #f ;; use default fault handler
- 'reader/record-positions)))
-
-(define (make-skribe-reader)
- (let ((colon-keywords ;; keywords à la `:key' fashion
- (r:make-token-reader #\:
- (r:token-reader-procedure
- (r:standard-token-reader 'keyword))))
- (symbol-misc-chars-tr
- ;; Make sure `:' is handled only by the keyword token reader.
- (make-colon-free-token-reader
- (r:standard-token-reader 'r6rs-symbol-misc-chars))))
-
- ;; Note: we use the `r6rs-symbol-*' and `r6rs-number' token readers since
- ;; they consider square brackets as delimiters.
- (r:make-reader (cons* (r:make-token-reader #\# &sharp-reader)
- colon-keywords
- symbol-misc-chars-tr
- (map r:standard-token-reader
- `(whitespace
- sexp string r6rs-number
- r6rs-symbol-lower-case
- r6rs-symbol-upper-case
- quote-quasiquote-unquote
- semicolon-comment
- skribe-exp)))
- #f ;; use the default fault handler
- 'reader/record-positions)))
-
-(define %skribe-reader (make-skribe-reader))