add some missing docs

This commit is contained in:
Robby Findler 2016-11-24 12:12:04 -06:00
parent a115076fe4
commit bda7409367
4 changed files with 39 additions and 3 deletions

View File

@ -51,3 +51,11 @@ up an image.
to short-circuit the full check. (The full check draws the two images
and then compares the resulting bitmaps.)
}
@defthing[snip-class (is-a?/c snip-class%)]{
The snipclass used by images (which are @racket[snip%]s) created by this library.
Not all @racket[image?] values are @racket[snip%]s, but those that are use this as
their @racket[snip-class%].
}

View File

@ -21,6 +21,7 @@
@include-section["image-core.scrbl"]
@include-section["matrix-snip.scrbl"]
@include-section["snip-canvas.scrbl"]
@include-section["syntax-browser.scrbl"]
@include-section["tex-table.scrbl"]
@include-section["terminal.scrbl"]

View File

@ -0,0 +1,20 @@
#lang scribble/doc
@(require "common.rkt" (for-label mrlib/image-core))
@title{Syntax Browser}
@defmodule[mrlib/syntax-browser]
@defproc[(render-syntax/snip [stx syntax?]) (is-a?/c snip%)]{
Constructs a @racket[snip%] object that displays information
about @racket[stx].
}
@defproc[(render-syntax/window [stx syntax?]) void?]{ Uses
@racket[render-syntax/snip]'s result, together with a frame
and editor-canvas to show @racket[stx].
}
@defthing[snip-class (is-a?/c snip-class%)]{
The snipclass used by the result of @racket[render-syntax/snip].
}

View File

@ -11,13 +11,20 @@ needed to really make this work:
racket/class
racket/gui/base
racket/match
(prefix-in - racket/base)
racket/contract
(prefix-in : racket/base)
"include-bitmap.rkt")
(define orig-output-port (current-output-port))
(define (oprintf . args) (apply fprintf orig-output-port args))
(provide render-syntax/snip render-syntax/window snip-class)
(provide
(contract-out
[render-syntax/snip
(-> syntax? (is-a?/c snip%))]
[render-syntax/window
(-> syntax? void?)])
snip-class)
;; this is doing the same thing as the class in
;; the framework by the same name, but we don't
@ -47,7 +54,7 @@ needed to really make this work:
(class snip-class%
(define/override (read stream)
(make-object syntax-snip%
(unmarshall-syntax (-read (open-input-bytes (send stream get-bytes))))))
(unmarshall-syntax (:read (open-input-bytes (send stream get-bytes))))))
(super-new)))
(define snip-class (new syntax-snipclass%))