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
setup:  main-pagetree
setup:  main-root-node
setup:  block-tags
setup:  command-char
setup:  newline
setup:  linebreak-separator
setup:  paragraph-separator
setup:  render-cache-active
setup:  compile-cache-active
setup:  compile-cache-max-size
setup:  cache-watchlist
setup:  envvar-watchlist
setup:  publish-directory
setup:  unpublished-path?
setup:  omitted-path?
setup:  extra-published-path?
setup:  extra-path?
setup:  poly-targets
setup:  index-pages
setup:  trim-whitespace?
setup:  allow-unbound-ids?
setup:  external-renderer
14.7.3 Parameters

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:

#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.


(setup:main-pagetree)  string?


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

Pagetree that Pollen dashboard loads by default in each directory.


(setup:main-root-node)  symbol?


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

Name of the root node in a decoded doc.


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


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.


(setup:command-char)  char?


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:

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


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


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

 = (λ (path) #f)

Changed in version 1.1 of package pollen: Deprecated. Please use setup:omitted-path?.


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


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.


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


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

 = (λ (path) #f)

Changed in version 1.1 of package pollen: Deprecated. Please use setup:extra-path?.


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


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.


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


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

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


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


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.


(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).


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


(current-poly-target)  symbol?

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