Use new skribe reader in haunt.
authorrekado <rekado@elephly.net>
Sun, 17 Jan 2016 11:54:39 +0000 (12:54 +0100)
committerrekado <rekado@elephly.net>
Sun, 17 Jan 2016 11:54:39 +0000 (12:54 +0100)
haunt.scm
skribe.scm [deleted file]

index 157935bd458a35d0896ccbc656b5c00955097630..b2dd1e0474d9cfa42972eb02c41b560363ec9f75 100644 (file)
--- 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
 
 \f
 (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))))
 
 \f
 (define (photo-snippet post)
diff --git a/skribe.scm b/skribe.scm
deleted file mode 100644 (file)
index c7d8380..0000000
+++ /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))