diff --git a/main-helper.rkt b/main-helper.rkt index d0f44e4..91b8fd8 100644 --- a/main-helper.rkt +++ b/main-helper.rkt @@ -4,20 +4,20 @@ (require (for-syntax racket/rerequire pollen/tools pollen/world)) (require pollen/tools pollen/world) -(provide here-path get-here-path require-extras require-and-provide-extras bound/c +(provide (except-out (all-defined-out) top~) (rename-out (top~ #%top))) (module+ test (require rackunit)) (define-syntax-rule (top~ . id) - (λ x `(id ,@x))) + (λ x `(id ,@x))) (define-syntax (bound/c stx) - (syntax-case stx () - [(_ x) - (if (identifier-binding #'x ) - #'x - #'(#%top . x))])) + (syntax-case stx () + [(_ x) + (if (identifier-binding #'x ) + #'x + #'(#%top . x))])) (define-for-syntax (put-file-in-require-form file) `(file ,(->string file))) @@ -25,21 +25,21 @@ (define-syntax (require-and-provide-extras stx) (define project-require-files (get-project-require-files)) (if project-require-files - (let ([files-in-require-form (map put-file-in-require-form project-require-files)]) - (datum->syntax stx `(begin - (require ,@files-in-require-form) - (provide (all-from-out ,@files-in-require-form))))) - ; if no files to import, do nothing - #'(begin))) + (let ([files-in-require-form (map put-file-in-require-form project-require-files)]) + (datum->syntax stx `(begin + (require ,@files-in-require-form) + (provide (all-from-out ,@files-in-require-form))))) + ; if no files to import, do nothing + #'(begin))) (define-syntax (require-extras stx) (define project-require-files (get-project-require-files)) (if project-require-files - (let ([files-in-require-form (map put-file-in-require-form project-require-files)]) - (datum->syntax stx `(begin - (require ,@files-in-require-form)))) - ; if no files to import, do nothing - #'(begin))) + (let ([files-in-require-form (map put-file-in-require-form project-require-files)]) + (datum->syntax stx `(begin + (require ,@files-in-require-form)))) + ; if no files to import, do nothing + #'(begin))) ;; here = path of this file, relative to current directory. @@ -55,13 +55,13 @@ ;; Therefore, best to use let. (let* ([ccr (current-contract-region)] ; trick for getting current module name [hp (cond - ;; if contract-region is called from within submodule, - ;; you get a list - ;; in which case, just grab the path from the front - [(list? ccr) (car ccr)] - ;; file isn't yet saved in drracket - [(equal? 'pollen-lang-module ccr) 'nowhere] - [else ccr])]) + ;; if contract-region is called from within submodule, + ;; you get a list + ;; in which case, just grab the path from the front + [(list? ccr) (car ccr)] + ;; file isn't yet saved in drracket + [(equal? 'pollen-lang-module ccr) 'nowhere] + [else ccr])]) ;; pass complete path back as here value (as string) ;; Why not relative to current-directory? ;; Because current-directory can't be parameterized diff --git a/main.rkt b/main.rkt index fc041cd..ddd8acd 100644 --- a/main.rkt +++ b/main.rkt @@ -34,7 +34,7 @@ (provide (all-from-out ; pollen file should bring its requires pollen/tools))) - (require 'pollen-inner) ; provides doc, among other things + (require 'pollen-inner) ; provides doc & #%top, among other things (define here ((bound/c path->pnode) inner-here-path)) @@ -68,7 +68,7 @@ ;; Because if it's overridden to something other than *.ptree, ;; ptree processing will fail. ;; This defeats rule that ptree file suffix triggers ptree decoding. - (define here-is-ptree? (ptree-source? (->path inner-here-path))) + (define here-is-ptree? ((bound/c ptree-source?) (->path inner-here-path))) (define main (apply (if here-is-ptree? ;; ptree source files will go this way, diff --git a/render.rkt b/render.rkt index 04e6d12..b2a81ec 100644 --- a/render.rkt +++ b/render.rkt @@ -350,7 +350,7 @@ ;; for include-template (used below) (require web-server/templates) ;; for ptree navigation functions, and template commands - (require pollen/debug pollen/ptree pollen/template) + (require pollen/debug pollen/ptree pollen/template pollen/main-helper) ;; import source into eval space. This sets up main & metas (require ,(->string source-name)) (parameterize ([current-ptree (make-project-ptree ,PROJECT_ROOT)]