From 9410e1471fd3bc78a9bad30407a09e35db61a13c Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sun, 28 Jun 2015 19:15:12 -0700 Subject: [PATCH] rename world:get-* to world:current-* --- cache.rkt | 6 +++--- command.rkt | 6 +++--- convert.rkt | 2 +- decode.rkt | 8 ++++---- file.rkt | 14 +++++++------- main-base.rkt | 6 +++--- metas.rkt | 8 ++++---- pagetree.rkt | 6 +++--- reader-base.rkt | 16 ++++++++-------- render.rkt | 26 +++++++++++++------------- scribblings/decode.scrbl | 4 ++-- scribblings/mb-tools.rkt | 4 ++-- scribblings/world.scrbl | 2 +- server-routes.rkt | 14 +++++++------- server.rkt | 4 ++-- template.rkt | 8 ++++---- world.rkt | 12 ++++++------ 17 files changed, 73 insertions(+), 73 deletions(-) diff --git a/cache.rkt b/cache.rkt index 075a18c..5853c22 100644 --- a/cache.rkt +++ b/cache.rkt @@ -7,7 +7,7 @@ (provide reset-cache current-cache make-cache cached-require cache-ref) (define (get-cache-file-path) - (build-path (world:current-project-root) (world:get-cache-filename))) + (build-path (world:current-project-root) (world:current-cache-filename))) (define (make-cache) (define cache-file-path (get-cache-file-path)) @@ -37,8 +37,8 @@ (hash-set! (current-cache) path (make-hash)) (define cache-hash (cache-ref path)) (hash-set! cache-hash 'mod-time (file-or-directory-modify-seconds path)) - (hash-set! cache-hash (world:get-main-export) (dynamic-require path (world:get-main-export))) - (hash-set! cache-hash (world:get-meta-export) (dynamic-require path (world:get-meta-export))) + (hash-set! cache-hash (world:current-main-export) (dynamic-require path (world:current-main-export))) + (hash-set! cache-hash (world:current-meta-export) (dynamic-require path (world:current-meta-export))) (write-to-file (serialize (current-cache)) (get-cache-file-path) #:exists 'replace) (void)) diff --git a/command.rkt b/command.rkt index 08e0bf2..a7b08ee 100644 --- a/command.rkt +++ b/command.rkt @@ -19,11 +19,11 @@ render filename render filename only (can be source or output name) publish copy project to desktop without source files publish [dir] [dest] copy project in dir to dest without source files (warning: overwrites existing dest dir) -version print the version (~a)" ,(world:current-server-port) ,(world:get-pollen-version)))) +version print the version (~a)" ,(world:current-server-port) ,(world:current-pollen-version)))) (define (handle-version) - `(displayln ,(world:get-pollen-version))) + `(displayln ,(world:current-pollen-version))) (define (handle-render path-args) @@ -69,7 +69,7 @@ version print the version (~a)" ,(world:current-server-port) ,(wo (define (handle-publish directory rest-args arg-command-name) (define target-path (or (and rest-args (not (null? rest-args)) (path->complete-path (string->path (car rest-args)))) - (build-path (find-system-path 'desk-dir) (string->path (if (equal? arg-command-name "clone") "clone" (world:get-publish-directory-name)))))) + (build-path (find-system-path 'desk-dir) (string->path (if (equal? arg-command-name "clone") "clone" (world:current-publish-directory-name)))))) `(begin (require racket/file pollen/file racket/list) diff --git a/convert.rkt b/convert.rkt index f72a905..2a4aab3 100644 --- a/convert.rkt +++ b/convert.rkt @@ -12,7 +12,7 @@ (cond [(and p-breaks (txexpr? x) (equal? (car x) 'p) (apply string-append `("\n" ,@(map ->string (map loop (get-elements x))) "\n")))] [(txexpr? x) (apply string-append - (map ->string `(,(world:get-command-char) ,(get-tag x) + (map ->string `(,(world:current-command-char) ,(get-tag x) ,@(if (not (null? (get-attrs x))) `("[" ,(attrs->pollen (get-attrs x)) "]") null) ,@(if (not (null? (get-elements x))) `("{" ,@(map loop (get-elements x)) "}" ) null))))] [(symbol? x) (loop (entity->integer x))] diff --git a/decode.rkt b/decode.rkt index eca584e..745e92c 100644 --- a/decode.rkt +++ b/decode.rkt @@ -280,7 +280,7 @@ ;; turn the right items into
tags (define+provide/contract (detect-linebreaks xc - #:separator [newline (world:get-linebreak-separator)] + #:separator [newline (world:current-linebreak-separator)] #:insert [linebreak '(br)]) ((txexpr-elements?) (#:separator string? #:insert xexpr?) . ->* . txexpr-elements?) ;; todo: should this test be not block + not whitespace? @@ -334,7 +334,7 @@ ;; is x a paragraph break? -(define+provide/contract (paragraph-break? x #:separator [sep (world:get-paragraph-separator)]) +(define+provide/contract (paragraph-break? x #:separator [sep (world:current-paragraph-separator)]) ((any/c) (#:separator pregexp?) . ->* . coerce/boolean?) (define paragraph-pattern (pregexp (format "^~a+$" sep))) (and (string? x) (regexp-match paragraph-pattern x))) @@ -342,7 +342,7 @@ (define (newline? x) - (and (string? x) (equal? (world:get-newline) x))) + (and (string? x) (equal? (world:current-newline) x))) (define (not-newline? x) (not (newline? x))) @@ -379,7 +379,7 @@ ;; detect paragraphs ;; todo: unit tests (define+provide/contract (detect-paragraphs elements #:tag [tag 'p] - #:separator [sep (world:get-paragraph-separator)] + #:separator [sep (world:current-paragraph-separator)] #:linebreak-proc [linebreak-proc detect-linebreaks] #:force? [force-paragraph #f]) ((txexpr-elements?) (#:tag symbol? #:separator string? #:linebreak-proc (txexpr-elements? . -> . txexpr-elements?) #:force? boolean?) diff --git a/file.rkt b/file.rkt index 91d7597..849ea54 100644 --- a/file.rkt +++ b/file.rkt @@ -50,7 +50,7 @@ (syntax-case stx () [(_ stem) (let ([stem-datum (syntax->datum #'stem)]) - (with-syntax ([world:get-stem-source-ext (format-id stx "world:get-~a-source-ext" #'stem)] + (with-syntax ([world:current-stem-source-ext (format-id stx "world:current-~a-source-ext" #'stem)] [stem-source? (format-id stx "~a-source?" #'stem)] [get-stem-source (format-id stx "get-~a-source" #'stem)] [has-stem-source? (format-id stx "has-~a-source?" #'stem)] @@ -60,7 +60,7 @@ #`(begin ;; does file have particular extension (define+provide (stem-source? x) - (->boolean (and (pathish? x) (has-ext? (->path x) (world:get-stem-source-ext))))) + (->boolean (and (pathish? x) (has-ext? (->path x) (world:current-stem-source-ext))))) (define+provide (get-stem-source x) (and (pathish? x) @@ -82,9 +82,9 @@ x #,(if (equal? stem-datum 'scribble) #'(if (x . has-ext? . 'html) ; different logic for scribble sources - (add-ext (remove-ext* x) (world:get-stem-source-ext)) + (add-ext (remove-ext* x) (world:current-stem-source-ext)) #f) - #'(add-ext x (world:get-stem-source-ext))))) + #'(add-ext x (world:current-stem-source-ext))))) (and result (->path result))) ;; coerce either a source or output file to both @@ -111,8 +111,8 @@ (make-source-utility-functions pagetree) (module-test-external (require pollen/world) - (check-true (pagetree-source? (format "foo.~a" (world:get-pagetree-source-ext)))) - (check-false (pagetree-source? (format "~a.foo" (world:get-pagetree-source-ext)))) + (check-true (pagetree-source? (format "foo.~a" (world:current-pagetree-source-ext)))) + (check-false (pagetree-source? (format "~a.foo" (world:current-pagetree-source-ext)))) (check-false (pagetree-source? #f))) (make-source-utility-functions markup) @@ -177,7 +177,7 @@ (or (ends-with? (path->string path) "compiled")))) (define+provide (cache-file? path) - (or (ends-with? (path->string path) (world:get-cache-filename)))) + (or (ends-with? (path->string path) (world:current-cache-filename)))) (define+provide (pollen-related-file? file) diff --git a/main-base.rkt b/main-base.rkt index 0190f69..9175199 100644 --- a/main-base.rkt +++ b/main-base.rkt @@ -13,9 +13,9 @@ (define-syntax (new-module-begin stx-arg) (syntax-case stx-arg () [(_ body-exprs (... ...)) - (with-syntax ([local-meta-tag-name (format-id stx-arg (symbol->string (world:get-meta-tag-name)))] - [local-doc-export-name (format-id stx-arg (symbol->string (world:get-main-export)))] - [local-metas-export-name (format-id stx-arg (symbol->string (world:get-meta-export)))]) + (with-syntax ([local-meta-tag-name (format-id stx-arg (symbol->string (world:current-meta-tag-name)))] + [local-doc-export-name (format-id stx-arg (symbol->string (world:current-main-export)))] + [local-metas-export-name (format-id stx-arg (symbol->string (world:current-meta-export)))]) (syntax-protect #'(#%module-begin (module inner pollen/doclang-raw diff --git a/metas.rkt b/metas.rkt index ed8c3d2..af78b4f 100644 --- a/metas.rkt +++ b/metas.rkt @@ -9,7 +9,7 @@ (define (possible-meta-element? x) - (and (txexpr? x) (equal? (world:get-meta-tag-name) (get-tag x)))) + (and (txexpr? x) (equal? (world:current-meta-tag-name) (get-tag x)))) (define (trivial-meta-element? x) @@ -51,7 +51,7 @@ ;; all metas are converted into "atomic meta" format ;; which is '(meta (key value ...)) (define (make-atomic-meta key . values) - `(,(world:get-meta-tag-name) (,key ,@values))) + `(,(world:current-meta-tag-name) (,key ,@values))) (define (explode-meta-element me) @@ -63,10 +63,10 @@ (cond [(has-meta-attrs me) ; might have txexpr elements, so preserve them (define attrs (get-attrs me)) - (loop (make-txexpr (world:get-meta-tag-name) (cdr attrs) (get-elements me)) (cons (apply make-atomic-meta (car attrs)) acc))] + (loop (make-txexpr (world:current-meta-tag-name) (cdr attrs) (get-elements me)) (cons (apply make-atomic-meta (car attrs)) acc))] [else ; has txexpr elements, but not meta-attrs (define txexpr-elements (get-elements me)) ; elements were filtered for txexpr at loop entry - (loop (make-txexpr (world:get-meta-tag-name) null (cdr txexpr-elements)) (cons (apply make-atomic-meta (car txexpr-elements)) acc))])] + (loop (make-txexpr (world:current-meta-tag-name) null (cdr txexpr-elements)) (cons (apply make-atomic-meta (car txexpr-elements)) acc))])] [else (reverse acc)]))) diff --git a/pagetree.rkt b/pagetree.rkt index 841836c..bcd98d9 100644 --- a/pagetree.rkt +++ b/pagetree.rkt @@ -38,7 +38,7 @@ (define+provide/contract (decode-pagetree xs) (txexpr-elements? . -> . any/c) ; because pagetree is being explicitly validated (validate-pagetree - (decode (cons (world:get-pagetree-root-node) xs) + (decode (cons (world:current-pagetree-root-node) xs) #:txexpr-elements-proc (λ(xs) (filter (compose1 not whitespace?) xs)) #:string-proc string->symbol))) ; because faster than ->pagenode @@ -85,8 +85,8 @@ (define+provide/contract (make-project-pagetree project-dir) (pathish? . -> . pagetree?) (with-handlers ([exn:fail? (λ(exn) (directory->pagetree project-dir))]) - (define pagetree-source (build-path project-dir (world:get-default-pagetree))) - (cached-require pagetree-source (world:get-main-export)))) + (define pagetree-source (build-path project-dir (world:current-default-pagetree))) + (cached-require pagetree-source (world:current-main-export)))) (define+provide/contract (parent pnish [pt (current-pagetree)]) (((or/c #f pagenodeish?)) (pagetree?) . ->* . (or/c #f pagenode?)) diff --git a/reader-base.rkt b/reader-base.rkt index 327dc70..2e42f01 100644 --- a/reader-base.rkt +++ b/reader-base.rkt @@ -14,9 +14,9 @@ (λ (path-string p) (define read-inner (make-at-reader #:command-char (if (or (equal? reader-mode world:mode-template) - (and (string? path-string) (regexp-match (pregexp (format "\\.~a$" (world:get-template-source-ext))) path-string))) - (world:get-template-command-char) - (world:get-command-char)) + (and (string? path-string) (regexp-match (pregexp (format "\\.~a$" (world:current-template-source-ext))) path-string))) + (world:current-template-command-char) + (world:current-command-char)) #:syntax? #t #:inside? #t)) (define file-contents (read-inner path-string p)) @@ -33,9 +33,9 @@ (let* ([file-ext-pattern (pregexp "\\w+$")] [here-ext (string->symbol (car (regexp-match file-ext-pattern reader-here-path)))]) (cond - [(equal? here-ext (world:get-pagetree-source-ext)) world:mode-pagetree] - [(equal? here-ext (world:get-markup-source-ext)) world:mode-markup] - [(equal? here-ext (world:get-markdown-source-ext)) world:mode-markdown] + [(equal? here-ext (world:current-pagetree-source-ext)) world:mode-pagetree] + [(equal? here-ext (world:current-markup-source-ext)) world:mode-markup] + [(equal? here-ext (world:current-markdown-source-ext)) world:mode-markdown] [else world:mode-preproc])) reader-mode)) ;; change names of exports for local use @@ -52,9 +52,9 @@ (module+ main (require txexpr racket/string) (if (or (equal? inner:parser-mode world:mode-preproc) (equal? inner:parser-mode world:mode-template)) - (display ,(world:get-main-export)) + (display ,(world:current-main-export)) (print (with-handlers ([exn:fail? (λ(exn) ((error '|pollen markup error| (string-join (cdr (string-split (exn-message exn) ": ")) ": "))))]) - (validate-txexpr ,(world:get-main-export))))))) + (validate-txexpr ,(world:current-main-export))))))) file-contents))) diff --git a/render.rkt b/render.rkt index 9bfb700..cb1e5ef 100644 --- a/render.rkt +++ b/render.rkt @@ -89,7 +89,7 @@ ((or/c pagetree? pathish?) . -> . void?) (define pagetree (if (pagetree? pagetree-or-path) pagetree-or-path - (cached-require pagetree-or-path (world:get-main-export)))) + (cached-require pagetree-or-path (world:current-main-export)))) (parameterize ([current-directory (world:current-project-root)]) (for-each render-from-source-or-output-path (map ->complete-path (pagetree->list pagetree))))) @@ -177,7 +177,7 @@ (file-needed-rerequire? source-path) ; called for its reqrequire side effect only, so dynamic-require below isn't cached (time (parameterize ([current-directory (->complete-path source-dir)]) ;; BTW this next action has side effects: scribble will copy in its core files if they don't exist. - ((dynamic-require 'scribble/render 'render) (list (dynamic-require source-path (world:get-main-export))) (list source-path)))) + ((dynamic-require 'scribble/render 'render) (list (dynamic-require source-path (world:current-main-export))) (list source-path)))) (define result (file->string (->output-path source-path))) (delete-file (->output-path source-path)) ; because render promises the data, not the side effect result) @@ -187,7 +187,7 @@ (complete-path? . -> . (or/c string? bytes?)) (match-define-values (source-dir _ _) (split-path source-path)) (time (parameterize ([current-directory (->complete-path source-dir)]) - (render-through-eval `(begin (require pollen/cache)(cached-require ,source-path ',(world:get-main-export))))))) + (render-through-eval `(begin (require pollen/cache)(cached-require ,source-path ',(world:current-main-export))))))) (define/contract (render-markup-or-markdown-source source-path [maybe-template-path #f]) @@ -200,14 +200,14 @@ (require (for-syntax racket/base)) (require pollen/include-template pollen/cache pollen/debug) ,(require-directory-require-files source-path) - (let ([,(world:get-main-export) (cached-require ,(path->string source-path) ',(world:get-main-export))] - [,(world:get-meta-export) (cached-require ,(path->string source-path) ',(world:get-meta-export))]) + (let ([,(world:current-main-export) (cached-require ,(path->string source-path) ',(world:current-main-export))] + [,(world:current-meta-export) (cached-require ,(path->string source-path) ',(world:current-meta-export))]) (local-require pollen/pagetree pollen/template pollen/top) - (define here (metas->here ,(world:get-meta-export))) + (define here (metas->here ,(world:current-meta-export))) (cond - [(bytes? ,(world:get-main-export)) ,(world:get-main-export)] ; if main export is binary, just pass it through + [(bytes? ,(world:current-main-export)) ,(world:current-main-export)] ; if main export is binary, just pass it through [else - (include-template #:command-char ,(world:get-command-char) (file ,(->string (find-relative-path source-dir template-path))))])))) + (include-template #:command-char ,(world:current-command-char) (file ,(->string (find-relative-path source-dir template-path))))])))) (time (parameterize ([current-directory source-dir]) ; because include-template wants to work relative to source location (render-through-eval expr-to-eval)))) @@ -227,12 +227,12 @@ (filter (λ(x) (->boolean x)) ; if any of the possibilities below are invalid, they return #f (list (parameterize ([current-directory (world:current-project-root)]) - (let ([source-metas (cached-require source-path (world:get-meta-export))]) - (and ((->symbol (world:get-template-meta-key)) . in? . source-metas) - (build-path source-dir (select-from-metas (->string (world:get-template-meta-key)) source-metas))))) ; path based on metas + (let ([source-metas (cached-require source-path (world:current-meta-export))]) + (and ((->symbol (world:current-template-meta-key)) . in? . source-metas) + (build-path source-dir (select-from-metas (->string (world:current-template-meta-key)) source-metas))))) ; path based on metas (and (filename-extension output-path) (build-path (world:current-project-root) - (add-ext (world:get-default-template-prefix) (get-ext output-path))))))) ; path to default template - (and (filename-extension output-path) (build-path (world:current-server-extras-path) (add-ext (world:get-fallback-template-prefix) (get-ext output-path)))))))) ; fallback template + (add-ext (world:current-default-template-prefix) (get-ext output-path))))))) ; path to default template + (and (filename-extension output-path) (build-path (world:current-server-extras-path) (add-ext (world:current-fallback-template-prefix) (get-ext output-path)))))))) ; fallback template (define/contract (file-needed-rerequire? source-path) diff --git a/scribblings/decode.scrbl b/scribblings/decode.scrbl index 684b8a4..c2cc8e9 100644 --- a/scribblings/decode.scrbl +++ b/scribblings/decode.scrbl @@ -320,7 +320,7 @@ In @racket[_str], convert three hyphens to an em dash, and two hyphens to an en @defproc[ (detect-linebreaks [tagged-xexpr-elements txexpr-elements?] -[#:separator linebreak-sep string? world:linebreak-separator] +[#:separator linebreak-sep string? (world:current-linebreak-separator)] [#:insert linebreak xexpr? '(br)]) txexpr-elements?] Within @racket[_tagged-xexpr-elements], convert occurrences of @racket[_linebreak-sep] (@racket["\n"] by default) to @racket[_linebreak], but only if @racket[_linebreak-sep] does not occur between blocks (see @racket[block-txexpr?]). Why? Because block-level elements automatically display on a new line, so adding @racket[_linebreak] would be superfluous. In that case, @racket[_linebreak-sep] just disappears. @@ -333,7 +333,7 @@ Within @racket[_tagged-xexpr-elements], convert occurrences of @racket[_linebrea @defproc[ (detect-paragraphs [elements txexpr-elements?] -[#:separator paragraph-sep string? world:paragraph-separator] +[#:separator paragraph-sep string? (world:current-paragraph-separator)] [#:tag paragraph-tag symbol? 'p] [#:linebreak-proc linebreak-proc (txexpr-elements? . -> . txexpr-elements?) detect-linebreaks] [#:force? force-paragraph? boolean? #f]) diff --git a/scribblings/mb-tools.rkt b/scribblings/mb-tools.rkt index 0a2b1dd..70a8801 100644 --- a/scribblings/mb-tools.rkt +++ b/scribblings/mb-tools.rkt @@ -63,8 +63,8 @@ (syntax-case stx () [(_ name predicate? desc ...) (with-syntax ([world:name (format-id stx "world:~a" #'name)] - [world:get-name (format-id stx "world:get-~a" #'name)] + [world:current-name (format-id stx "world:current-~a" #'name)] [local:name (format-id stx "local:~a" #'name)]) #'(deftogether ((defthing world:name predicate?) - (defproc (world:get-name) predicate?)) + (defproc (world:current-name) predicate?)) desc ...))])) \ No newline at end of file diff --git a/scribblings/world.scrbl b/scribblings/world.scrbl index badbbf4..14e9d86 100644 --- a/scribblings/world.scrbl +++ b/scribblings/world.scrbl @@ -55,7 +55,7 @@ Though any of the values below can be overridden, it may not always be wise to d Of course, you can restore the defaults simply by deleting these defined values from @racket["directory-require.rkt"]. -These settable values also come with a corresponding @racket[get-] function that will return the @racket[config] value if it exists, otherwise the @racket[world:] value. In the example above, @racket[world:command-char] would be @litchar{◊} no matter what, but @racket[world:get-command-char] would return @litchar{🎸}. +These settable values are each equipped with a corresponding @racket[world:current-]@racket[_settable-value] function that will return the value loaded from the @racket[config] submodule (if @racket[_settable-value] was defined there), otherwise the default given by @racket[world:]@racket[_settable-value]. For instance, @racket[world:command-char] will always be @litchar{◊}, but in the example above, @racket[world:current-command-char] would return @litchar{🎸}. @defoverridable[default-port integer?]{ diff --git a/server-routes.rkt b/server-routes.rkt index 87d5849..6887b7a 100644 --- a/server-routes.rkt +++ b/server-routes.rkt @@ -25,7 +25,7 @@ (meta ([charset "UTF-8"])) (link ([rel "stylesheet"] [type "text/css"] - [href ,(format "/~a" (world:get-dashboard-css))]))) + [href ,(format "/~a" (world:current-dashboard-css))]))) (body ,content-xexpr (div ((id "pollen-logo")))))) @@ -41,7 +41,7 @@ (define client (request-client-ip req)) (define localhost-client "::1") (define url-string (url->string (request-uri req))) - (message "request:" (string-replace url-string (world:get-default-pagetree) " dashboard") + (message "request:" (string-replace url-string (world:current-default-pagetree) " dashboard") (if (not (equal? client localhost-client)) (format "from ~a" client) ""))) ;; pass string args to route, then @@ -61,7 +61,7 @@ ((complete-path?) (#:render boolean?) . ->* . txexpr?) (when wants-render (render-from-source-or-output-path path)) (dynamic-rerequire path) ; stores module mod date; reloads if it's changed - (dynamic-require path (world:get-main-export))) + (dynamic-require path (world:current-main-export))) ;; todo: rewrite this test, obsolete since filename convention changed ;;(module+ test @@ -160,7 +160,7 @@ (define dirlinks (cons "/" (map (λ(ps) (format "/~a/" (apply build-path ps))) (for/list ([i (in-range (length (cdr dirs)))]) (take (cdr dirs) (add1 i)))))) - `(tr (th ((colspan "3")) ,@(add-between (map (λ(dir dirlink) `(a ((href ,(format "~a~a" dirlink (world:get-default-pagetree)))) ,(->string dir))) dirs dirlinks) "/")))) + `(tr (th ((colspan "3")) ,@(add-between (map (λ(dir dirlink) `(a ((href ,(format "~a~a" dirlink (world:current-default-pagetree)))) ,(->string dir))) dirs dirlinks) "/")))) (define (make-path-row filename-path) (define filename (->string filename-path)) @@ -170,7 +170,7 @@ (append (list (cond ; main cell [(directory-exists? (build-path dashboard-dir filename)) ; links subdir to its dashboard - (cons (format "~a/~a" filename (world:get-default-pagetree)) (format "~a/" filename))] + (cons (format "~a/~a" filename (world:current-default-pagetree)) (format "~a/" filename))] [(and source (equal? (get-ext source) "scrbl")) (cons #f `(a ((href ,filename)) ,filename (span ((class "file-ext")) " (from " ,(->string (find-relative-path dashboard-dir source)) ")")))] [source (cons #f `(a ((href ,filename)) ,filename (span ((class "file-ext")) "." ,(get-ext source))))] @@ -186,12 +186,12 @@ [(pagetree-source? filename) empty-cell] [else (cons (format "out/~a" filename) "out")])))))) - (define (ineligible-path? x) (member x (world:get-paths-excluded-from-dashboard))) + (define (ineligible-path? x) (member x (world:current-paths-excluded-from-dashboard))) (define project-paths (filter-not ineligible-path? (map ->path (pagetree->list (if (file-exists? dashboard-ptree) - (cached-require (->path dashboard-ptree) (world:get-main-export)) + (cached-require (->path dashboard-ptree) (world:current-main-export)) (directory->pagetree dashboard-dir)))))) (body-wrapper #:title (format "~a" dashboard-dir) diff --git a/server.rkt b/server.rkt index 9e0fd14..181f8bd 100755 --- a/server.rkt +++ b/server.rkt @@ -20,12 +20,12 @@ [((string-arg) ... "xexpr" (string-arg)) route-xexpr] [else route-default])) - (message (format "Welcome to Pollen ~a" (world:get-pollen-version)) (format "(Racket ~a)" (version))) + (message (format "Welcome to Pollen ~a" (world:current-pollen-version)) (format "(Racket ~a)" (version))) (message (format "Project root is ~a" (world:current-project-root))) (define server-name (format "http://localhost:~a" (world:current-server-port))) (message (format "Project server is ~a" server-name) "(Ctrl-C to exit)") - (message (format "Project dashboard is ~a/~a" server-name (world:get-default-pagetree))) + (message (format "Project dashboard is ~a/~a" server-name (world:current-default-pagetree))) (message "Ready to rock") (parameterize ([error-print-width 1000] diff --git a/template.rkt b/template.rkt index 95dd30e..ef04dcd 100644 --- a/template.rkt +++ b/template.rkt @@ -24,8 +24,8 @@ (define doc-result (select-from-doc key value-source)) (and doc-result (car doc-result))) (cond - [(or (hash? value-source) (equal? value-source (world:get-meta-export))) (select-from-metas key value-source)] - [(equal? value-source (world:get-main-export)) (do-doc-result)] + [(or (hash? value-source) (equal? value-source (world:current-meta-export))) (select-from-metas key value-source)] + [(equal? value-source (world:current-main-export)) (do-doc-result)] [else (define metas-result (and (not (txexpr? value-source)) (select-from-metas key value-source))) (or metas-result (do-doc-result))])) @@ -86,7 +86,7 @@ [(pagenode? pagenode-or-path) (pagenode->path pagenode-or-path)] [else pagenode-or-path]))) (if source-path - (cached-require source-path (world:get-meta-export)) + (cached-require source-path (world:current-meta-export)) (error (format "get-metas: no source found for '~a' in directory ~a" pagenode-or-path (current-directory))))) @@ -96,7 +96,7 @@ [(pagenode? pagenode-or-path) (pagenode->path pagenode-or-path)] [else pagenode-or-path]))) (if source-path - (cached-require source-path (world:get-main-export)) + (cached-require source-path (world:current-main-export)) (error (format "get-doc: no source found for '~a' in directory ~a" pagenode-or-path (current-directory))))) diff --git a/world.rkt b/world.rkt index a5df93e..aafd2df 100644 --- a/world.rkt +++ b/world.rkt @@ -16,13 +16,13 @@ (syntax-case stx () [(_ name default-value) (with-syntax ([base-name (format-id stx "~a" #'name)] - [get-name (format-id stx "get-~a" #'name)] + [current-name (format-id stx "current-~a" #'name)] [config-submodule (format-id stx "~a" config-submodule-name)] [fail-thunk-name (format-id stx "fail-thunk-~a" #'name)] ) #'(begin (define base-name default-value) (define fail-thunk-name (λ _ base-name)) - (define get-name (λ _ (with-handlers ([exn:fail? fail-thunk-name]) + (define current-name (λ _ (with-handlers ([exn:fail? fail-thunk-name]) (dynamic-require `(submod ,(get-path-to-override) config-submodule) 'base-name fail-thunk-name))))))])) (define-settable pollen-version "0.001") @@ -45,9 +45,9 @@ (define-settable cache-filename "pollen.cache") -(define-settable decodable-extensions (list (get-markup-source-ext) (get-pagetree-source-ext))) +(define-settable decodable-extensions (list (current-markup-source-ext) (current-pagetree-source-ext))) -(define-settable default-pagetree (format "index.~a" (get-pagetree-source-ext))) +(define-settable default-pagetree (format "index.~a" (current-pagetree-source-ext))) (define-settable pagetree-root-node 'pagetree-root) (define-settable command-char #\◊) @@ -62,7 +62,7 @@ (define-settable meta-tag-name 'meta) (define-settable newline "\n") -(define-settable linebreak-separator (get-newline)) +(define-settable linebreak-separator (current-newline)) (define-settable paragraph-separator "\n\n") (define-settable paths-excluded-from-dashboard (map string->path (list "poldash.css" "compiled"))) @@ -70,7 +70,7 @@ (define-settable default-port 8080) -(define current-server-port (make-parameter (get-default-port))) +(define current-server-port (make-parameter (current-default-port))) (define-settable dashboard-css "poldash.css")