adjust scribble/lp docs
svn: r13859
This commit is contained in:
parent
a4078d5295
commit
db70d62ca7
|
@ -58,7 +58,7 @@ To avoid collisions with future additions to Scribble, start your
|
||||||
style name with an uppercase letter that is not @litchar{S}. An
|
style name with an uppercase letter that is not @litchar{S}. An
|
||||||
uppercase letter helps to avoid collisions with macros defined by
|
uppercase letter helps to avoid collisions with macros defined by
|
||||||
Latex packages, and future styles needed by @scheme[scribble/manual]
|
Latex packages, and future styles needed by @scheme[scribble/manual]
|
||||||
will start with @litchar{s}.
|
will start with @litchar{S}.
|
||||||
|
|
||||||
For example, a Scribble document
|
For example, a Scribble document
|
||||||
|
|
||||||
|
|
4
collects/scribblings/scribble/lp-ex-doc.scrbl
Normal file
4
collects/scribblings/scribble/lp-ex-doc.scrbl
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#lang scribble/doc
|
||||||
|
@(require scribble/lp-include)
|
||||||
|
|
||||||
|
@lp-include["lp-ex.ss"]
|
|
@ -1,4 +1,5 @@
|
||||||
#lang scribble/lp
|
#lang scribble/lp
|
||||||
|
|
||||||
Literate programs have chunks of code, like this one:
|
Literate programs have chunks of code, like this one:
|
||||||
|
|
||||||
@chunk[<f>
|
@chunk[<f>
|
||||||
|
|
4
collects/scribblings/scribble/lp.css
Normal file
4
collects/scribblings/scribble/lp.css
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.LPBoxed {
|
||||||
|
padding: 1ex;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
}
|
|
@ -1,26 +1,34 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require scribble/manual scheme/runtime-path scribble/lp-include)
|
@(require scribble/manual
|
||||||
|
scribble/struct
|
||||||
|
scheme/runtime-path
|
||||||
|
(prefix-in lp-ex: "lp-ex-doc.scrbl")
|
||||||
|
"utils.ss"
|
||||||
|
(for-label scribble/lp-include
|
||||||
|
(only-in scribble/private/lp chunk)))
|
||||||
|
|
||||||
@title[#:tag "lp"]{Literate Programming}
|
@title[#:tag "lp" #:style `((css "lp.css") (tex "lp.tex")) ]{Literate Programming}
|
||||||
|
|
||||||
Programs written using @schememodname[scribble/lp] are simultaneously
|
Programs written using @schememodname[scribble/lp] are simultaneously
|
||||||
two things: a program, and a document describing the program.
|
two things: a program and a document describing the program.
|
||||||
|
|
||||||
Programs in @schememodname[scribble/lp] are viewed in two different
|
Programs in @schememodname[scribble/lp] are viewed in two different
|
||||||
ways, either by running the program directly, or by including it with
|
ways, either by running the program directly or by including it with
|
||||||
@scheme[include-lp]. When running the program, all of the
|
@scheme[lp-include]. When running the program, all of the
|
||||||
@scheme[chunk] expressions are collected and stitched together into a
|
@scheme[chunk] expressions are collected and stitched together into a
|
||||||
program and the rest of the module is discarded. When using
|
program, and the rest of the module is discarded. When using
|
||||||
@scheme[include-lp], the entire contents of the module are preserved
|
@scheme[lp-include], the entire contents of the module are preserved
|
||||||
and are treated like an ordinary Scribble document, where
|
and are treated like an ordinary Scribble document, where
|
||||||
@scheme[chunk]s are typeset in a manner similar to @scheme[codeblock].
|
@scheme[chunk]s are typeset in a manner similar to @scheme[codeblock].
|
||||||
|
|
||||||
@(define-runtime-path lp-ex "lp-ex.ss")
|
@(define-runtime-path lp-ex "lp-ex.ss")
|
||||||
|
|
||||||
For example, consider this program:
|
For example, consider this program:
|
||||||
|
|
||||||
@(call-with-input-file lp-ex
|
@(call-with-input-file lp-ex
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(verbatim
|
(verbatim
|
||||||
|
#:indent 2
|
||||||
(apply
|
(apply
|
||||||
string-append
|
string-append
|
||||||
(let loop ()
|
(let loop ()
|
||||||
|
@ -36,21 +44,30 @@ function @scheme[f] that squares its argument, and the documentation
|
||||||
is ignored. When it is included with @scheme[lp-include], it looks
|
is ignored. When it is included with @scheme[lp-include], it looks
|
||||||
like this:
|
like this:
|
||||||
|
|
||||||
@lp-include["lp-ex.ss"]
|
@(make-blockquote
|
||||||
|
"LPBoxed"
|
||||||
|
(flow-paragraphs (part-flow lp-ex:doc)))
|
||||||
|
|
||||||
@section{@schememodname[scribble/lp] language}
|
@section{@schememodname[scribble/lp] Language}
|
||||||
|
|
||||||
@defmodulelang[scribble/lp]{This is a Scribble's core support for Literate Programming.}
|
@declare-exporting[scribble/private/lp]
|
||||||
|
|
||||||
@defform[(chunk <id> expressions ...)]{
|
@defmodulelang*/no-declare[(scribble/lp)]{The
|
||||||
Introduces a chunk, binding @scheme[<id>] for use in other chunks.
|
@schememodname[scribble/lp] language provides core support for
|
||||||
|
literate programming.}
|
||||||
|
|
||||||
If @scheme[<id>] is @tt{<*>}, then this chunk is used as the main
|
@defform[(chunk id form ...)]{
|
||||||
chunk in the file. If @tt{<*>} is never used, then the first chunk
|
|
||||||
|
Introduces a chunk, binding @scheme[id] for use in other
|
||||||
|
chunks. Normally, @scheme[id] starts with @litchar{<} and ends with
|
||||||
|
@litchar{>}.
|
||||||
|
|
||||||
|
If @scheme[id] is @schemeidfont{<*>}, then this chunk is used as the main
|
||||||
|
chunk in the file. If @schemeidfont{<*>} is never used, then the first chunk
|
||||||
in the file is treated as the main chunk.
|
in the file is treated as the main chunk.
|
||||||
}
|
}
|
||||||
|
|
||||||
@section{@schememodname[scribble/lp-include] module}
|
@section{@schememodname[scribble/lp-include] Module}
|
||||||
|
|
||||||
@defmodule[scribble/lp-include]{}
|
@defmodule[scribble/lp-include]{}
|
||||||
|
|
||||||
|
|
3
collects/scribblings/scribble/lp.tex
Normal file
3
collects/scribblings/scribble/lp.tex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
\usepackage{framed}
|
||||||
|
\newenvironment{LPBoxed}{\begin{framed}}{\end{framed}}
|
Loading…
Reference in New Issue
Block a user