|
|
@ -7,7 +7,7 @@
|
|
|
|
(rename-out [dialect-module-begin #%module-begin]))
|
|
|
|
(rename-out [dialect-module-begin #%module-begin]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (dialect-module-begin PARSER-MODE-IN . OUTER-EXPRS)
|
|
|
|
(define-syntax-rule (dialect-module-begin PARSER-MODE-FROM-EXPANDER . READER-SUBMOD-AND-OTHER-EXPRS)
|
|
|
|
(#%module-begin
|
|
|
|
(#%module-begin
|
|
|
|
(require racket/base)
|
|
|
|
(require racket/base)
|
|
|
|
(provide (except-out (all-from-out racket/base) #%module-begin)
|
|
|
|
(provide (except-out (all-from-out racket/base) #%module-begin)
|
|
|
@ -16,7 +16,9 @@
|
|
|
|
(syntax-case stx ()
|
|
|
|
(syntax-case stx ()
|
|
|
|
[(_ . EXPRS)
|
|
|
|
[(_ . EXPRS)
|
|
|
|
(let-values ([(meta-hash exprs-without-metas) (split-metas (syntax->datum #'EXPRS) (setup:define-meta-name))])
|
|
|
|
(let-values ([(meta-hash exprs-without-metas) (split-metas (syntax->datum #'EXPRS) (setup:define-meta-name))])
|
|
|
|
(with-syntax ([META-HASH meta-hash]
|
|
|
|
(with-syntax (;; 'parser-mode-from-reader will be #f for an inline submodule
|
|
|
|
|
|
|
|
[PARSER-MODE-FROM-READER-PROPERTY (syntax-property stx 'parser-mode-from-reader)]
|
|
|
|
|
|
|
|
[META-HASH meta-hash]
|
|
|
|
[EXPRS-WITHOUT-METAS exprs-without-metas]
|
|
|
|
[EXPRS-WITHOUT-METAS exprs-without-metas]
|
|
|
|
[METAS (setup:meta-export)]
|
|
|
|
[METAS (setup:meta-export)]
|
|
|
|
[META-MOD (setup:meta-export)]
|
|
|
|
[META-MOD (setup:meta-export)]
|
|
|
@ -37,21 +39,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
(module inner pollen/private/doclang-raw
|
|
|
|
(module inner pollen/private/doclang-raw
|
|
|
|
DOC-RAW ; positional arg for doclang-raw that sets name of export.
|
|
|
|
DOC-RAW ; positional arg for doclang-raw that sets name of export.
|
|
|
|
(require pollen/top pollen/setup pollen/core)
|
|
|
|
(require pollen/top (submod ".." META-MOD) pollen/core pollen/setup)
|
|
|
|
(require (submod ".." META-MOD))
|
|
|
|
|
|
|
|
(provide (all-defined-out) #%top (all-from-out (submod ".." META-MOD) pollen/core))
|
|
|
|
(provide (all-defined-out) #%top (all-from-out (submod ".." META-MOD) pollen/core))
|
|
|
|
. EXPRS-WITHOUT-METAS)
|
|
|
|
. EXPRS-WITHOUT-METAS)
|
|
|
|
|
|
|
|
|
|
|
|
(require 'inner)
|
|
|
|
(require 'inner)
|
|
|
|
|
|
|
|
|
|
|
|
(define DOC
|
|
|
|
(define DOC
|
|
|
|
(let* ([parser-mode-undefined? (procedure? inner:parser-mode)] ; if undefined, #%top makes it a procedure
|
|
|
|
(let* ([parser-mode (or 'PARSER-MODE-FROM-READER-PROPERTY PARSER-MODE-FROM-EXPANDER)]
|
|
|
|
[parser-mode (if parser-mode-undefined? PARSER-MODE-IN inner:parser-mode)]
|
|
|
|
|
|
|
|
[proc (case parser-mode
|
|
|
|
[proc (case parser-mode
|
|
|
|
[(MODE-PAGETREE) decode-pagetree]
|
|
|
|
[(MODE-PAGETREE) decode-pagetree]
|
|
|
|
[(MODE-MARKUP) (λ(xs) (apply ROOT xs))] ; if `root` undefined, it becomes a default tag function
|
|
|
|
[(MODE-MARKUP) (λ(xs) (apply ROOT xs))] ; if `root` undefined, it becomes a default tag function
|
|
|
|
[(MODE-MARKDOWN)
|
|
|
|
[(MODE-MARKDOWN) (λ(xs) (apply ROOT (map strip-empty-attrs ((dynamic-require 'markdown 'parse-markdown) (apply string-append (map to-string xs))))))]
|
|
|
|
(λ(xs) (apply ROOT (map strip-empty-attrs ((dynamic-require 'markdown 'parse-markdown) (apply string-append (map to-string xs))))))]
|
|
|
|
|
|
|
|
[else (λ(xs) (apply string-append (map to-string xs)))])] ; string output for preprocessor
|
|
|
|
[else (λ(xs) (apply string-append (map to-string xs)))])] ; string output for preprocessor
|
|
|
|
;; drop leading newlines, as they're often the result of `defines` and `requires`
|
|
|
|
;; drop leading newlines, as they're often the result of `defines` and `requires`
|
|
|
|
[doc-elements (or (memf (λ(ln) (not (equal? ln NEWLINE))) DOC-RAW) null)]
|
|
|
|
[doc-elements (or (memf (λ(ln) (not (equal? ln NEWLINE))) DOC-RAW) null)]
|
|
|
@ -59,4 +58,4 @@
|
|
|
|
(proc doc-elements-spliced)))
|
|
|
|
(proc doc-elements-spliced)))
|
|
|
|
|
|
|
|
|
|
|
|
(provide DOC METAS (except-out (all-from-out 'inner) DOC-RAW #%top))))))]))
|
|
|
|
(provide DOC METAS (except-out (all-from-out 'inner) DOC-RAW #%top))))))]))
|
|
|
|
. OUTER-EXPRS))
|
|
|
|
. READER-SUBMOD-AND-OTHER-EXPRS))
|