From 818981a308a1a3ead2f783060e8dd405ad984450 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 4 Jun 2014 13:34:18 +0100 Subject: [PATCH] scribble/decode: document treatment of whitespace by `decode-content` original commit: 02d53d29fb4ab074ebaa0036bf27f10a949069bb --- .../scribblings/scribble/decode.scrbl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/decode.scrbl b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/decode.scrbl index 0bec1917..3ce70c5a 100644 --- a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/decode.scrbl +++ b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/decode.scrbl @@ -142,8 +142,15 @@ Decodes a paragraph using @racket[decode-content] to decode @defproc[(decode-content [lst (listof pre-content?)]) list?]{ -Decodes @tech{content}. Lists and splices in @racket[lst] are -flattened into the list. Plain strings are @elemref['(decode +Decodes @tech{content}. Elements at the start of the list that are +whitespace (according to @racket[whitespace?]) are dropped. +@margin-note*{Dropping whitespace in nested lists and splices was a poor +implementation choice that is left in place for compatibility. To protect +against it, you can exploit the similarly unfortunate fact that an empty +list does not count as whitespace.} +Lists and splices in @racket[lst] are +flattened into the list, similarly dropping leading whitespace. +Plain strings are @elemref['(decode "rules")]{decoded}; non-string, non-list @tech{content} is included in the result as-is.} @@ -159,9 +166,9 @@ An alias for @racket[decode-content].} @tech{content}.} -@defproc[(whitespace? [s string?]) boolean?]{ +@defproc[(whitespace? [v any/c]) boolean?]{ -Returns @racket[#t] if @racket[s] contains only whitespace, @racket[#f] +Returns @racket[#t] if @racket[v] is a string that contains only whitespace, @racket[#f] otherwise.}