transitive loading message (closes #176) and other improvements
parent
75ec407890
commit
f3fb154704
@ -0,0 +1,51 @@
|
|||||||
|
#lang racket/base
|
||||||
|
(require (for-syntax racket/base
|
||||||
|
syntax/strip-context
|
||||||
|
"project.rkt"
|
||||||
|
"../setup.rkt")
|
||||||
|
racket/stxparam
|
||||||
|
racket/splicing
|
||||||
|
"external/include-template.rkt"
|
||||||
|
"../cache.rkt"
|
||||||
|
"../pagetree.rkt"
|
||||||
|
"../core.rkt"
|
||||||
|
"../setup.rkt"
|
||||||
|
"../template.rkt"
|
||||||
|
"../top.rkt")
|
||||||
|
|
||||||
|
(provide (rename-out [mb #%module-begin])
|
||||||
|
(except-out (all-from-out racket/base) #%module-begin))
|
||||||
|
|
||||||
|
(define-syntax-parameter doc (λ (stx) (error 'doc-not-parameterized)))
|
||||||
|
(define-syntax-parameter metas (λ (stx) (error 'metas-not-parameterized)))
|
||||||
|
(define-syntax-parameter result (λ (stx) (error 'result-not-parameterized)))
|
||||||
|
|
||||||
|
(define-syntax (mb stx)
|
||||||
|
(syntax-case stx ()
|
||||||
|
;; markup / markdown branch
|
||||||
|
[(_ #:source SOURCE-PATH-STRING
|
||||||
|
#:template TEMPLATE-PATH-STRING
|
||||||
|
#:result-id RESULT-ID)
|
||||||
|
(let ([source-path (syntax->datum #'SOURCE-PATH-STRING)])
|
||||||
|
(with-syntax ([DIRECTORY-REQUIRE-FILES
|
||||||
|
(replace-context #'here (require-directory-require-files source-path))]
|
||||||
|
[DOC-ID (setup:main-export source-path)]
|
||||||
|
[METAS-ID (setup:meta-export source-path)]
|
||||||
|
[COMMAND-CHAR (setup:command-char source-path)])
|
||||||
|
#'(#%module-begin
|
||||||
|
DIRECTORY-REQUIRE-FILES
|
||||||
|
(splicing-syntax-parameterize
|
||||||
|
([doc (make-rename-transformer #'DOC-ID)]
|
||||||
|
[metas (make-rename-transformer #'METAS-ID)]
|
||||||
|
[result (make-rename-transformer #'RESULT-ID)])
|
||||||
|
(define result
|
||||||
|
(parameterize ([current-pagetree (make-project-pagetree (current-project-root))]
|
||||||
|
[current-metas (cached-metas SOURCE-PATH-STRING)])
|
||||||
|
(define doc (cached-doc SOURCE-PATH-STRING))
|
||||||
|
(define metas (current-metas))
|
||||||
|
(define here (path->pagenode
|
||||||
|
(or (select-from-metas (setup:here-path-key SOURCE-PATH-STRING) metas) 'unknown)))
|
||||||
|
(if (bytes? doc) ; if main export is binary, just pass it through
|
||||||
|
doc
|
||||||
|
(include-template #:command-char COMMAND-CHAR (file TEMPLATE-PATH-STRING)))))
|
||||||
|
(provide result)))))]))
|
@ -1 +1 @@
|
|||||||
1541019731
|
1541194651
|
||||||
|
Loading…
Reference in New Issue