14.7 Setup
(require pollen/setup) | package: pollen |
14.7.1 How to override setup values
The values below can be changed by overriding them in your "pollen.rkt" source file:
Within this file, create a submodule called setup.
Within this submodule, use define to make a variable with the same name as the one in pollen/setup, but without the setup: prefix.
Assign it whatever value you like.
Repeat as needed.
(Don’t forget to provide the variables from within your setup submodule.)
When Pollen runs, these definitions will supersede those in pollen/setup.
For instance, suppose you wanted the main export of every Pollen source file to be called van-halen rather than doc, the extension of Pollen markup files to be .rock rather than .pm, and the command character to be 🎸 instead of ◊. Your "pollen.rkt" would look like this:
#lang racket/base ;; ... the usual definitions and tag functions ... (module setup racket/base (provide (all-defined-out)) (define main-export 'van-halen) (define markup-source-ext 'rock) (define command-char #\🎸))
Of course, you can restore the defaults simply by removing these defined values from "pollen.rkt".
Every setup:name function will resolve the current value of that variable: it will return the value from the setup submodule (if name was defined there), otherwise it will return the default value (which is directly available from default-name). For instance, default-command-char will always be ◊, but in the example above, (setup:command-char) would return 🎸.
14.7.2 Values
procedure
value
default-project-server-port : integer? = 8080
procedure
value
default-main-export : symbol? = 'doc
procedure
value
default-meta-export : symbol? = 'metas
procedure
value
default-extension-escape-char : char? = #\_
procedure
value
default-preproc-source-ext : symbol? = 'pp
procedure
value
default-markup-source-ext : symbol? = 'pm
procedure
value
default-markdown-source-ext : symbol? = 'pmd
procedure
value
default-null-source-ext : symbol? = 'p
procedure
value
default-pagetree-source-ext : symbol? = 'ptree
procedure
value
default-template-source-ext : symbol? = 'pt
procedure
value
default-scribble-source-ext : symbol? = 'scrbl
procedure
value
default-main-pagetree : string? = "index.ptree"
procedure
value
default-main-root-node : symbol? = 'root
procedure
(setup:block-tags) → (listof symbol?)
value
address article aside blockquote body canvas dd div dl fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hgroup hr li main nav noscript ol output p pre section table tfoot ul video
... plus setup:main-root-node.
procedure
value
default-command-char : char? = #\◊
procedure
value
default-template-prefix : string? = "template"
procedure
(setup:newline) → string?
value
default-newline : string? = "\n"
procedure
value
default-linebreak-separator : string? = "\n"
procedure
value
default-paragraph-separator : string? = "\n\n"
procedure
value
default-render-cache-active : boolean? = #t
procedure
value
default-compile-cache-active : boolean? = #t
procedure
value
default-compile-cache-max-size : exact-positive-integer?
= 10485760
procedure
(setup:cache-watchlist) → (listof (or/c path? path-string?))
value
default-cache-watchlist : (listof (or/c path? path-string?))
= '()
If the cache can’t find a certain file on the watchlist, no error will arise. The file will simply be ignored. Therefore, to avoid unexpected behavior, the best policy is to use complete paths (or path strings). One way to generate a complete path to a local file is with define-runtime-path. Another way, if you’re using a module that’s already installed as part of a package, is with resolve-module-path:
(module+ setup (provide (all-defined-out)) (require racket/runtime-path syntax/modresolve) (define-runtime-path my-local-mod "my-module.rkt") (define my-installed-mod (resolve-module-path 'package/my-other-module)) (define cache-watchlist (list my-local-mod my-installed-mod)))
Added in version 1.4 of package pollen.
procedure
value
Both the names and the values of environment variables are case-insensitive, so "PUB" and "pub" and "pUb" are all treated the same.
Added in version 2.1 of package pollen.
procedure
→ (or/c path-string? path-for-some-system?)
value
: (or/c path-string? path-for-some-system?) = "publish"
Added in version 1.1 of package pollen.
procedure
(setup:unpublished-path?) → (path? . -> . boolean?)
value
= (λ (path) #f)
Changed in version 1.1 of package pollen: Deprecated. Please use setup:omitted-path?.
procedure
(setup:omitted-path?) → (path? . -> . boolean?)
value
default-omitted-path? : (path? . -> . boolean?) = (λ (path) #f)
Added in version 1.1 of package pollen.
procedure
(setup:extra-published-path?) → (path? . -> . boolean?)
value
= (λ (path) #f)
Changed in version 1.1 of package pollen: Deprecated. Please use setup:extra-path?.
procedure
(setup:extra-path?) → (path? . -> . boolean?)
value
default-extra-path? : (path? . -> . boolean?) = (λ (path) #f)
Added in version 1.1 of package pollen.
procedure
value
default-splicing-tag : symbol? = '@
procedure
value
default-poly-source-ext : symbol? = 'poly
procedure
(setup:poly-targets) → (listof symbol?)
value
procedure
(setup:index-pages) → (listof string?)
value
procedure
value
default-trim-whitespace? : boolean? = #t
Added in version 1.5 of package pollen.
procedure
value
default-allow-unbound-ids? : boolean? = #t
Added in version 2.0 of package pollen.
procedure
(setup:here-path-key) → 'symbol
value
14.7.3 Parameters
I mean parameters in the Racket sense, i.e. values that can be fed to parameterize.
parameter
(current-server-port port) → void? port : integer?
= default-project-server-port
parameter
(current-project-root path) → void? path : path?
parameter
(current-server-extras-path dir) → void? dir : path?
= #f
parameter
(current-poly-target target) → void? target : symbol?
= 'html