pull/9/head
Matthew Butterick 12 years ago
parent b5e7960338
commit d58260dbc8

@ -14,15 +14,16 @@
(module+ test (module+ test
(check-equal? (meta-proc '(meta "key" "value")) '(meta ((name "key")(content "value"))))) (check-equal? (meta-proc '(meta "key" "value")) '(meta ((name "key")(content "value")))))
;; is x a paragraph break?
;; how a paragraph break is denoted: a string of two or more newlines
(define/contract (paragraph-break? x) (define/contract (paragraph-break? x)
(any/c . -> . boolean?) (any/c . -> . boolean?)
;; paragraph break = a string of two or more newlines
(and (string? x) (>= (len x) 2) (equal? x (make-string (len x) #\newline)))) (and (string? x) (>= (len x) 2) (equal? x (make-string (len x) #\newline))))
(module+ test (module+ test
(check-false (paragraph-break? "foo")) (check-false (paragraph-break? "foo"))
(check-false (paragraph-break? "\n")) (check-false (paragraph-break? "\n"))
(check-false (paragraph-break? "\n \n"))
(check-true (paragraph-break? "\n\n")) (check-true (paragraph-break? "\n\n"))
(check-true (paragraph-break? "\n\n\n"))) (check-true (paragraph-break? "\n\n\n")))

Loading…
Cancel
Save