14 Module reference
14.1 Cache
14.2 Core
14.3 Decode
14.4 File
14.5 Pagetree
14.6 Render
14.7 Setup
14.8 Tag
14.9 Template
14.10 Top
On this page:
14.7.1 How to override setup values
14.7.2 Values
setup:  project-server-port
default-project-server-port
setup:  main-pagetree
default-main-pagetree
setup:  main-root-node
default-main-root-node
setup:  block-tags
default-block-tags
setup:  command-char
default-command-char
setup:  newline
default-newline
setup:  linebreak-separator
default-linebreak-separator
setup:  paragraph-separator
default-paragraph-separator
setup:  render-cache-active
default-render-cache-active
setup:  compile-cache-active
default-compile-cache-active
setup:  compile-cache-max-size
default-compile-cache-max-size
setup:  cache-watchlist
default-cache-watchlist
setup:  envvar-watchlist
default-envvar-watchlist
setup:  publish-directory
default-publish-directory
setup:  unpublished-path?
default-unpublished-path?
setup:  omitted-path?
default-omitted-path?
setup:  extra-published-path?
default-extra-published-path?
setup:  extra-path?
default-extra-path?
setup:  poly-targets
default-poly-targets
setup:  index-pages
default-index-pages
setup:  trim-whitespace?
default-trim-whitespace?
setup:  allow-unbound-ids?
default-allow-unbound-ids?
setup:  external-renderer
default-external-renderer
14.7.3 Parameters
current-server-port
current-project-root
current-server-extras-path
current-poly-target
8.12

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:

  1. Within this file, create a submodule called setup.

  2. Within this submodule, use define to make a variable with the same name as the one in pollen/setup, but without the setup: prefix.

  3. Assign it whatever value you like.

  4. Repeat as needed.

  5. (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:

"pollen.rkt"
#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🔗ℹ

Determines the default HTTP port for the project server.

procedure

(setup:main-pagetree)  string?

value

default-main-pagetree : string? = "index.ptree"

Pagetree that Pollen dashboard loads by default in each directory.

procedure

(setup:main-root-node)  symbol?

value

default-main-root-node : symbol? = 'root

Name of the root node in a decoded doc.

procedure

(setup:block-tags)  (listof symbol?)

value

default-block-tags : (listof symbol?) = '(see below)

Tags that are treated as blocks by block-txexpr?. Initialized to the block-level elements in HTML5, namely:

address article aside blockquote body canvas dd div dl dt 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

(setup:command-char)  char?

value

default-command-char : char? = #\◊

The magic character that indicates a Pollen command, function, or variable.

Default separators used in decoding.

Whether the render cache, which speeds up interactive sessions by reusing rendered versions of Pollen output files, is active.

Whether the compile cache, which speeds up interactive sessions by saving compiled versions of Pollen source files, is active.

Maximum size of the compile cache.

List of extra files that the cache (= render cache + compile cache, collectively) watches during a project-server session. If one of the files on the watchlist changes, the cache is invalidated (just as it would be if "pollen.rkt" changed).

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:

"pollen.rkt"
(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.

List of extra environment variables that are used in cache keys. Separate caches will be maintained for each distinct value of an environment variable. The POLLEN environment variable is always used, regardless of how this value is set.

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.

Default target for raco pollen publish. A complete path is used as is; a relative path is published to the desktop..

Added in version 1.1 of package pollen.

procedure

(setup:unpublished-path?)  (path? . -> . boolean?)

value

default-unpublished-path? : (path? . -> . boolean?)

 = (λ (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)

Predicate that determines whether a path is omitted from raco pollen render and raco pollen publish operations. If the predicate evaluated to #t, then the path is omitted.

Added in version 1.1 of package pollen.

procedure

(setup:extra-published-path?)  (path? . -> . boolean?)

value

default-extra-published-path? : (path? . -> . boolean?)

 = (λ (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)

Predicate that determines if path is rendered & published, overriding (setup:omitted-path?) above, and Pollen’s default publish settings. For instance, Pollen automatically omits files with a .rkt extension. If you wanted to force a .rkt file to be published, you could include it here.

Added in version 1.1 of package pollen.

procedure

(setup:poly-targets)  (listof symbol?)

value

default-poly-targets : (listof symbol?) = '(html)

List of symbols that denotes the possible targets of a 'poly source file.

procedure

(setup:index-pages)  (listof string?)

value

default-index-pages : (listof string?) = '("index.html")

List of strings that the project server will use as directory default pages, in order of priority. Has no effect on command-line rendering operations. Also has no effect on your live web server (usually that’s a setting you need to make in an .htaccess configuration file). But with this setting, you can simulate the behavior of your live server, so that internal index-page URLs work correctly.

Predicate that controls whether the Pollen source reader trims whitespace from the beginning of a doc export. You might set this to #false if you’re using Pollen as a preprocessor for another programming language and you want to preserve leading whitespace accurately.

Added in version 1.5 of package pollen.

Predicate that controls whether Pollen converts unbound identifiers into default tags by altering the behavior of #%top in pollen/top.

Added in version 2.0 of package pollen.

A module path and identifier (suitable for use with dynamic-require) that provide a function for Pollen to call instead of render when rendering files needed by the project server or when running raco pollen render. The function must accept the same arguments as render-to-file and should return the final output as a string or byte string. Pollen will always write this return value out to the output file for you.

Setting this value gives you full control over (and responsibility for) how Pollen converts the compiled doc and metas from source files into their final output. Your renderer should be able to handle any of Pollen’s source formats or utility formats. The operation of Pollen’s render function is not affected by setting this value, so your renderer can use it as a fallback.

Added in version 3.2 of package pollen.

14.7.3 Parameters🔗ℹ

I mean parameters in the Racket sense, i.e. values that can be fed to parameterize.

A parameter that sets the HTTP port for the project server.

parameter

(current-project-root)  path?

(current-project-root path)  void?
  path : path?
A parameter that holds the root directory of the current project (e.g., the directory where you launched raco pollen start).

parameter

(current-server-extras-path)  path?

(current-server-extras-path dir)  void?
  dir : path?
 = #f
A parameter that reports the path to the directory of support files for the project server.

parameter

(current-poly-target)  symbol?

(current-poly-target target)  void?
  target : symbol?
 = 'html
A parameter that reports the current rendering target for poly source files.