|
|
@ -42,28 +42,35 @@
|
|
|
|
(cons `(meta "here" ,inner-here) meta-elements)))))
|
|
|
|
(cons `(meta "here" ,inner-here) meta-elements)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; set up the 'main export
|
|
|
|
;; set up the 'main export
|
|
|
|
|
|
|
|
(require pollen/decode)
|
|
|
|
|
|
|
|
(require (only-in racket/list filter-not))
|
|
|
|
(define here-ext (car (regexp-match #px"\\w+$" inner-here-path)))
|
|
|
|
(define here-ext (car (regexp-match #px"\\w+$" inner-here-path)))
|
|
|
|
(define wants-decoder? (member here-ext (list "pd" "ptree")))
|
|
|
|
(define wants-decoder? (member here-ext (list "pd" "ptree")))
|
|
|
|
(define main (apply (if wants-decoder?
|
|
|
|
;(print (cdr main-without-metas))
|
|
|
|
;; 'root is the hook for the decoder function.
|
|
|
|
(define main (apply (cond
|
|
|
|
;; If it's not a defined identifier, it just hits #%top and becomes `(root ,@body ...)
|
|
|
|
[(equal? here-ext "ptree") (λ xs (decode (cons 'ptree-root xs)
|
|
|
|
root
|
|
|
|
#:xexpr-elements-proc (λ(xs) (filter-not whitespace? xs))))]
|
|
|
|
;; for preprocessor output, just make a string. Converts x-expressions to HTML.
|
|
|
|
;; 'root is the hook for the decoder function.
|
|
|
|
(λ xs (apply string-append (map (dynamic-require 'xml 'xexpr->string) xs))))
|
|
|
|
;; If it's not a defined identifier, it just hits #%top and becomes `(root ,@body ...)
|
|
|
|
(cdr main-without-metas))) ;; cdr strips placeholder-root tag
|
|
|
|
[wants-decoder? root]
|
|
|
|
|
|
|
|
;; for preprocessor output, just make a string. Converts x-expressions to HTML.
|
|
|
|
|
|
|
|
[else (λ xs (apply string-append (map (dynamic-require 'xml 'xexpr->string) xs)))])
|
|
|
|
;; derive 'here & 'here-path from the hash (because they might have been overridden in the source)
|
|
|
|
(cdr main-without-metas))) ;; cdr strips placeholder-root tag
|
|
|
|
(define here (hash-ref metas "here"))
|
|
|
|
|
|
|
|
(define here-path (hash-ref metas "here-path"))
|
|
|
|
|
|
|
|
|
|
|
|
;; derive 'here & 'here-path from the hash (because they might have been overridden in the source)
|
|
|
|
(provide metas main here here-path
|
|
|
|
(define here (hash-ref metas "here"))
|
|
|
|
;; hide the exports that were only for internal use.
|
|
|
|
(define here-path (hash-ref metas "here-path"))
|
|
|
|
(except-out (all-from-out 'inner) inner-here inner-here-path main-raw #%top))
|
|
|
|
|
|
|
|
|
|
|
|
(provide metas main here here-path
|
|
|
|
;; for output in DrRacket
|
|
|
|
;; hide the exports that were only for internal use.
|
|
|
|
(module+ main
|
|
|
|
(except-out (all-from-out 'inner) inner-here inner-here-path main-raw #%top))
|
|
|
|
(if wants-decoder?
|
|
|
|
|
|
|
|
(print main)
|
|
|
|
;; for output in DrRacket
|
|
|
|
(display main)))))
|
|
|
|
(module+ main
|
|
|
|
|
|
|
|
(if wants-decoder?
|
|
|
|
|
|
|
|
(print main)
|
|
|
|
|
|
|
|
(display main)))))
|
|
|
|