pull/1/head
Matthew Butterick 11 years ago
parent f1fb17dd02
commit c6c375b02a

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require racket/string racket/list) (require racket/string racket/list)
(require sugar/string sugar/coerce) (require sugar/string sugar/coercion/values)
(provide (all-defined-out)) (provide (all-defined-out))

@ -1,3 +1,3 @@
#lang info #lang info
(define collection "css-tools") (define collection "chirp")
(define scribblings '(("scribblings/css-tools.scrbl" ()))) (define scribblings '(("scribblings/chirp.scrbl" ())))

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require "core.rkt" racket/match) (require "core.rkt" racket/match sugar/define/contract sugar/container sugar/coercion/values racket/string racket/list)
(define/contract (css-unit? x) (define+provide/contract (css-unit? x)
(any/c . -> . boolean?) (any/c . -> . boolean?)
(x . in? . '("%" "in" "cm" "mm" "em" "ex" "pt" "pc" "px" "rem"))) (x . in? . '("%" "in" "cm" "mm" "em" "ex" "pt" "pc" "px" "rem")))
@ -10,17 +10,17 @@
[(define write-proc [(define write-proc
(λ(x port mode) (display (format "~a~a" (cssq-num x) (cssq-unit x)) port)))]) (λ(x port mode) (display (format "~a~a" (cssq-num x) (cssq-unit x)) port)))])
(define/contract (cssqish? x) (define+provide/contract (cssqish? x)
(any/c . -> . boolean?) (any/c . -> . boolean?)
(->boolean (or (cssq? x) (string? x)))) (->boolean (or (cssq? x) (string? x))))
(define/contract (string->unit x) (define+provide/contract (string->unit x)
(string? . -> . css-unit?) (string? . -> . css-unit?)
(if (css-unit? x) (if (css-unit? x)
x x
(error 'string->unit "'~a' not a valid css unit" x))) (error 'string->unit "'~a' not a valid css unit" x)))
(define/contract (cssqish->cssq x) (define+provide/contract (cssqish->cssq x)
(cssqish? . -> . cssq?) (cssqish? . -> . cssq?)
(cond (cond
[(cssq? x) x] [(cssq? x) x]
@ -34,7 +34,7 @@
(list (string->number (first pieces)) (list (string->number (first pieces))
(string->unit (second pieces))))))])) (string->unit (second pieces))))))]))
(define/contract (css-math-op op left right) (define+provide/contract (css-math-op op left right)
(procedure? cssqish? cssqish? . -> . cssq?) (procedure? cssqish? cssqish? . -> . cssq?)
(let ([left (cssqish->cssq left)] (let ([left (cssqish->cssq left)]
[right (cssqish->cssq right)]) [right (cssqish->cssq right)])

@ -3,34 +3,34 @@
@(require scribble/eval (for-label racket "../main.rkt")) @(require scribble/eval (for-label racket "../main.rkt"))
@(define my-eval (make-base-eval)) @(define my-eval (make-base-eval))
@(my-eval `(require css-tools)) @(my-eval `(require chirp))
@title{css-tools} @title{chirp}
@author[(author+email "Matthew Butterick" "mb@mbtype.com")] @author[(author+email "Matthew Butterick" "mb@mbtype.com")]
A collection of little functions that help make Racket code more readable. Chirp = CSS & HTML Racket preprocessor.
@section{Installation & updates} @section{Installation & updates}
At the command line: At the command line:
@verbatim{raco pkg install css-tools} @verbatim{raco pkg install chirp}
After that, you can update the package from the command line: After that, you can update the package from the command line:
@verbatim{raco pkg update css-tools} @verbatim{raco pkg update chirp}
@section{Interface} @section{Interface}
@defmodule[css-tools] @defmodule[chirp]
Hello css-tools. Hello chirp.
@section{License & source code} @section{License & source code}
This module is licensed under the LGPL. This module is licensed under the LGPL.
Source repository at @link["http://github.com/mbutterick/css-tools"]{http://github.com/mbutterick/css-tools}. Suggestions & corrections welcome. Source repository at @link["http://github.com/mbutterick/chirp"]{http://github.com/mbutterick/chirp}. Suggestions & corrections welcome.
Loading…
Cancel
Save