document & test `trim-whitespace?`

dev-stylish-5
Matthew Butterick 6 years ago
parent 242174d482
commit aa743905a2

@ -1 +1 @@
1537996006
1540870700

@ -149,7 +149,9 @@ If the cache can't find a certain file on the watchlist, it will be ignored. The
@defoverridable[index-pages (listof string?)]{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 @tt{.htaccess} configuration file).} But with this setting, you can simulate the behavior of your live server, so that internal index-page URLs work correctly.
@defoverridable[trim-whitespace? boolean?)]{Predicate that controls whether the Pollen source reader trims whitespace from the beginning of a @racket[doc] export. You might set this to @racket[#false] if you're using Pollen as a preprocessor for another programming language and you want to preserve leading whitespace accurately.
@pollen-history[#:added "1.5"]}
@section{Parameters}

@ -0,0 +1,7 @@
#lang racket/base
(require pollen/setup)
(provide (all-defined-out))
(module setup racket/base
(provide (all-defined-out))
(define trim-whitespace? #false))

@ -0,0 +1,11 @@
#lang at-exp racket/base
(require rackunit pollen/setup racket/runtime-path pollen/render)
;; define-runtime-path only allowed at top level
(define-runtime-path whitespace-dir "data/whitespace")
(define-runtime-path whitespace-source "data/whitespace/whitespace-test.txt.pp")
(parameterize ([current-directory whitespace-dir]
[current-project-root whitespace-dir]
[current-output-port (open-output-string)])
(check-equal? (render whitespace-source) "\n\n\n\n\n\n\n\n\none"))
Loading…
Cancel
Save