You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pollen/tests/requires/include-me.rkt

48 lines
1.4 KiB
Racket

12 years ago
#lang racket/base
(require racket/contract racket/list racket/match)
(require (planet mb/pollen/tools) (planet mb/pollen/decode)
(planet mb/pollen/library/decode-tools))
12 years ago
(provide (all-defined-out))
12 years ago
(module+ test (require rackunit))
12 years ago
12 years ago
;; register custom block tags
(register-block-tag 'bloq)
(register-block-tag 'fooble)
12 years ago
;; detect paragraphs
;; todo: unit tests
(define/contract (xexpr-elements-proc elements)
(xexpr-elements? . -> . xexpr-elements?)
(let ([elements (prep-paragraph-flow elements)])
(if (ormap paragraph-break? elements) ; need this condition to prevent infinite recursion
(map wrap-paragraph (splitf-at* elements paragraph-break?)) ; split into ¶¶
elements)))
12 years ago
12 years ago
(define/contract (block-xexpr-proc bx)
(tagged-xexpr? . -> . tagged-xexpr?)
12 years ago
(wrap-hanging-quotes (nonbreaking-last-space bx)))
(define (string-proc str)
(string? . -> . string?)
(typogrify str))
12 years ago
(define/contract (root . items)
(() #:rest (listof xexpr-element?) . ->* . tagged-xexpr?)
12 years ago
(decode (cons 'root-function items)
; #:exclude-xexpr-tags 'em
; #:xexpr-tag-proc [xexpr-tag-proc (λ(x)x)]
; #:xexpr-attr-proc [xexpr-attr-proc (λ(x)x)]
#:xexpr-elements-proc xexpr-elements-proc
12 years ago
#:block-xexpr-proc block-xexpr-proc
; #:inline-xexpr-proc [inline-xexpr-proc (λ(x)x)]
#:string-proc string-proc))
12 years ago
12 years ago
(define foo "bar")