adjust para decoding to better work with @ notation

svn: r16220
This commit is contained in:
Matthew Flatt 2009-10-02 19:44:10 +00:00
parent 4e35bda756
commit 83f9c99cf1
2 changed files with 22 additions and 3 deletions

View File

@ -120,7 +120,10 @@ among the @scheme[element]s are decoded by performing the following
substitutions: @litchar{---} @d=> @litchar["\u2014"], @litchar{--}
@d=> @litchar["\u2013"], @litchar{``} @d=> @litchar["\u201C"],
@litchar{''} @d=> @litchar["\u201D"], @litchar{'} @d=>
@litchar["\u2019"].
@litchar["\u2019"]. In addition, to better work with
@schememodname[at-exp] notation, if an @scheme[element] is @scheme["\n"],
then it is dropped along with any spaces at the start of the next
element.
Strings are split at spaces for word-wrapping to fit the page, and a
space is added between elements. If a string element starts with one

View File

@ -669,7 +669,7 @@
[else vl-append])
width
(if decode?
(map decode s)
(decode s)
s))])
(if fill?
((case align
@ -684,7 +684,23 @@
(define (decode s)
(let loop ([s s])
(cond
[(list? s) (map loop s)]
[(list? s)
(map
decode
;; Remove "\n", and also cancel extra spaces after "\n":
(let loop ([s s])
(cond
[(null? s) null]
[(equal? (car s) "\n")
(let nloop ([s (cdr s)])
(if (and (pair? s)
(string? (car s)))
(let ([a (regexp-replace #rx"^ +" (car s) "")])
(if (string=? a "")
(nloop (cdr s))
(loop (cons a (cdr s)))))
(loop s)))]
[else (cons (car s) (loop (cdr s)))])))]
[(not (string? s)) s]
[(regexp-match-positions #rx"---" s)
=> (lambda (m)