Adds a #:part option to `chunk', to control how it's displayed.
svn: r13654
This commit is contained in:
parent
9d06dd7f57
commit
6c7a0aae51
|
@ -15,21 +15,16 @@ Games.
|
|||
- literate-reader.ss: the reader used for chat-noir-literate.ss to
|
||||
put it into the literate-lang.ss.
|
||||
|
||||
Files that begin with "literate" are the files that need to move to a
|
||||
scribble library, if this experiment is successful.
|
||||
|
||||
Problems:
|
||||
|
||||
- the code is not hyperlinked in the scribble output-- this is due to
|
||||
the confusion about how the requires should work in the two modes.
|
||||
|
||||
- The char-noir-doc.ss file contains code that should move into
|
||||
scribble proper; ideally that file should just be (something like):
|
||||
|
||||
#lang scribble/doc
|
||||
@include-literate["chat-noir-literate.ss"]
|
||||
|
||||
and it should be built when setup-plt runs on this collection to
|
||||
build the documentation, ie, this file should eventually be merged
|
||||
together with ../scribblings/chat-noir.scrbl.
|
||||
|
||||
- @chunks in the TOC
|
||||
- The char-noir-doc.ss file should be built when setup-plt runs on
|
||||
this collection to build the documentation, ie, this file should
|
||||
eventually be merged together with ../scribblings/chat-noir.scrbl.
|
||||
|
||||
- hyperlink bound top-level identifiers to their bindings?
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
Chat Noir. What a game.
|
||||
|
||||
@chunk[<main>
|
||||
@chunk[#:part section <main>
|
||||
<init-junk>
|
||||
<data-definitions>
|
||||
<graph>
|
||||
|
|
|
@ -13,10 +13,15 @@
|
|||
;; of the same name
|
||||
(define chunk-number (make-free-identifier-mapping)))
|
||||
|
||||
;; define `chunk' as a macro that typesets the code
|
||||
;; This is the doc-view implementation of `chunk', see "literate-lang.ss" for
|
||||
;; the cide-view implementation. Defines `chunk' as a macro that typesets the
|
||||
;; contained code.
|
||||
(define-syntax (chunk stx)
|
||||
(syntax-case stx ()
|
||||
[(_ name expr ...)
|
||||
[(_ #:part #f name expr ...)
|
||||
#'(make-splice (list (bold (scheme name) " ::=")
|
||||
(schemeblock expr ...)))]
|
||||
[(_ #:part part-function name expr ...)
|
||||
(let ([n (add1 (free-identifier-mapping-get
|
||||
chunk-number #'name (lambda () 0)))])
|
||||
(free-identifier-mapping-put! chunk-number #'name n)
|
||||
|
@ -25,8 +30,9 @@
|
|||
[(more ...) (if (n . > . 1)
|
||||
#`((subscript #,(format "~a" n)))
|
||||
#`())])
|
||||
#'(make-splice (list (subsection #:tag tag (scheme name) more ...)
|
||||
(schemeblock expr ...)))))]))
|
||||
#'(make-splice (list (part-function #:tag tag (scheme name) more ...)
|
||||
(schemeblock expr ...)))))]
|
||||
[(_ name expr ...) #'(chunk #:part subsection name expr ...)]))
|
||||
|
||||
;; HACK: provide a fake `module', which makes it possible to include a module
|
||||
;; and get only its code in.
|
||||
|
|
|
@ -25,8 +25,14 @@
|
|||
chunks id
|
||||
`(,@(mapping-get chunks id) ,@(map syntax-local-introduce exprs)))))
|
||||
|
||||
;; This is the code-view implementation of `chunk', see
|
||||
;; "literate-doc-wrapper.ss" for the doc-view implementation. Defines
|
||||
;; `chunk' as a macro that collects the code to be later reassembled
|
||||
;; by `tangle'.
|
||||
(define-syntax (chunk stx)
|
||||
(syntax-case stx ()
|
||||
;; no use for the part function here
|
||||
[(_ #:part part-function name expr ...) (chunk name expr ...)]
|
||||
[(_ name expr ...)
|
||||
(cond [(not (identifier? #'name))
|
||||
(raise-syntax-error #f "expected a chunk name" stx #'name)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user