create pollen/top

pull/9/head
Matthew Butterick 10 years ago
parent 164bda9c2e
commit 34710663d7

@ -4,20 +4,10 @@
(require (for-syntax racket/rerequire pollen/tools pollen/world))
(require pollen/tools pollen/world)
(provide (except-out (all-defined-out) top~)
(rename-out (top~ #%top)))
(provide (all-defined-out))
(module+ test (require rackunit))
(define-syntax-rule (top~ . id)
(λ x `(id ,@x)))
(define-syntax (bound/c stx)
(syntax-case stx ()
[(_ x)
(if (identifier-binding #'x )
#'x
#'(#%top . x))]))
(define-for-syntax (put-file-in-require-form file)
`(file ,(->string file)))

@ -4,13 +4,14 @@
;; so they can be imported into the render.rkt namespace
;; and cached for the benefit of the render eval function.
(require racket/list
pollen/tools
pollen/main-helper
pollen/top
(only-in pollen/ptree ptree-source-decode path->pnode ptree?))
(provide (all-from-out racket/list
pollen/tools
pollen/main-helper
pollen/top
pollen/ptree))

@ -22,7 +22,11 @@
(module pollen-inner pollen/lang/doclang2_raw
;; use same requires as top of main.rkt
;; (can't import them from surrounding module due to submodule rules)
(require pollen/tools pollen/main-helper)
;; todo: how to keep these two lists in sync?
;; and why doesn't this work:
;; (require pollen/main-imports)
;; (provide (all-from-out pollen/main-imports))
(require pollen/tools pollen/main-helper pollen/top pollen/ptree)
(require-and-provide-extras) ; brings in the project require files
expr ... ; body of module

@ -350,7 +350,8 @@
;; for include-template (used below)
(require web-server/templates)
;; for ptree navigation functions, and template commands
(require pollen/debug pollen/ptree pollen/template pollen/main-helper)
;; todo: main-helper is here for #%top and bound/c — should they go elsewhere?
(require pollen/debug pollen/ptree pollen/template pollen/top)
;; import source into eval space. This sets up main & metas
(require ,(->string source-name))
(parameterize ([current-ptree (make-project-ptree ,PROJECT_ROOT)]

@ -0,0 +1,14 @@
#lang racket
(provide (except-out (all-defined-out) top~)
(rename-out (top~ #%top)))
(define-syntax-rule (top~ . id)
(λ x `(id ,@x)))
(define-syntax (bound/c stx)
(syntax-case stx ()
[(_ x)
(if (identifier-binding #'x )
#'x
#'(#%top . x))]))
Loading…
Cancel
Save