|
|
@ -1,10 +1,15 @@
|
|
|
|
#lang racket/base
|
|
|
|
#lang racket/base
|
|
|
|
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
|
|
|
|
|
|
|
|
(provide (except-out (all-from-out racket/base) #%module-begin)
|
|
|
|
(provide (except-out (all-from-out racket/base) #%module-begin)
|
|
|
|
(rename-out [new-module-begin #%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
|
|
|
|
(module inner pollen/lang/doclang-raw
|
|
|
|
;; doclang_raw is a version of scribble/doclang with the decoder disabled
|
|
|
|
;; doclang_raw is a version of scribble/doclang with the decoder disabled
|
|
|
|
;; first three lines are positional arguments for doclang-raw
|
|
|
|
;; first three lines are positional arguments for doclang-raw
|
|
|
@ -24,10 +29,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
(require 'inner)
|
|
|
|
(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
|
|
|
|
;; set the parser mode based on reader mode
|
|
|
|
;; todo: this won't work with inline submodules
|
|
|
|
;; todo: this won't work with inline submodules
|
|
|
|
(define parser-mode
|
|
|
|
(define parser-mode (if (equal? reader-mode world:reader-mode-auto)
|
|
|
|
(if (equal? reader-mode world:reader-mode-auto)
|
|
|
|
|
|
|
|
(let* ([file-ext-pattern (pregexp "\\w+$")]
|
|
|
|
(let* ([file-ext-pattern (pregexp "\\w+$")]
|
|
|
|
[here-ext (string->symbol (car (regexp-match file-ext-pattern here-path)))])
|
|
|
|
[here-ext (string->symbol (car (regexp-match file-ext-pattern here-path)))])
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
@ -50,11 +59,6 @@
|
|
|
|
(values doc-without-metas metas))
|
|
|
|
(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
|
|
|
|
(define doc-txexpr
|
|
|
|
(let ([doc-raw (if (equal? parser-mode world:reader-mode-markdown)
|
|
|
|
(let ([doc-raw (if (equal? parser-mode world:reader-mode-markdown)
|
|
|
|
(apply (compose1 (dynamic-require 'markdown 'parse-markdown) string-append) doc-raw)
|
|
|
|
(apply (compose1 (dynamic-require 'markdown 'parse-markdown) string-append) doc-raw)
|
|
|
@ -88,4 +92,4 @@
|
|
|
|
(module+ main
|
|
|
|
(module+ main
|
|
|
|
(if (equal? parser-mode world:reader-mode-preproc)
|
|
|
|
(if (equal? parser-mode world:reader-mode-preproc)
|
|
|
|
(display doc)
|
|
|
|
(display doc)
|
|
|
|
(print doc)))))
|
|
|
|
(print doc)))))]))
|
|
|
|