take out planet references

pull/9/head
Matthew Butterick 11 years ago
parent be89754cd0
commit e349e1cfb6

@ -59,7 +59,7 @@ polcom [filename] (renders individual file)")]
[else (let ([possible-file (->path arg)]) [else (let ([possible-file (->path arg)])
(if (file-exists? possible-file) (if (file-exists? possible-file)
`(begin `(begin
(require (planet mb/pollen/render)) (require pollen/render)
(render ,possible-file)) (render ,possible-file))
`(displayln (format "No command defined for '~a'" ,arg))))])))) `(displayln (format "No command defined for '~a'" ,arg))))]))))

@ -18,7 +18,7 @@
(mb-read-syntax (object-name p) p))) (mb-read-syntax (object-name p) p)))
(define (make-output-datum i) (define (make-output-datum i)
`(module pollen-lang-module (planet mb/pollen) `(module pollen-lang-module pollen
,@i)) ,@i))
@ -27,7 +27,7 @@
(datum->syntax i (datum->syntax i
;; select pollen dialect based on file type ;; select pollen dialect based on file type
`(module pollen-lang-module ,(if (preproc-source? path-string) `(module pollen-lang-module ,(if (preproc-source? path-string)
'(planet mb/pollen/main-preproc) 'pollen/main-preproc
'(planet mb/pollen/main)) 'pollen/main)
,@i) ,@i)
i)) i))

@ -1,9 +1,9 @@
#lang racket/base #lang racket/base
(require racket/string racket/list racket/contract) (require racket/string racket/list racket/contract)
(require (planet mb/pollen/readability)) (require pollen/readability)
(provide (all-defined-out) (provide (all-defined-out)
(all-from-out racket/string racket/list racket/contract (planet mb/pollen/readability))) (all-from-out racket/string racket/list racket/contract pollen/readability))
(define css-property-prefixes '("-moz-" "-webkit-" "-o-" "-ms-" "")) (define css-property-prefixes '("-moz-" "-webkit-" "-o-" "-ms-" ""))

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require "core.rkt") (require "core.rkt")
(require (planet mb/pollen/file-tools)) (require pollen/file-tools)
(require net/url-structs net/base64 racket/file) (require net/url-structs net/base64 racket/file)
(provide (all-defined-out)) (provide (all-defined-out))

@ -1,8 +1,6 @@
#lang racket #lang racket
(require racket/contract/region) (require racket/contract/region)
;; use full planet paths because this file is evaluated from source directory,
;; not module directory
(require (for-syntax racket/rerequire pollen/tools pollen/world)) (require (for-syntax racket/rerequire pollen/tools pollen/world))
(require pollen/tools pollen/world) (require pollen/tools pollen/world)

@ -6,13 +6,13 @@
(require racket/list (require racket/list
(planet mb/pollen/tools) pollen/tools
(planet mb/pollen/main-helper) pollen/main-helper
(only-in (planet mb/pollen/ptree) ptree-source-decode path->ptree-name) (only-in pollen/ptree ptree-source-decode path->ptree-name)
(only-in (planet mb/pollen/predicates) ptree?)) (only-in pollen/predicates ptree?))
(provide (all-from-out racket/list (provide (all-from-out racket/list
(planet mb/pollen/tools) pollen/tools
(planet mb/pollen/main-helper) pollen/main-helper
(planet mb/pollen/ptree) pollen/ptree
(planet mb/pollen/predicates))) pollen/predicates))

@ -4,11 +4,11 @@
;; so they can be imported into the render.rkt namespace ;; so they can be imported into the render.rkt namespace
;; and cached for the benefit of the render eval function. ;; and cached for the benefit of the render eval function.
(require (only-in (planet mb/pollen/readability) ->list) (require (only-in pollen/readability ->list)
(only-in (planet mb/pollen/tools) trim) (only-in pollen/tools trim)
(only-in (planet mb/pollen/predicates) whitespace?)) (only-in pollen/predicates whitespace?))
(provide (all-from-out (provide (all-from-out
(planet mb/pollen/readability) pollen/readability
(planet mb/pollen/tools) pollen/tools
(planet mb/pollen/predicates))) pollen/predicates))

@ -17,8 +17,8 @@
; doclang2_raw is a clone of scribble/doclang2 with decode disabled ; doclang2_raw is a clone of scribble/doclang2 with decode disabled
; helpful because it collects & exports content via 'doc ; helpful because it collects & exports content via 'doc
(module pollen-inner (planet mb/pollen/lang/doclang2_raw) (module pollen-inner pollen/lang/doclang2_raw
(require (planet mb/pollen/tools) (planet mb/pollen/main-helper)) (require pollen/tools pollen/main-helper)
(require-and-provide-extras) ; brings in the project require files (require-and-provide-extras) ; brings in the project require files
expr ...) ; body of module expr ...) ; body of module

@ -19,10 +19,10 @@
;; doclang2_raw is a clone of scribble/doclang2 with decode disabled ;; doclang2_raw is a clone of scribble/doclang2 with decode disabled
;; helpful because it collects & exports content via 'doc ;; helpful because it collects & exports content via 'doc
(module pollen-inner (planet mb/pollen/lang/doclang2_raw) (module pollen-inner pollen/lang/doclang2_raw
;; use same requires as top of main.rkt ;; use same requires as top of main.rkt
;; (can't import them from surrounding module due to submodule rules) ;; (can't import them from surrounding module due to submodule rules)
(require (planet mb/pollen/tools) (planet mb/pollen/main-helper)) (require pollen/tools pollen/main-helper)
(require-and-provide-extras) ; brings in the project require files (require-and-provide-extras) ; brings in the project require files
;; #%top binding catches ids that aren't defined ;; #%top binding catches ids that aren't defined
@ -45,7 +45,7 @@
(define inner-here-path here-path) (define inner-here-path here-path)
(provide (all-defined-out)) (provide (all-defined-out))
(provide (all-from-out ; pollen file should bring its requires (provide (all-from-out ; pollen file should bring its requires
(planet mb/pollen/tools)))) pollen/tools)))
(require 'pollen-inner) ; provides doc & #%top, among other things (require 'pollen-inner) ; provides doc & #%top, among other things

@ -160,45 +160,6 @@
(check-false (elements-unique? "foo"))) (check-false (elements-unique? "foo")))
;; certain ptree requirements are enforced at compile-time.
;; (such as names must be valid strings, and unique.)
;; otherwise this becomes a rather expensive contract
;; because every function in ptree.rkt uses it.
;; note that a ptree is just a bunch of recursively nested ptrees.
(define/contract (ptree? xs)
(any/c . -> . boolean?)
(and (list? xs) (andmap (λ(x) (or (ptree-name? x) (ptree? x))) xs)))
(module+ test
(check-true (ptree? '(foo)))
(check-true (ptree? '(foo (hee))))
(check-true (ptree? '(foo (hee ((uncle "foo")))))))
;; ptree location must represent a possible valid filename
(define/contract (ptree-name? x #:loud [loud #f])
((any/c) (#:loud boolean?) . ->* . boolean?)
;; todo: how to express the fact that the ptree-location must be
;; a valid base name for a file?
;; however, don't restrict it to existing files
;; (author may want to use ptree as wireframe)
(define result (and x (not (list? x)) (not (whitespace? (->string x)))))
(if (and (not result) loud)
(error "Not a valid ptree key:" x)
result))
(module+ test
(check-true (ptree-name? "foo-bar"))
(check-true (ptree-name? "Foo_Bar_0123"))
(check-true (ptree-name? 'foo-bar))
(check-true (ptree-name? "foo-bar.p"))
(check-true (ptree-name? "/Users/MB/foo-bar"))
(check-false (ptree-name? #f))
(check-false (ptree-name? ""))
(check-false (ptree-name? " ")))
;; recursive whitespace test ;; recursive whitespace test
(define/contract (whitespace? x) (define/contract (whitespace? x)

@ -287,17 +287,17 @@
(require web-server/templates (require web-server/templates
racket/list racket/list
xml/path xml/path
(planet mb/pollen/debug) pollen/debug
(planet mb/pollen/decode) pollen/decode
(planet mb/pollen/file-tools) pollen/file-tools
(planet mb/pollen/main-imports) pollen/main-imports
(planet mb/pollen/main-preproc-imports) pollen/main-preproc-imports
(planet mb/pollen/predicates) pollen/predicates
(planet mb/pollen/ptree) pollen/ptree
(planet mb/pollen/readability) pollen/readability
(planet mb/pollen/template) pollen/template
(planet mb/pollen/tools) pollen/tools
(planet mb/pollen/world)) pollen/world)
(define original-ns (current-namespace)) (define original-ns (current-namespace))
(define/contract (render-through-eval base-dir eval-string) (define/contract (render-through-eval base-dir eval-string)
@ -318,17 +318,17 @@
racket/rerequire racket/rerequire
racket/contract racket/contract
racket/list racket/list
(planet mb/pollen/debug) pollen/debug
(planet mb/pollen/decode) pollen/decode
(planet mb/pollen/file-tools) pollen/file-tools
(planet mb/pollen/main-imports) pollen/main-imports
(planet mb/pollen/main-preproc-imports) pollen/main-preproc-imports
(planet mb/pollen/predicates) pollen/predicates
(planet mb/pollen/ptree) pollen/ptree
(planet mb/pollen/readability) pollen/readability
(planet mb/pollen/template) pollen/template
(planet mb/pollen/tools) pollen/tools
(planet mb/pollen/world))) pollen/world))
(namespace-require 'racket) ; use namespace-require for FIRST require, then eval after (namespace-require 'racket) ; use namespace-require for FIRST require, then eval after
(eval eval-string (current-namespace)))) (eval eval-string (current-namespace))))
@ -350,7 +350,7 @@
;; for include-template (used below) ;; for include-template (used below)
(require web-server/templates) (require web-server/templates)
;; for ptree navigation functions, and template commands ;; for ptree navigation functions, and template commands
(require (planet mb/pollen/debug) (planet mb/pollen/ptree) (planet mb/pollen/template)) (require pollen/debug pollen/ptree pollen/template)
;; import source into eval space. This sets up main & metas ;; import source into eval space. This sets up main & metas
(require ,(->string source-name)) (require ,(->string source-name))
(set-current-ptree (make-project-ptree ,PROJECT_ROOT)) (set-current-ptree (make-project-ptree ,PROJECT_ROOT))

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require racket/contract racket/list racket/match) (require racket/contract racket/list racket/match)
(require (planet mb/pollen/tools) (planet mb/pollen/decode) (require pollen/tools pollen/decode
(planet mb/pollen/library/decode-tools)) pollen/library/decode-tools)
(provide (all-defined-out)) (provide (all-defined-out))

Loading…
Cancel
Save