rename certain setup values

pull/110/head
Matthew Butterick 8 years ago
parent 025a4a8b76
commit cc1a116dc2

@ -112,7 +112,7 @@
(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 (setup:default-pagetree)))
(define pagetree-source (build-path project-dir (setup:main-pagetree)))
(load-pagetree pagetree-source)))

@ -120,7 +120,7 @@ version print the version (~a)" (setup:current-server-port) setup
(when (not (directory-exists? directory-maybe))
(error (format "~a is not a directory" directory-maybe)))
(parameterize ([setup:current-project-root directory-maybe]
[setup:current-server-port (or port setup:default-default-port)])
[setup:current-server-port (or port setup:default-project-server-port)])
(displayln "Starting project server ...")
((dynamic-require 'pollen/private/project-server 'start-server))))

@ -42,7 +42,7 @@
(define localhost-client "::1")
(define url-string (url->string (request-uri req)))
(when (not (ends-with? url-string "favicon.ico"))
(message "request:" (string-replace url-string (setup:default-pagetree) " dashboard")
(message "request:" (string-replace url-string (setup:main-pagetree) " dashboard")
(if (not (equal? client localhost-client)) (format "from ~a" client) ""))))
;; pass string args to route, then
@ -152,14 +152,14 @@
(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 (setup:default-pagetree)))) ,(->string dir))) dirs dirlinks) "/"))))
`(tr (th ((colspan "3")) ,@(add-between (map (λ(dir dirlink) `(a ((href ,(format "~a~a" dirlink (setup:main-pagetree)))) ,(->string dir))) dirs dirlinks) "/"))))
(define (make-path-row filename source indent-level)
`(tr ,@(map make-link-cell
(append (list
(let ([main-cell (cond ; main cell
[(directory-exists? (build-path dashboard-dir filename)) ; links subdir to its dashboard
(cons (format "~a/~a" filename (setup:default-pagetree)) (format "~a/" filename))]
(cons (format "~a/~a" filename (setup:main-pagetree)) (format "~a/" filename))]
[(and source (equal? (get-ext source) "scrbl")) ; scribble source
(cons #f `(a ((href ,filename)) ,filename (span ((class "file-ext")) " (from " ,(->string (find-relative-path dashboard-dir source)) ")")))]
[source ; ordinary source. use remove-ext because source may have escaped extension in it

@ -24,7 +24,7 @@
(define server-name (format "http://localhost:~a" (setup:current-server-port)))
(message (format "Project server is ~a" server-name) "(Ctrl-C to exit)")
(message (format "Project dashboard is ~a/~a" server-name (setup:default-pagetree)))
(message (format "Project dashboard is ~a/~a" server-name (setup:main-pagetree)))
(message "Ready to rock")
(parameterize ([error-print-width 1000])

@ -225,7 +225,7 @@
(define (get-default-template)
(and output-path-ext
(let ([default-template-filename (add-ext (setup:default-template-prefix source-path) output-path-ext)])
(let ([default-template-filename (add-ext (setup:template-prefix source-path) output-path-ext)])
(find-upward-from source-path default-template-filename file-exists-or-has-source?))))
(define (get-fallback-template)

@ -47,7 +47,7 @@ Displays a list of available commands.
@section{@exec{raco pollen start}}
Start the project server from the current directory using the default port, which is the value of the parameter @racket[setup:current-server-port] (by default, port @(format "~a" setup:default-default-port)).
Start the project server from the current directory using the default port, which is the value of the parameter @racket[setup:current-server-port] (by default, port @(format "~a" setup:default-project-server-port)).
This command can be invoked with two optional arguments.

@ -88,7 +88,7 @@ If your project has @seclink["fourth-tutorial"]{multiple output targets}, you ca
}
@item{If this key doesn't exist, or refers to a nonexistent file, look for a default template with the name @code[(format "~a.[output extension]" setup:default-default-template-prefix)]. Meaning, if @racket[_source-path] is @code[(format "intro.html.~a" setup:default-markup-source-ext)], the output path would be @code["intro.html"], so the default template would be @code[(format "~a.html" setup:default-default-template-prefix)]. Look for this default template in the same directory as the source file, and then search upwards within successive parent directories. (Corollary: a default template in the project root will apply to all files in the project unless overridden within a subdirectory.)}
@item{If this key doesn't exist, or refers to a nonexistent file, look for a default template with the name @code[(format "~a.[output extension]" setup:default-template-prefix)]. Meaning, if @racket[_source-path] is @code[(format "intro.html.~a" setup:default-markup-source-ext)], the output path would be @code["intro.html"], so the default template would be @code[(format "~a.html" setup:default-template-prefix)]. Look for this default template in the same directory as the source file, and then search upwards within successive parent directories. (Corollary: a default template in the project root will apply to all files in the project unless overridden within a subdirectory.)}
@item{If this file doesn't exist, use the fallback template as a last resort. (See @secref["Templates"
#:tag-prefixes '("tutorial-2")

@ -16,7 +16,7 @@ Global values that are used throughout the Pollen system.
I mean @italic{parameters} in the Racket sense, i.e. values that can be fed to @racket[parameterize].
@defparam[setup:current-server-port port integer?]{
A parameter that sets the HTTP port for the project server. Initialized to @racket[setup:default-default-port].}
A parameter that sets the HTTP port for the project server. Initialized to @racket[setup:default-project-server-port].}
@defparam[setup:current-project-root port path?]{
@ -68,7 +68,7 @@ Of course, you can restore the defaults simply by removing these defined values
These values are each equipped with a corresponding @racket[setup:]@racket[_name] function that will return the value loaded from the @racket[setup] submodule (if @racket[_name] was defined there), otherwise it returns the original value for @racket[setup:]@racket[_name]. For instance, @racket[setup:default-command-char] will always be @litchar{◊}, but in the example above, @racket[setup:command-char] would return @litchar{🎸}.
@defoverridable[default-port integer?]{
@defoverridable[project-server-port integer?]{
Determines the default HTTP port for the project server. Initialized to @racket[8080].}
@ -106,7 +106,7 @@ File extensions for Pollen source files, initialized to the following values:
@defoverridable[decodable-extensions (listof symbol?)]{File extensions that are eligible for decoding.}
@defoverridable[default-pagetree string?]{Pagetree that Pollen dashboard loads by default in each directory. Initialized to @filepath{index.ptree}.}
@defoverridable[main-pagetree string?]{Pagetree that Pollen dashboard loads by default in each directory. Initialized to @filepath{index.ptree}.}
@defoverridable[pagetree-root-node symbol?]{Name of the root node in a decoded pagetree. It's ignored by the code, so its only role is to clue you in that you're looking at something that came out of the pagetree decoder. Initialized to @code{'pagetree-root}.}
@ -124,7 +124,7 @@ File extensions for Pollen source files, initialized to the following values:
@defoverridable[command-char char?]{The magic character that indicates a Pollen command, function, or variable. Initialized to @racket[#\◊].}
@defoverridable[default-template-prefix string?]{Prefix of the default template. Initialized to @code{"template"}.}
@defoverridable[template-prefix string?]{Prefix of the default template. Initialized to @code{"template"}.}
@defoverridable[fallback-template-prefix string?]{Used to generate the name of the fallback template (i.e., the template used to render a Pollen markup file when no other template can be found). Prefix is combined with the output suffix of the source file. Initialized to @code{"fallback"}.}

@ -234,7 +234,7 @@ Though port @tt{8080} is the default, you can start the project server on any po
> raco pollen start /path/to/tutorial 8088
}
@margin-note{You can also change the default port by altering @racket[setup:default-default-port], or parameterizing it with @racket[setup:current-server-port].}
@margin-note{You can also change the default port by altering @racket[setup:default-project-server-port], or parameterizing it with @racket[setup:current-server-port].}
Note that when you pass a port argument, you also have to pass a path argument. (Without it, you'll get an error, as illustrated below.) If you want the project server to start in the current directory, you can use the usual @litchar{.} shorthand:

@ -62,14 +62,14 @@
(define-settable decodable-extensions (list (markup-source-ext) (pagetree-source-ext)))
(define-settable default-pagetree (format "index.~a" (pagetree-source-ext)))
(define-settable main-pagetree (format "index.~a" (pagetree-source-ext)))
(define-settable pagetree-root-node 'pagetree-root)
(define-settable main-root-node 'root)
(define-settable command-char #\◊)
(define-settable template-command-char #\∂)
(define-settable default-template-prefix "template")
(define-settable template-prefix "template")
(define-settable fallback-template-prefix "fallback")
(define-settable template-meta-key "template")
@ -88,9 +88,9 @@
(define-settable paths-excluded-from-dashboard (map string->path (list "poldash.css" "compiled")))
(define-settable default-port 8080)
(define-settable project-server-port 8080)
(define current-server-port (make-parameter (default-port)))
(define current-server-port (make-parameter (project-server-port)))
(define-settable dashboard-css "poldash.css")

Loading…
Cancel
Save