|
|
|
@ -22,6 +22,10 @@
|
|
|
|
|
auto-computed-mode)
|
|
|
|
|
reader-mode))
|
|
|
|
|
|
|
|
|
|
(define (derive-expander-name mode)
|
|
|
|
|
(define suffix (if (eq? mode default-mode-auto) "" mode))
|
|
|
|
|
(string->symbol (format "pollen/~a" suffix)))
|
|
|
|
|
|
|
|
|
|
(define (custom-read p)
|
|
|
|
|
(syntax->datum (custom-read-syntax (object-name p) p)))
|
|
|
|
|
|
|
|
|
@ -36,36 +40,28 @@
|
|
|
|
|
(define parser-mode-from-reader (infer-parser-mode reader-mode reader-here-path))
|
|
|
|
|
(strip-context
|
|
|
|
|
(with-syntax* ([POLLEN-MOD-NAME 'pollen-module]
|
|
|
|
|
;; these exist only in the reader because they are specific to file-based Pollen sources.
|
|
|
|
|
;; the next two exist only in the reader because they are specific to file-based Pollen sources.
|
|
|
|
|
;; an inline Pollen submodule doesn't have "pollen.rkt" or `here-path`
|
|
|
|
|
[POLLEN-REQUIRE-AND-PROVIDES (require+provide-directory-require-files path-string)]
|
|
|
|
|
[HERE-KEY (setup:here-path-key)]
|
|
|
|
|
[HERE-PATH reader-here-path]
|
|
|
|
|
[HERE-KEY (setup:here-path-key)]
|
|
|
|
|
[SOURCE-LINES source-stx]
|
|
|
|
|
[DOC (setup:main-export)]
|
|
|
|
|
[META-MOD (setup:meta-export)]
|
|
|
|
|
[PARSER-MODE-FROM-READER parser-mode-from-reader]
|
|
|
|
|
[EXPANDER (cond
|
|
|
|
|
[(eq? parser-mode-from-reader default-mode-markup) 'pollen/markup]
|
|
|
|
|
[(eq? parser-mode-from-reader default-mode-markdown) 'pollen/markdown]
|
|
|
|
|
[(eq? parser-mode-from-reader default-mode-pagetree) 'pollen/ptree]
|
|
|
|
|
[(eq? parser-mode-from-reader default-mode-preproc) 'pollen/pre]
|
|
|
|
|
[(eq? parser-mode-from-reader default-mode-auto) 'pollen]
|
|
|
|
|
[(eq? parser-mode-from-reader default-mode-template) 'pollen/template]
|
|
|
|
|
[else 'pollen])]
|
|
|
|
|
[POLLEN-MODULE-SYNTAX (let ([mod-stx #'(module POLLEN-MOD-NAME EXPANDER
|
|
|
|
|
(define-meta HERE-KEY HERE-PATH)
|
|
|
|
|
POLLEN-REQUIRE-AND-PROVIDES
|
|
|
|
|
. SOURCE-LINES)])
|
|
|
|
|
(syntax-property mod-stx 'parser-mode-from-reader parser-mode-from-reader))])
|
|
|
|
|
[METAS-ID (setup:meta-export)]
|
|
|
|
|
[PARSER-MODE-FROM-READER parser-mode-from-reader])
|
|
|
|
|
#'(module runtime-wrapper racket/base
|
|
|
|
|
(module configure-runtime racket/base
|
|
|
|
|
(require pollen/private/runtime-config)
|
|
|
|
|
(configure HERE-PATH)) ; HERE-PATH acts as "top" runtime config when module is main
|
|
|
|
|
POLLEN-MODULE-SYNTAX
|
|
|
|
|
(module POLLEN-MOD-NAME pollen/private/main-base
|
|
|
|
|
'PARSER-MODE-FROM-READER
|
|
|
|
|
(define-meta HERE-KEY HERE-PATH)
|
|
|
|
|
POLLEN-REQUIRE-AND-PROVIDES
|
|
|
|
|
. SOURCE-LINES)
|
|
|
|
|
(module META-MOD racket/base
|
|
|
|
|
(require (submod ".." POLLEN-MOD-NAME META-MOD))
|
|
|
|
|
(provide (all-from-out (submod ".." POLLEN-MOD-NAME META-MOD))))
|
|
|
|
|
(provide METAS-ID))
|
|
|
|
|
(require (only-in pollen/private/runtime-config show) 'POLLEN-MOD-NAME)
|
|
|
|
|
(provide (all-from-out 'POLLEN-MOD-NAME))
|
|
|
|
|
(show DOC 'PARSER-MODE-FROM-READER HERE-PATH))))) ; HERE-PATH otherwise acts as "local" runtime config
|
|
|
|
@ -98,7 +94,7 @@
|
|
|
|
|
(dynamic-require 'scribble/private/indentation 'determine-spaces)]
|
|
|
|
|
[else default]))))
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (reader-module-begin mode expr-to-ignore ...)
|
|
|
|
|
(define-syntax-rule (reader-module-begin mode . _)
|
|
|
|
|
(#%module-begin
|
|
|
|
|
(define cgi custom-get-info) ; stash hygienic references to local funcs with macro-introduced identifiers
|
|
|
|
|
(define cr custom-read) ; so they can be provided out
|
|
|
|
|