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/predicates.rkt

34 lines
885 B
Racket

#lang racket/base
11 years ago
(require racket/contract racket/match racket/set)
11 years ago
(require chirp/html sugar txexpr)
11 years ago
(require "world.rkt" "file-tools.rkt" "debug.rkt")
11 years ago
(provide (all-from-out "file-tools.rkt"))
;; test for well-formed meta
11 years ago
(define+provide/contract (meta-xexpr? x)
(any/c . -> . boolean?)
(match x
[`(meta ,(? string? key) ,(? string? value)) #t]
[else #f]))
;; initial set of block tags: from html
11 years ago
(define project-block-tags block-tags)
11 years ago
(define+provide/contract (append-block-tag tag)
(txexpr-tag? . -> . void?)
11 years ago
(set! project-block-tags (cons tag project-block-tags)))
;; is the txexpr a block element (as opposed to inline)
;; tags are inline unless they're registered as block tags.
11 years ago
(define+provide/contract (block-xexpr? x)
(any/c . -> . boolean?)
;; (car x) = shorthand for tag of xexpr
((txexpr? x) . and . ((car x) . in? . project-block-tags)))
11 years ago