|
|
|
@ -1,10 +1,15 @@
|
|
|
|
|
#lang racket/base
|
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
|
|
|
|
|
|
(provide (except-out (all-from-out racket/base) #%module-begin)
|
|
|
|
|
(rename-out [new-module-begin #%module-begin]))
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (new-module-begin body-exprs ...)
|
|
|
|
|
(#%module-begin
|
|
|
|
|
|
|
|
|
|
(define-syntax (new-module-begin stx)
|
|
|
|
|
(syntax-case stx ()
|
|
|
|
|
[(_ body-exprs ...)
|
|
|
|
|
(syntax-protect
|
|
|
|
|
#`(#%module-begin
|
|
|
|
|
(module inner pollen/lang/doclang-raw
|
|
|
|
|
;; doclang_raw is a version of scribble/doclang with the decoder disabled
|
|
|
|
|
;; first three lines are positional arguments for doclang-raw
|
|
|
|
@ -24,10 +29,14 @@
|
|
|
|
|
|
|
|
|
|
(require 'inner)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; if reader-here-path is undefined, it will become a proc courtesy of #%top
|
|
|
|
|
;; therefore that's how we can detect if it's undefined
|
|
|
|
|
(define here-path (if (procedure? reader-here-path) "anonymous-module" reader-here-path))
|
|
|
|
|
|
|
|
|
|
;; set the parser mode based on reader mode
|
|
|
|
|
;; todo: this won't work with inline submodules
|
|
|
|
|
(define parser-mode
|
|
|
|
|
(if (equal? reader-mode world:reader-mode-auto)
|
|
|
|
|
(define parser-mode (if (equal? reader-mode world:reader-mode-auto)
|
|
|
|
|
(let* ([file-ext-pattern (pregexp "\\w+$")]
|
|
|
|
|
[here-ext (string->symbol (car (regexp-match file-ext-pattern here-path)))])
|
|
|
|
|
(cond
|
|
|
|
@ -50,11 +59,6 @@
|
|
|
|
|
(values doc-without-metas metas))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; if reader-here-path is undefined, it will become a proc courtesy of #%top
|
|
|
|
|
;; therefore that's how we can detect if it's undefined
|
|
|
|
|
(define here-path (if (procedure? reader-here-path) "anonymous-module" reader-here-path))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define doc-txexpr
|
|
|
|
|
(let ([doc-raw (if (equal? parser-mode world:reader-mode-markdown)
|
|
|
|
|
(apply (compose1 (dynamic-require 'markdown 'parse-markdown) string-append) doc-raw)
|
|
|
|
@ -88,4 +92,4 @@
|
|
|
|
|
(module+ main
|
|
|
|
|
(if (equal? parser-mode world:reader-mode-preproc)
|
|
|
|
|
(display doc)
|
|
|
|
|
(print doc)))))
|
|
|
|
|
(print doc)))))]))
|
|
|
|
|