From 631ff162ca6833e7f2c8e5e179e784ad30cb0344 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 1 Nov 2018 22:44:19 -0700 Subject: [PATCH] refac --- pollen/private/main-base.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pollen/private/main-base.rkt b/pollen/private/main-base.rkt index 1cee0eb..7765ac1 100644 --- a/pollen/private/main-base.rkt +++ b/pollen/private/main-base.rkt @@ -28,7 +28,9 @@ (define (strip-leading-newlines doc) ;; drop leading newlines, as they're often the result of `defines` and `requires` - (dropf doc (λ (ln) (member ln (list (setup:newline) ""))))) + (if (setup:trim-whitespace?) + (dropf doc (λ (ln) (member ln (list (setup:newline) "")))) + doc)) (define-syntax (pollen-module-begin stx) (syntax-case stx () @@ -43,14 +45,14 @@ DOC-ID ; positional arg for doclang-raw: name of export (λ (xs) (define proc (make-parse-proc PARSER-MODE ROOT-ID)) - (define trimmed-xs ((if (setup:trim-whitespace?) strip-leading-newlines values) xs)) + (define trimmed-xs (strip-leading-newlines xs)) (define doc-elements (splice trimmed-xs (setup:splicing-tag))) (proc doc-elements)) ; positional arg for doclang-raw: post-processor (module META-MOD-ID racket/base (provide METAS-ID) (define METAS-ID META-HASH)) (require pollen/top pollen/core pollen/setup (submod "." META-MOD-ID)) - (provide (all-defined-out) METAS-ID DOC-ID) + (provide (all-defined-out) METAS-ID DOC-ID doc+metas) (define prev-metas (current-metas)) (and (current-metas METAS-ID) "") ; because empty strings get stripped, voids don't (begin . EXPRS)