Compare commits
252 Commits
main
...
my-changes
Author | SHA1 | Date | |
---|---|---|---|
![]() |
050c02cabe | ||
![]() |
6c8253609f | ||
![]() |
6410ef2d43 | ||
![]() |
a7a8bcd015 | ||
![]() |
dd6cbe8650 | ||
![]() |
9631885dd5 | ||
![]() |
0161b69d82 | ||
![]() |
95400be0e5 | ||
![]() |
916c172317 | ||
![]() |
7d2cc65acd | ||
![]() |
cd98afdc41 | ||
![]() |
126f7b7212 | ||
![]() |
8f15b78615 | ||
![]() |
154ffe21b5 | ||
![]() |
7c7e1213d0 | ||
![]() |
8f21a9a26a | ||
![]() |
2767dd2c06 | ||
![]() |
c054b62765 | ||
![]() |
dc3254303d | ||
![]() |
b3f7015cba | ||
![]() |
0c93db954a | ||
![]() |
6802d4535f | ||
![]() |
69cf839355 | ||
![]() |
d7883e172f | ||
![]() |
d71ad4d18a | ||
![]() |
cbeee2d388 | ||
![]() |
cda7efa29c | ||
![]() |
cf0f2e3615 | ||
![]() |
3fb78d9435 | ||
![]() |
5415cca336 | ||
![]() |
a8813aa510 | ||
![]() |
ac2b976e40 | ||
![]() |
709977cccd | ||
![]() |
9415df28d5 | ||
![]() |
51639146dd | ||
![]() |
d28baaff80 | ||
![]() |
45817fa049 | ||
![]() |
5e6f3b2236 | ||
![]() |
f3da3670e0 | ||
![]() |
c62d008cfb | ||
![]() |
1f5419d10c | ||
![]() |
5ba2881996 | ||
![]() |
7f5a2b2648 | ||
![]() |
4b3d3a8296 | ||
![]() |
3d7ded8a33 | ||
![]() |
340c60ef54 | ||
![]() |
13798906ce | ||
![]() |
45093b8a6b | ||
![]() |
fd9b85aa10 | ||
![]() |
35de7c15b9 | ||
![]() |
9c985ca486 | ||
![]() |
66c4c50f47 | ||
![]() |
ed02550d1a | ||
![]() |
0fd2444634 | ||
![]() |
08d09d672e | ||
![]() |
84607f796c | ||
![]() |
aa5f0b767a | ||
![]() |
6a5dfdffb8 | ||
![]() |
6a8986f7c0 | ||
![]() |
9b1f9bc1d2 | ||
![]() |
8168a22492 | ||
![]() |
3c62d4cd5d | ||
![]() |
fb7106bc50 | ||
![]() |
b67f265b93 | ||
![]() |
e6d95a0367 | ||
![]() |
e25a02fd15 | ||
![]() |
f46083a40c | ||
![]() |
431bb95c7b | ||
![]() |
e44a5bb9f1 | ||
![]() |
97078b60ed | ||
![]() |
7da79dd62b | ||
![]() |
50862d0132 | ||
![]() |
d9b6f0eab2 | ||
![]() |
6097c6aff6 | ||
![]() |
77b26d736a | ||
![]() |
7e2bce57ad | ||
![]() |
4a88753757 | ||
![]() |
dce36bfc18 | ||
![]() |
7635f21788 | ||
![]() |
441e97ec27 | ||
![]() |
0905c3d6a3 | ||
![]() |
51c1c2ed47 | ||
![]() |
5460642214 | ||
![]() |
ac37653988 | ||
![]() |
3349b13825 | ||
![]() |
1a97657e17 | ||
![]() |
6ae6e1eb90 | ||
![]() |
5f44d7dd55 | ||
![]() |
0196af8d75 | ||
![]() |
599da42d47 | ||
![]() |
aeda087b67 | ||
![]() |
490bbcc7b3 | ||
![]() |
548d494dd0 | ||
![]() |
53d6354910 | ||
![]() |
194e4d15cd | ||
![]() |
31ff97f502 | ||
![]() |
cfcb32870f | ||
![]() |
3d6e02b8b3 | ||
![]() |
c63d3e7ccb | ||
![]() |
fbeaeef62e | ||
![]() |
150de96b64 | ||
![]() |
1a5f2a44bd | ||
![]() |
d9e0462393 | ||
![]() |
16cddd7276 | ||
![]() |
858743b679 | ||
![]() |
52334a508b | ||
![]() |
290b3ac370 | ||
![]() |
ddefcc1018 | ||
![]() |
87c5f43bdf | ||
![]() |
2c8f1b1585 | ||
![]() |
9051e6d882 | ||
![]() |
5b639ebb82 | ||
![]() |
a2d2f0472f | ||
![]() |
58b270adba | ||
![]() |
48ce9faac6 | ||
![]() |
67bfe3af4a | ||
![]() |
e7cf458de9 | ||
![]() |
86cfc8b7f9 | ||
![]() |
457d3f9a3f | ||
![]() |
d4d38e1ac4 | ||
![]() |
e2ea830361 | ||
![]() |
6e00000bb5 | ||
![]() |
4bf0828527 | ||
![]() |
7bd320f939 | ||
![]() |
377c975fda | ||
![]() |
eac9b308e9 | ||
![]() |
c226128747 | ||
![]() |
e07fac631c | ||
![]() |
ed0e87d54d | ||
![]() |
05037353bd | ||
![]() |
710f517caf | ||
![]() |
1d8221a321 | ||
![]() |
00739632cf | ||
![]() |
9c5a45985b | ||
![]() |
5f29095f02 | ||
![]() |
9f799cd86e | ||
![]() |
5ae38495cd | ||
![]() |
7389a4780e | ||
![]() |
52f24b0203 | ||
![]() |
10ce45004b | ||
![]() |
0d0fda8321 | ||
![]() |
564f441d99 | ||
![]() |
7278568040 | ||
![]() |
732d631951 | ||
![]() |
1e81f0005a | ||
![]() |
af75ceeec3 | ||
![]() |
84f5301ac0 | ||
![]() |
ad6deb7366 | ||
![]() |
dd92ebd2d9 | ||
![]() |
6f73b1aef6 | ||
![]() |
ca1f9482c0 | ||
![]() |
77a46f46c7 | ||
![]() |
7f8004be1f | ||
![]() |
426cf50f11 | ||
![]() |
9fc96fc56e | ||
![]() |
d3b0f98e0e | ||
![]() |
9f5fe0859d | ||
![]() |
178935f55c | ||
![]() |
01b279d5ba | ||
![]() |
0931c3577a | ||
![]() |
f707394839 | ||
![]() |
1b4d15957c | ||
![]() |
8a85572679 | ||
![]() |
6587e4f5ea | ||
![]() |
cda63b21de | ||
![]() |
fd7e8c5bc3 | ||
![]() |
45e1d7e4f0 | ||
![]() |
332444bf2b | ||
![]() |
ca0e56af6a | ||
![]() |
995a847c33 | ||
![]() |
0e5e7040f8 | ||
![]() |
a4875b8fe5 | ||
![]() |
f19be46ac4 | ||
![]() |
ee8f881153 | ||
![]() |
5525db3c5e | ||
![]() |
c4b4e4c929 | ||
![]() |
cf7f7f32b7 | ||
![]() |
c3d4ebc737 | ||
![]() |
800d08fbef | ||
![]() |
37ee75d3bf | ||
![]() |
f069b975fb | ||
![]() |
b289b76536 | ||
![]() |
4c8ac8e021 | ||
![]() |
71bd7ddae0 | ||
![]() |
47c94c3afc | ||
![]() |
a8dec74ffa | ||
![]() |
93748ccc7b | ||
![]() |
d7e2d45f20 | ||
![]() |
05f85e8463 | ||
![]() |
ba2e1d6ca7 | ||
![]() |
d34569cebe | ||
![]() |
b62bfe3bdf | ||
![]() |
00eabe8305 | ||
![]() |
ae0a0dfba0 | ||
![]() |
57cecc0588 | ||
![]() |
18e467ef9e | ||
![]() |
725f2bc9ed | ||
![]() |
8e22565759 | ||
![]() |
8abebdc2e7 | ||
![]() |
92d9a0732d | ||
![]() |
9da2f4f40f | ||
![]() |
5c7c8a3bd0 | ||
![]() |
a26a7322a5 | ||
![]() |
aee15712e5 | ||
![]() |
558a8a5c64 | ||
![]() |
82860694a2 | ||
![]() |
c88c62cb56 | ||
![]() |
d92b1829d5 | ||
![]() |
049bf4b07a | ||
![]() |
60b0cd100c | ||
![]() |
68c4557968 | ||
![]() |
5e49131e44 | ||
![]() |
640488bab1 | ||
![]() |
b07234e8ee | ||
![]() |
70586da699 | ||
![]() |
4fc7b93f6d | ||
![]() |
e3db079c22 | ||
![]() |
574219e1ee | ||
![]() |
531ad440b7 | ||
![]() |
37019a1eb6 | ||
![]() |
f224034a1f | ||
![]() |
6564d5999c | ||
![]() |
d1178fe6f4 | ||
![]() |
e0a750d98b | ||
![]() |
30671f0636 | ||
![]() |
28008d8442 | ||
![]() |
6b261eb6f8 | ||
![]() |
57323846f1 | ||
![]() |
1676671ee0 | ||
![]() |
96ff823ed8 | ||
![]() |
11eea36e32 | ||
![]() |
fc57dd624a | ||
![]() |
f9cc826d5b | ||
![]() |
73907e1d3f | ||
![]() |
724b522f3b | ||
![]() |
466515d59a | ||
![]() |
30ae71202d | ||
![]() |
a69f6c6982 | ||
![]() |
cce1eff495 | ||
![]() |
525b72ca4c | ||
![]() |
78a517a34d | ||
![]() |
267fd52984 | ||
![]() |
3e1c63c93a | ||
![]() |
495630e001 | ||
![]() |
f488ed28f3 | ||
![]() |
5b37a3ac72 | ||
![]() |
aca15dcc85 | ||
![]() |
f4f3354466 | ||
![]() |
7836b78809 | ||
![]() |
2b972d9cc9 | ||
![]() |
5505a5557a | ||
![]() |
06e254f169 |
10
LICENSE
Normal file
10
LICENSE
Normal file
|
@ -0,0 +1,10 @@
|
|||
This component of Racket is distributed under the under the Apache 2.0
|
||||
and MIT licenses. The user can choose the license under which they
|
||||
will be using the software. There may be other licenses within the
|
||||
distribution with which the user must also comply.
|
||||
|
||||
See the files
|
||||
https://github.com/racket/racket/blob/master/racket/src/LICENSE-APACHE.txt
|
||||
and
|
||||
https://github.com/racket/racket/blob/master/racket/src/LICENSE-MIT.txt
|
||||
for the full text of the licenses.
|
24
README.md
Normal file
24
README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Scribble
|
||||
|
||||
This the source for the Racket packages: "scribble", "scribble-doc", "scribble-html-lib", "scribble-lib", "scribble-test", "scribble-text-lib".
|
||||
|
||||
### Contributing
|
||||
|
||||
Contribute to Racket by submitting a [pull request], reporting an
|
||||
[issue], joining the [development mailing list], or visiting the
|
||||
IRC or Slack channels.
|
||||
|
||||
### License
|
||||
|
||||
Racket, including these packages, is free software, see [LICENSE]
|
||||
for more details.
|
||||
|
||||
By making a contribution, you are agreeing that your contribution
|
||||
is licensed under the [Apache 2.0] license and the [MIT] license.
|
||||
|
||||
[MIT]: https://github.com/racket/racket/blob/master/racket/src/LICENSE-MIT.txt
|
||||
[Apache 2.0]: https://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
[pull request]: https://github.com/racket/scribble/pulls
|
||||
[issue]: https://github.com/racket/scribble/issues
|
||||
[development mailing list]: https://lists.racket-lang.org
|
||||
[LICENSE]: LICENSE
|
|
@ -1,11 +0,0 @@
|
|||
scribble-doc
|
||||
Copyright (c) 2010-2014 PLT Design Inc.
|
||||
|
||||
This package is distributed under the GNU Lesser General Public
|
||||
License (LGPL). This means that you can link this package into proprietary
|
||||
applications, provided you follow the rules stated in the LGPL. You
|
||||
can also modify this package; if you distribute a modified version,
|
||||
you must distribute it under the terms of the LGPL, which in
|
||||
particular means that you must release the source code for the
|
||||
modified software. See http://www.gnu.org/copyleft/lesser.html
|
||||
for more information.
|
385
scribble-doc/scribblings/scribble/acmart.scrbl
Normal file
385
scribble-doc/scribblings/scribble/acmart.scrbl
Normal file
|
@ -0,0 +1,385 @@
|
|||
#lang scribble/manual
|
||||
@(require (except-in "utils.rkt" title author)
|
||||
(for-label scribble/acmart))
|
||||
|
||||
@(define acmart-url
|
||||
"http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/acmart/acmart.pdf")
|
||||
|
||||
@title{ACM Paper Format}
|
||||
|
||||
@defmodulelang[scribble/acmart]{The @racketmodname[scribble/acmart]
|
||||
language is like @racketmodname[scribble/base], but configured with
|
||||
LaTeX style defaults to use the @hyperlink[acmart-url]{@tt{acmart}}
|
||||
class for typesetting publications for the Association of Computing
|
||||
Machinery.}
|
||||
|
||||
@bold{Note:} a @racketmodname[scribble/acmart] document must include a
|
||||
@racket[title] and @racket[author].
|
||||
|
||||
Example:
|
||||
|
||||
@verbatim[#:indent 2]|{
|
||||
#lang scribble/acmart
|
||||
@title{Surreal Numbers}
|
||||
@author{Ursula N. Owens}
|
||||
}|
|
||||
|
||||
@deftogether[(
|
||||
@defidform[manuscript]
|
||||
@defidform[acmsmall]
|
||||
@defidform[acmlarge]
|
||||
@defidform[acmtog]
|
||||
@defidform[sigconf]
|
||||
@defidform[siggraph]
|
||||
@defidform[sigplan]
|
||||
@defidform[sigchi]
|
||||
@defidform[sigchi-a]
|
||||
@defidform[dtrap]
|
||||
@defidform[tiot]
|
||||
@defidform[tdsci]
|
||||
)]{
|
||||
|
||||
Enables the given document format. Use the format only on the same
|
||||
line as @hash-lang[], with only whitespace (or other options) between
|
||||
@racketmodname[scribble/acmart] and the format name:
|
||||
|
||||
@verbatim[#:indent 2]|{
|
||||
#lang scribble/acmart @acmsmall
|
||||
}|
|
||||
|
||||
The @racket[manuscript], @racket[acmsmall], @racket[acmlarge],
|
||||
@racket[acmtog], @racket[sigconf], @racket[siggraph],
|
||||
@racket[sigplan], @racket[sigchi], and @racket[sigchi-a] formats are
|
||||
all mutually exclusive.}
|
||||
|
||||
@deftogether[(
|
||||
@defidform[review]
|
||||
@defidform[screen]
|
||||
@defidform[natbib]
|
||||
@defidform[anonymous]
|
||||
@defidform[authorversion]
|
||||
@defidform[nonacm]
|
||||
@defidform[timestamp]
|
||||
@defidform[authordraft]
|
||||
@defidform[acmthm]
|
||||
@defidform[9pt]
|
||||
@defidform[10pt]
|
||||
@defidform[11pt]
|
||||
@defidform[12pt]
|
||||
)]{
|
||||
|
||||
Enables the given document format option. Use the option only on the
|
||||
same line as @hash-lang[], with only whitespace (or other options)
|
||||
between @racketmodname[scribble/acmart] and the format option. Any
|
||||
number of options may be used:
|
||||
|
||||
@verbatim[#:indent 2]|{
|
||||
#lang scribble/acmart @acmsmall @review @anonymous @natbib
|
||||
}|
|
||||
|
||||
If multiple font size options are used, all but the last are ignored.
|
||||
|
||||
The @link["https://www.acm.org/binaries/content/assets/publications/consolidated-tex-template/acmart.pdf"
|
||||
]{ACM documentation} (version 1.54, 2018-07-16, by Boris
|
||||
Veytsman) provides these defaults and descriptions:
|
||||
|
||||
@tabular[#:style 'boxed
|
||||
#:sep @hspace[1]
|
||||
;#:column-properties '(left left left)
|
||||
#:row-properties '(bottom-border ())
|
||||
(list
|
||||
(list @bold{name} @bold{default} @bold{description})
|
||||
(list "review" "false"
|
||||
"A review version: lines are numbered and\
|
||||
hyperlinks are colored")
|
||||
(list "screen" "see text"
|
||||
"A screen version: hyperlinks are colored")
|
||||
(list "natbib" "true"
|
||||
"Whether to use the natbib package")
|
||||
(list "anonymous"
|
||||
"false"
|
||||
"Whether to make author(s) anonymous")
|
||||
(list "authorversion"
|
||||
"false"
|
||||
"Whether to generate a special version\
|
||||
for the authors’ personal use or posting")
|
||||
;; these options are documented in ACM docs but don't
|
||||
;; appear to exist in the scribble acmart format:
|
||||
(list "nonacm" "false"
|
||||
"Use the class typesetting options for a non-ACM\
|
||||
document, which will not include the conference/journal\
|
||||
header and footers or permission statements")
|
||||
(list "timestamp" "false"
|
||||
"Whether to put a time stamp in the footer\
|
||||
of each page")
|
||||
(list "authordraft" "false"
|
||||
"Whether author’s-draft mode is enabled")
|
||||
(list "acmthm" "true"
|
||||
"Whether to define theorem-like environments"))]
|
||||
|
||||
Further details for some of these are provided by the full
|
||||
documentation for the acmart LaTeX class.
|
||||
|
||||
In order to disable a default-true option (e.g. @racket[natbib]), call
|
||||
the option as a function with the value @racket[#false]:
|
||||
|
||||
@code|{#lang scribble/acmart @natbib[#f] @sigplan}|
|
||||
|
||||
}
|
||||
|
||||
@defproc[(abstract [pre-content pre-content?] ...) block?]{
|
||||
|
||||
Generates a @tech{nested flow} for a paper abstract.}
|
||||
|
||||
@defform[(include-abstract module-path)]{
|
||||
|
||||
Similar to @racket[include-section], but incorporates the document in the
|
||||
specified module as an abstract. The document must have no title or
|
||||
sub-parts.}
|
||||
|
||||
@defproc[(title [#:short short-title pre-content? #f]
|
||||
[#:tag tag (or/c string? (listof string?) #f) #f]
|
||||
[#:tag-prefix prefix (or/c string? module-path? #f) #f]
|
||||
[#:style style (or/c style? string? symbol? #f) #f]
|
||||
[#:version version (or/c string? #f) #f]
|
||||
[#:date date (or/c string? #f) #f]
|
||||
[title pre-content?] ...)
|
||||
title-decl?]{
|
||||
|
||||
Specifies the title of the document, optionally with a short version of the title for running heads.}
|
||||
|
||||
@defproc[(subtitle [pre-content pre-content?] ...) content?]{
|
||||
|
||||
Specifies a subtitle.}
|
||||
|
||||
@defproc[(author [#:orcid orcid (or/c pre-content? #f) #f]
|
||||
[#:affiliation affiliation
|
||||
(or/c pre-content?
|
||||
affiliation?
|
||||
(listof pre-content?)
|
||||
(listof affiliation?)
|
||||
#f)
|
||||
#f]
|
||||
[#:email email
|
||||
(or/c pre-content? email? (listof email?))
|
||||
'()]
|
||||
[name pre-content?] ...)
|
||||
block?]{
|
||||
|
||||
Specifies an author with an optional email address, affiliation, and/or orcid.
|
||||
|
||||
@codeblock|{
|
||||
#lang scribble/acmart
|
||||
@title{Title}
|
||||
@author["Unboxed Value"
|
||||
#:email (list (email "user@server.com")
|
||||
(email-string "case--Int#@GHC.Prim.info"))]}
|
||||
|
||||
@abstract{abstracting abstract title}
|
||||
}|
|
||||
}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(acmJournal [journal pre-content?] ...) block?]
|
||||
@defproc[(acmConference [name pre-content?] [date pre-content?] [venue pre-content?]) block?]
|
||||
@defproc[(acmVolume [content pre-content?] ...) block?]
|
||||
@defproc[(acmNumber [content pre-content?] ...) block?]
|
||||
@defproc[(acmArticle [content pre-content?] ...) block?]
|
||||
@defproc[(acmYear [content pre-content?] ...) block?]
|
||||
@defproc[(acmMonth [content pre-content?] ...) block?]
|
||||
@defproc[(acmArticleSeq [content pre-content?] ...) block?]
|
||||
@defproc[(acmPrice [content pre-content?] ...) block?]
|
||||
@defproc[(acmISBN [content pre-content?] ...) block?]
|
||||
@defproc[(acmDOI [content pre-content?] ...) block?]
|
||||
)]{
|
||||
|
||||
Declares information that is collected into the front-matter region of the paper.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(acmBadgeL [#:url url string? #f] [graphics string?]) block?]
|
||||
@defproc[(acmBadgeR [#:url url string? #f] [graphics string?]) block?]
|
||||
)]{
|
||||
|
||||
Display a special badge, such as an artifact evaluation badge, on the
|
||||
left or right of the first page. If @racket[url] is provided, the
|
||||
screen version of the image links to the badge authority.
|
||||
|
||||
}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(email [text pre-content?] ...) email?]
|
||||
@defproc[(email-string [text string?] ...) email?]
|
||||
)]{
|
||||
Creates an @racket[email?] object for use with @racket[author].
|
||||
|
||||
@racket[email-string] is like @racket[email]
|
||||
except that @racket[email-string] only takes
|
||||
@tech[#:doc '(lib "scribblings/reference/reference.scrbl") #:key "string"]{strings},
|
||||
escapes all @tt{%} and @tt{#} characters
|
||||
in the arguments and typesets the email address with the
|
||||
@racket['exact-chars] style.
|
||||
}
|
||||
|
||||
@defproc[(email? [email any/c]) boolean?]{
|
||||
|
||||
Returns @racket[#t] if @racket[email] is an @racket[email],
|
||||
@racket[#f] otherwise.
|
||||
}
|
||||
|
||||
|
||||
@defproc[(affiliation
|
||||
[#:position position (or/c pre-content? #f) #f]
|
||||
[#:institution institution (listof (or/c pre-content? institution?)) '()]
|
||||
[#:street-address street-address (or/c pre-content? #f) #f]
|
||||
[#:city city (or/c pre-content? #f) #f]
|
||||
[#:state state (or/c pre-content? #f) #f]
|
||||
[#:postcode postcode (or/c pre-content? #f) #f]
|
||||
[#:country country (or/c pre-content? #f) #f])
|
||||
affiliation?]{
|
||||
|
||||
Creates an @racket[affiliation?] object for use with @racket[author].
|
||||
}
|
||||
|
||||
@defproc[(affiliation? [aff any/c]) boolean?]{
|
||||
|
||||
Returns @racket[#t] if @racket[aff] is an
|
||||
@racket[affiliation], @racket[#f] otherwise.
|
||||
}
|
||||
|
||||
@defproc[(institution [#:departments departments (or/c pre-content? institution? (listof institution)) '()]
|
||||
[inst institution?] ...)
|
||||
institution?]{
|
||||
|
||||
Creates an @racket[institution?] object for use in @racket[author].}
|
||||
|
||||
@defproc[(institution? [inst any/c]) boolean]{
|
||||
|
||||
Returns @racket[#t] if @racket[inst] is an
|
||||
@racket[institution], @racket[#f] otherwise.
|
||||
}
|
||||
|
||||
@codeblock|{
|
||||
#lang scribble/acmart
|
||||
@title{Some Title}
|
||||
@author["David Van Horn"
|
||||
#:affiliation @affiliation[
|
||||
#:institution
|
||||
@institution[
|
||||
#:departments (list @institution{Department of Computer Science}
|
||||
@institution{UMIACS})]{
|
||||
University of Maryland}
|
||||
#:city "College Park"
|
||||
#:state "Maryland"]
|
||||
#:email "dvanhorn@cs.umd.edu"]}
|
||||
|
||||
@abstract{This is an abstract.}
|
||||
}|
|
||||
|
||||
@defproc[(authorsaddresses [addresses pre-content?] ...) block?]{
|
||||
Sets the text for the authors' addresses on the first page
|
||||
in some styles. By default this field is set to the authors
|
||||
and their affiliation information.
|
||||
|
||||
The @racket[addresses] parameter takes the address text. As a
|
||||
special case the empty list removes the addresses field entirely.
|
||||
|
||||
@codeblock|{
|
||||
#lang scribble/acmart @acmsmall
|
||||
@title{A fancy paper}
|
||||
@author["Ronon Dex"]
|
||||
@authorsaddresses{}
|
||||
}|
|
||||
|
||||
@history[#:added "1.26"]}
|
||||
|
||||
@defproc[(shortauthors [name pre-content?] ...) element?]{
|
||||
Sets the text for the names of the authors in the running header.
|
||||
|
||||
@history[#:added "1.29"]}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(terms [content pre-content?] ...) content?]
|
||||
@defproc[(keywords [content pre-content?] ...) content?]
|
||||
)]{
|
||||
|
||||
Typesets term and keyword information for the paper, which
|
||||
is normally placed immediately after an @racket[abstract] form.
|
||||
See also @url["http://www.acm.org/about/class/how-to-use"].
|
||||
|
||||
For @racket[terms], each general term should be in titlecase. Terms
|
||||
are usually drawn from a fixed list, and they are usually optional.
|
||||
|
||||
For @racket[keywords], capitalize only the first letter of the first
|
||||
word, separate phrases by commas, and do not include ``and'' before
|
||||
the last one. Keywords should be noun phrases, not adjectives.}
|
||||
|
||||
@defproc[(startPage [content pre-content?] ...) content?]{
|
||||
Sets the start page for the paper.}
|
||||
|
||||
@defproc[(ccsdesc [#:number number? #f] [content pre-content?] ...) content?]{
|
||||
|
||||
Declares CCS description with optional numeric code.}
|
||||
|
||||
@defproc[(received [#:stage stage string? #f] [date string?]) content?]{
|
||||
|
||||
Sets the history of the publication. If @racket[stage] is omitted, it
|
||||
defaults to @racket{Received} for the first occurrence and
|
||||
@racket{revised} in subsequent uses.
|
||||
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/acmart
|
||||
@received{February 2007}
|
||||
@received[#:stage "revised"]{March 2009}
|
||||
@received[#:stage "accepted"]{June 2009}
|
||||
}|}
|
||||
|
||||
@defproc[(teaserfigure [content pre-flow?] ...) block?]{
|
||||
|
||||
Creates a teaser figure to appear before main text.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(sidebar [content pre-flow?] ...) block?]
|
||||
@defproc[(marginfigure [content pre-flow?] ...) block?]
|
||||
@defproc[(margintable [content pre-flow?] ...) block?]
|
||||
)]{
|
||||
|
||||
In the @racket[sigchi-a] format, special sidebars,
|
||||
tables and figures on the margin.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(printonly [content pre-flow?] ...) block?]
|
||||
@defproc[(screenonly [content pre-flow?] ...) block?]
|
||||
@defproc[(anonsuppress [content pre-flow?] ...) block?]
|
||||
)]{
|
||||
Marks content to be included only for print or screen
|
||||
editions, or excluded from anonymous editions.}
|
||||
|
||||
@defproc[(acks [content pre-flow?] ...) block?]{
|
||||
|
||||
Creates an unnumbered section ``Acknowledgments'' section, unless the
|
||||
@racket[anonymous] mode is selected.}
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(grantsponsor [sponsorID string?] [name string?] [url string?]) content?]
|
||||
@defproc[(grantnum [#:url url string? #f] [sponsorID string?] [num string?]) content?]
|
||||
)]{
|
||||
|
||||
All financial support @emph{must} be listed using the
|
||||
@racket[grantsponsor] and @racket[grantnum] commands inside of
|
||||
@racket[acks].
|
||||
|
||||
Here @racket[sponsorID] is the unique ID used to match grants to
|
||||
sponsors, @racket[name] is the name of the sponsor. The
|
||||
@racket[sponsorID] of a @racket[grantnum] must match some
|
||||
@racket[sponsorID] of a @racket[grantsponsor] command.
|
||||
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/acmart
|
||||
@acks{
|
||||
The author thanks Ben Greenman for helpful comments on this
|
||||
code. Financial support provided by the @grantsponsor["NSF7000"
|
||||
"National Scribble Foundation"]{http://racket-lang.org} under
|
||||
grant No.: @grantnum["NSF7000"]{867-5309}.}
|
||||
}|}
|
||||
|
||||
@history[#:added "1.20"]
|
|
@ -105,7 +105,7 @@ removed.}
|
|||
|
||||
|
||||
@def-section-like[section part-start?]{ Like @racket[title], but
|
||||
generates a @racket[part-start] of depth @racket[0] to be by
|
||||
generates a @racket[part-start] of depth @racket[0] to be picked up by
|
||||
@racket[decode] or @racket[decode-part].}
|
||||
|
||||
@def-section-like[subsection part-start?]{ Like @racket[section], but
|
||||
|
@ -130,7 +130,14 @@ Generates a @racket[paragraph] with style name @racket['author] to
|
|||
show the author(s) of a document, where each author is represented by
|
||||
@tech{content}. Normally, this function is used after
|
||||
@racket[title] for the beginning of a document. See also
|
||||
@racket[author+email].}
|
||||
@racket[author+email].
|
||||
|
||||
Examples:
|
||||
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/base
|
||||
@author{Alice P. Racketeer}
|
||||
}|}
|
||||
|
||||
@defproc[(author+email [author-name content?]
|
||||
[email string?]
|
||||
|
@ -143,7 +150,14 @@ address-harvesting robots.
|
|||
|
||||
Note that @racket[author+email] is not a replacement for
|
||||
@racket[author]. The @racket[author+email] function is often used in
|
||||
combination with @racket[author].}
|
||||
combination with @racket[author].
|
||||
|
||||
Examples:
|
||||
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/base
|
||||
@author[(author+email "Bob T. Scribbler" "bob@racket-lang.org")]
|
||||
}|}
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
||||
|
@ -247,7 +261,8 @@ Returns @racket[#t] if @racket[v] is an item produced by
|
|||
[#:sep sep (or/c block? content? #f) #f]
|
||||
[#:column-properties column-properties (listof any/c) '()]
|
||||
[#:row-properties row-properties (listof any/c) '()]
|
||||
[#:cell-properties cell-properties (listof (listof any/c)) '()])
|
||||
[#:cell-properties cell-properties (listof (listof any/c)) '()]
|
||||
[#:sep-properties sep-properties (or/c list? #f) #f])
|
||||
table?]{
|
||||
|
||||
Creates a @tech{table} with the given @racket[cells] content, which is
|
||||
|
@ -260,12 +275,13 @@ used for a new cell. A @racket['cont] must not appear as the first
|
|||
cell in a row.
|
||||
|
||||
The @racket[style] argument is handled the same as @racket[para].
|
||||
See @racket[table] for a list of recognized @tech{style names} and @tech{style properties}.
|
||||
|
||||
If @racket[sep] is not @racket[#f], it is inserted as a new column
|
||||
between every column in the table; note that any
|
||||
@racket[table-columns] or @racket[table-cells] property in
|
||||
@racket[style] must take the added columns into account. Otherwise,
|
||||
the default style places no space between table columns. When @racket[sep]
|
||||
The default style places no space between table columns. If
|
||||
@racket[sep] is not @racket[#f], it is inserted as a new column
|
||||
between every column in the table; the new column's properties are the
|
||||
same as the preceding column's, unless @racket[sep-properties]
|
||||
provides a list of @tech{style properties} to use. When @racket[sep]
|
||||
would be placed before a @racket['cont], a @racket['cont] is inserted,
|
||||
instead.
|
||||
|
||||
|
@ -328,7 +344,10 @@ properties will be used from the merger into @racket[table-cells].}
|
|||
@racket[#:row-properties],
|
||||
and @racket[#:cell-properties] arguments.}
|
||||
#:changed "1.12" @elem{Changed @racket[sep] insertion before a
|
||||
@racket['cont].}]
|
||||
@racket['cont].}
|
||||
#:changed "1.28" @elem{Added @racket[sep-properties] and made
|
||||
the preceding column's properties used
|
||||
consistently if not specified.}]
|
||||
|
||||
Examples:
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
|
@ -448,7 +467,9 @@ gets progressively smaller.}
|
|||
gets progressively larger.}
|
||||
|
||||
@defproc[(emph [pre-content pre-content?] ...) element?]{
|
||||
The same as @racket[italic].}
|
||||
Like @racket[elem], but emphasised. Typically, italics are used for
|
||||
emphasis. Uses of @racket[emph] can be nested; typically this causes
|
||||
the text to alternate between italic and upright.}
|
||||
|
||||
@defproc[(literal [str string?] ...+) element?]{
|
||||
|
||||
|
@ -598,14 +619,15 @@ Generates a literal hyperlinked URL.}
|
|||
@defproc[(secref [tag string?]
|
||||
[#:doc module-path (or/c module-path? #f) #f]
|
||||
[#:tag-prefixes prefixes (or/c (listof string?) #f) #f]
|
||||
[#:underline? underline? any/c #t])
|
||||
[#:underline? underline? any/c #t]
|
||||
[#:link-render-style ref-style (or/c link-render-style? #f)])
|
||||
element?]{
|
||||
|
||||
Inserts a reference to the section tagged @racket[tag].
|
||||
|
||||
If @racket[#:doc module-path] is provided, the @racket[tag] refers to
|
||||
a tag with a prefix determined by @racket[module-path]. When
|
||||
@exec{setup-plt} renders documentation, it automatically adds a tag
|
||||
@exec{raco setup} renders documentation, it automatically adds a tag
|
||||
prefix to the document based on the source module. Thus, for example,
|
||||
to refer to a section of the Racket reference,
|
||||
@racket[module-path] would be @racket['(lib
|
||||
|
@ -619,32 +641,35 @@ reach the @racket[tag] section. When @racket[#:doc] is not provided,
|
|||
the @racket[prefixes] path is relative to any enclosing section (i.e.,
|
||||
the youngest ancestor that produces a match).
|
||||
|
||||
For HTML output, the generated reference is the hyperlinked title of
|
||||
the elements in the section's title content, except that elements with
|
||||
the @racket['aux] @tech{style property} are omitted in the hyperlink
|
||||
label. If @racket[underline?] is @racket[#f], then the hyperlink is
|
||||
rendered in HTML without an underline.
|
||||
|
||||
For Latex output, the generated reference's format depends on the
|
||||
document style. By default, only the section number is shown in the
|
||||
reference, but the @racketmodname[scribble/manual] style shows the
|
||||
title after the section number. Customize the output (see
|
||||
@secref["config"]) by redefining the @ltx{BookRef}, @|etc|, macros (see
|
||||
@secref["builtin-latex"]).
|
||||
For the result @racket[link-element], if @racket[ref-style] is not
|
||||
@racket[#f], then it is attached as a @tech{style property} and
|
||||
affects the rendering of the link. Alternatively, an enclosing
|
||||
@racket[part] can have a link-render style that adjusts the rendering
|
||||
style for all links within the @tech{part}. See @racket[link-element]
|
||||
for more information about the rendering of section references.
|
||||
|
||||
If @racket[underline?] is @racket[#f], then a @tech{style} is attached
|
||||
to the result @racket[link-element] so that the hyperlink is rendered
|
||||
in HTML without an underline
|
||||
|
||||
In Racket documentation that is rendered to HTML, clicking on a
|
||||
section title normally shows the @racket[secref] call that is needed
|
||||
to link to the section.}
|
||||
to link to the section.
|
||||
|
||||
@history[#:changed "1.25" @elem{Added the @racket[#:link-render-style] argument.}]}
|
||||
|
||||
|
||||
@defproc[(Secref [tag string?]
|
||||
[#:doc module-path (or/c module-path? #f) #f]
|
||||
[#:tag-prefixes prefixes (or/c (listof string?) #f) #f]
|
||||
[#:underline? underline? any/c #t])
|
||||
[#:underline? underline? any/c #t]
|
||||
[#:link-render-style ref-style (or/c link-render-style? #f)])
|
||||
element?]{
|
||||
|
||||
Like @racket[secref], but if the rendered form of the reference starts
|
||||
with a word (e.g., ``section''), then the word is capitalized.}
|
||||
with a word (e.g., ``section''), then the word is capitalized.
|
||||
|
||||
@history[#:changed "1.25" @elem{Added the @racket[#:link-render-style] argument.}]}
|
||||
|
||||
|
||||
@defproc[(seclink [tag string?]
|
||||
|
@ -691,13 +716,13 @@ renders as a hyperlink with the text:
|
|||
}|}
|
||||
|
||||
|
||||
@defproc[(elemtag [t (or/c tag? string?)] [pre-content pre-content?] ...) element?]{
|
||||
@defproc[(elemtag [t (or/c taglet? generated-tag?)] [pre-content pre-content?] ...) element?]{
|
||||
|
||||
The tag @racket[t] refers to the content form of
|
||||
@racket[pre-content].}
|
||||
|
||||
|
||||
@defproc[(elemref [t (or/c tag? string?)] [pre-content pre-content?] ...
|
||||
@defproc[(elemref [t (or/c taglet? generated-tag?)] [pre-content pre-content?] ...
|
||||
[#:underline? underline? any/c #t]) element?]{
|
||||
|
||||
The @tech{decode}d @racket[pre-content] is hyperlinked to @racket[t],
|
||||
|
@ -714,7 +739,7 @@ which is normally defined using @racket[elemtag].}
|
|||
Creates an index element given a plain-text string---or list of
|
||||
strings for a hierarchy, such as @racket['("strings" "plain")] for a
|
||||
``plain'' entry below a more general ``strings'' entry. As index keys,
|
||||
the strings are ``cleaned'' using @racket[clean-up-index-strings]. The
|
||||
the strings are ``cleaned'' using @racket[clean-up-index-string]. The
|
||||
strings (without clean-up) also serve as the text to render in the
|
||||
index. The @tech{decode}d @racket[pre-content] is the text to appear
|
||||
inline as the index target.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#lang scribble/doc
|
||||
@(require scribble/manual "utils.rkt" scribble/bnf
|
||||
(for-label scribble/bnf))
|
||||
;; "utils.rkt" provides scribble/bnf for-label
|
||||
)
|
||||
|
||||
@title[#:tag "bnf"]{BNF Grammars}
|
||||
|
||||
|
@ -43,44 +44,48 @@ produces the output
|
|||
|
||||
See also @racket[racketgrammar].
|
||||
|
||||
@defproc[(BNF [prod (cons element? (listof (or/c block? element?)))] ...) table?]{
|
||||
@defproc[(BNF [prod (cons/c (or/c block? content?)
|
||||
(non-empty-listof (or/c block? content?)))]
|
||||
...)
|
||||
table?]{
|
||||
|
||||
Typesets a grammar table. Each production starts with an element
|
||||
(typically constructed with @racket[nonterm]) for the non-terminal
|
||||
being defined, and then a list of possibilities (typically constructed
|
||||
with @racket[BNF-seq], etc.) to show on separate lines.}
|
||||
|
||||
@defproc[(nonterm (pre-content any/c) ...) element?]{
|
||||
@defproc[(nonterm [pre-content pre-content?] ...) element?]{
|
||||
|
||||
Typesets a non-terminal: italic in angle brackets.}
|
||||
|
||||
@defproc[(BNF-seq [elem element?] ...) element?]{
|
||||
@defproc[(BNF-seq [elem content?] ...) (or/c element? "")]{
|
||||
|
||||
Typesets a sequence.}
|
||||
|
||||
@defproc[(BNF-seq-lines [elems (listof element?)] ...) block?]{
|
||||
@defproc[(BNF-seq-lines [elems (listof content?)] ...) block?]{
|
||||
|
||||
Typesets a sequence that is broken into multiple lines, where each
|
||||
@racket[elems] is one line.}
|
||||
|
||||
@defproc[(BNF-group [pre-content any/c] ...) element?]{
|
||||
@defproc[(BNF-group [pre-content pre-content?] ...) element?]{
|
||||
|
||||
Typesets a group surrounded by curly braces (so the entire group can
|
||||
be repeated, for example).}
|
||||
|
||||
@defproc[(optional [pre-content any/c] ...) element?]{
|
||||
@defproc[(optional [pre-content pre-content?] ...) element?]{
|
||||
|
||||
Typesets an optional element: in square brackets.}
|
||||
|
||||
@defproc[(kleenestar [pre-content any/c] ...) element?]{
|
||||
@defproc[(kleenestar [pre-content pre-content?] ...) element?]{
|
||||
|
||||
Typesets a 0-or-more repetition.}
|
||||
|
||||
@defproc[(kleeneplus [pre-content any/c] ...) element?]{
|
||||
@defproc[(kleeneplus [pre-content pre-content?] ...) element?]{
|
||||
|
||||
Typesets a 1-or-more repetition.}
|
||||
|
||||
@defproc[(kleenerange [n any/c] [m any/c] [pre-content any/c] ...) element?]{
|
||||
@defproc[(kleenerange [n any/c] [m any/c] [pre-content pre-content?] ...)
|
||||
element?]{
|
||||
|
||||
Typesets a @racket[n]-to-@racket[m] repetition. The @racket[n] and
|
||||
@racket[m] arguments are converted to a string using @racket[(format
|
||||
|
@ -92,6 +97,14 @@ Typesets alternatives for a production's right-hand side to appear on
|
|||
a single line. The result is normally used as a single possibility in
|
||||
a production list for @racket[BNF].}
|
||||
|
||||
@defthing[BNF-etc string?]{
|
||||
@; BNF-alt/close is exported but undocumented.
|
||||
@; It looks like it produces a more densely packed version of
|
||||
@; BNF-alt, but I haven't confirmed this.
|
||||
|
||||
@defthing[BNF-etc element?]{
|
||||
|
||||
An element to use for omitted productions or content.
|
||||
Renders as: @BNF-etc
|
||||
}
|
||||
|
||||
|
||||
A string to use for omitted productions or content.}
|
||||
|
|
|
@ -75,7 +75,7 @@ a @racket[css-addition] structure instance to a style's @tech{style property}
|
|||
list. To map a style name to a Latex macro or environment, add a
|
||||
@racket[tex-addition] structure instance. A @racket[css-addition] or
|
||||
@racket[tex-addition] is normally associated with the style whose name
|
||||
is implemented by the adition, but it can also be added to the style
|
||||
is implemented by the addition, but it can also be added to the style
|
||||
for an enclosing part.
|
||||
|
||||
Scribble includes a number of predefined styles that are used by the
|
||||
|
@ -172,7 +172,7 @@ configurable in the former way, since a document class determines a
|
|||
set of page-layout and font properties that are used by other
|
||||
commands. The style-replacement kind of configuration corresponds to
|
||||
re-defining Latex macros or overriding CSS class attributes. When
|
||||
@exec{setup-plt} builds PDF documentation, it uses both kinds of
|
||||
@exec{raco setup} builds PDF documentation, it uses both kinds of
|
||||
configuration to produce a standard layout for Racket manuals;
|
||||
that is, it selects a particular page layout, and it replaces some
|
||||
@racketmodname[racket/base] styles.
|
||||
|
@ -332,7 +332,7 @@ The style classes:
|
|||
|
||||
[@css{versionbox} @elem{Outer wrapper for version}]
|
||||
[@css{version} @elem{Inner wrapper for version in the case of search box and/or navigation.}]
|
||||
[@css{versionNoNav} @elem{Inner wrapper for version in the acse of no search box and navigation.}]
|
||||
[@css{versionNoNav} @elem{Inner wrapper for version in the case of no search box and navigation.}]
|
||||
|
||||
[@spacer @spacer]
|
||||
|
||||
|
@ -369,6 +369,7 @@ The style classes:
|
|||
add space before and after suitable for code.}]
|
||||
[@css{SCentered} @elem{For a @racket[nested-flow] created by @racket[centered]: horizontally
|
||||
centered.}]
|
||||
[@css{SVerbatim} @elem{For a @racket[table] created by @racket[verbatim]: disables line breaks.}]
|
||||
|
||||
[@spacer @spacer]
|
||||
|
||||
|
@ -518,6 +519,32 @@ style:
|
|||
@item{@ltxd[0]{postDoc} --- called after the document content; the
|
||||
default does nothing.}
|
||||
|
||||
@item{A set of commands that control the basic set of Latex packages that are loaded:
|
||||
@itemlist[@item{@ltxd[0]{packageGraphicx}, defaults to @tt{\usepackage{graphicx}}}
|
||||
@item{@ltxd[0]{packageHyperref}, defaults to @tt{\usepackage{hyperref}}}
|
||||
@item{@ltxd[0]{renewrmdefault}, defaults to @tt{\renewcommand{\rmdefault}{ptm}}}
|
||||
@item{@ltxd[0]{packageRelsize}, defaults to @tt{\usepackage{relsize}}}
|
||||
@item{@ltxd[0]{packageAmsmath}, defaults to @tt{\usepackage{amsmath}}}
|
||||
@item{@ltxd[0]{packageMathabx}, defaults to @tt{\usepackage{mathabx}}}
|
||||
@item{@ltxd[0]{packageWasysym}, defaults to @tt{\let\leftmoon\relax \let\rightmoon\relax \let\fullmoon\relax \let\newmoon\relax \let\diameter\relax \usepackage[nointegrals]{wasysym}}}
|
||||
@item{@ltxd[0]{packageTxfonts}, defaults to @tt{\let\widering\relax \usepackage{newtxmath}}}
|
||||
@item{@ltxd[0]{packageTextcomp}, defaults to @tt{\usepackage{textcomp}}}
|
||||
@item{@ltxd[0]{packageFramed}, defaults to @tt{\usepackage{framed}}}
|
||||
@item{@ltxd[0]{packageHyphenat}, defaults to @tt{\usepackage[htt]{hyphenat}}}
|
||||
@item{@ltxd[0]{packageColor}, defaults to @tt{\usepackage[usenames,dvipsnames]{color}}}
|
||||
@item{@ltxd[0]{doHypersetup}, defaults to @tt{\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}}}
|
||||
@item{@ltxd[0]{packageTocstyle}, defaults to @tt{\IfFileExists{tocstyle.sty}{\usepackage{tocstyle}\usetocstyle{standard}}{}}}
|
||||
@item{@ltxd[0]{packageCJK}, defaults to @tt{\IfFileExists{CJK.sty}{\usepackage{CJK}}{}}}]
|
||||
@history[#:changed "1.36" @list{Added @ltx{packageTxfonts}}]
|
||||
@history[#:changed "1.37" @list{
|
||||
Added @ltx{packageAmsmath};
|
||||
changed @ltx{packageWasysym} to use @tt{nointegrals} option;
|
||||
changed @ltx{packageTxfonts} to load @tt{newtxmath}.
|
||||
Note that documents could look different due to
|
||||
the new @tt{wasysym} option and the inclusion of @tt{newtxmath}.
|
||||
See @hyperlink["https://github.com/racket/scribble/pull/274"]{
|
||||
racket/scribble#274} for examples.}]}
|
||||
|
||||
@item{@ltxd[0]{sectionNewpage} --- called before each top-level
|
||||
section starts; the default does nothing, while the
|
||||
@racketmodname[scribble/manual] configuration uses
|
||||
|
@ -630,7 +657,10 @@ style:
|
|||
with the @racket['code-inset] style name.}
|
||||
|
||||
@item{@ltxe{SVInsetFlow} environment --- for a @racket[nested-flow]
|
||||
with the @racket['vertical-inset] style name.}
|
||||
with the @racket['vertical-inset] style name.}
|
||||
|
||||
@item{@ltxe{SVerbatim} environment --- for a @racket[table] created
|
||||
by @racket[verbatim].}
|
||||
|
||||
@item{@ltxd[1]{SCodeBox}, @ltxd[1]{SVInsetBox} --- for a
|
||||
@racket[nested-flow] with the @racket['code-inset] or
|
||||
|
@ -640,6 +670,25 @@ style:
|
|||
|
||||
]
|
||||
|
||||
Additionally, the @filepath{racket.tex} Latex configuration
|
||||
includes several macros that you can redefine to adjust the
|
||||
output style of Racket code:
|
||||
|
||||
@itemlist[
|
||||
@item{@ltxd[2]{SColorize} --- Sets the color scheme of
|
||||
Racket code. Can be redefined to create black and white
|
||||
code. The first argument is the requested color, and the
|
||||
second argument is the text for that color.}
|
||||
@item{@ltxd[1]{SHyphen} --- Enables or Disables the ability
|
||||
for identifiers and keywords in Racket code from being
|
||||
hyphenated. Defaults to enabled (for compatibility).
|
||||
Redefine to disable or change the hyphenation behavior. For
|
||||
example, to cause the text to overfill rather than hyphen,
|
||||
it can be redefined to:
|
||||
@tt["\\renewcommand{\\SHyphen}[1]{\\mbox{#1}}"]. The first
|
||||
argument is an identifier or keyword inside of a code
|
||||
block.}]
|
||||
|
||||
@; ------------------------------------------------------------
|
||||
|
||||
@section[#:tag "latex-prefix"]{Latex Prefix Support}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
@(require scribble/manual
|
||||
(except-in "utils.rkt" url)
|
||||
"struct-hierarchy.rkt"
|
||||
(only-in scribble/eval as-examples)
|
||||
(for-label scribble/manual-struct
|
||||
racket/serialize
|
||||
file/convertible
|
||||
|
@ -9,6 +10,7 @@
|
|||
scriblib/render-cond
|
||||
xml/xexpr
|
||||
net/url-structs
|
||||
scriblib/figure
|
||||
(only-in scribble/html-render render-mixin)))
|
||||
|
||||
@title[#:tag "core"]{Structures And Processing}
|
||||
|
@ -118,10 +120,11 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{An @deftech{content} can be a string, one of a few
|
||||
symbols, an instance of @racket[element] (possibly
|
||||
@item{A @deftech{content} can be a string, one of a few
|
||||
symbols, a convertible value in the sense of @racket[convertible?],
|
||||
an instance of @racket[element] (possibly
|
||||
@racket[link-element], etc.), a @racket[multiarg-element], a
|
||||
a @techlink{traverse element}, @techlink{part-relative element}, a
|
||||
@techlink{traverse element}, a @techlink{part-relative element}, a
|
||||
@techlink{delayed element}, or a list of content.
|
||||
|
||||
@itemize[
|
||||
|
@ -134,7 +137,7 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
output may be collapsed togther or replaced
|
||||
with a line break. In the style
|
||||
@racket['hspace], all text is converted to
|
||||
uncollapsable spaces that cannot be broken
|
||||
uncollapsible spaces that cannot be broken
|
||||
across lines.}
|
||||
|
||||
@item{A symbol content is either @racket['mdash],
|
||||
|
@ -144,6 +147,13 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
rendered as the corresponding HTML entity
|
||||
(even for Latex output).}
|
||||
|
||||
@item{A convertible value in the sense of @racket[convertible?]
|
||||
is used in a renderer-specific way, but values convertible
|
||||
to @racket['text] renders the same as the resulting
|
||||
string. If a renderer is not able to convert the value
|
||||
to a known format, the value is converted to a string
|
||||
using @racket[write].}
|
||||
|
||||
@item{An instance of @racket[element] has a
|
||||
@techlink{content} plus a @tech{style}. The style's
|
||||
interpretation depends on the renderer, but it
|
||||
|
@ -230,6 +240,10 @@ A @deftech{block} is either a @techlink{table}, an
|
|||
|
||||
]
|
||||
|
||||
@history[#:changed "1.23" @elem{Changed the handling of @racket[convertible?]
|
||||
values to recognize a @racket['text] conversion
|
||||
and otherwise use @racket[write].}]
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
||||
@section[#:tag "tags"]{Tags}
|
||||
|
@ -370,7 +384,7 @@ names are as follows:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['index] --- The part represents an index.}
|
||||
@item{@indexed-racket['index] --- The part represents an index.}
|
||||
|
||||
]
|
||||
|
||||
|
@ -378,24 +392,24 @@ The recognized @tech{style properties} are as follows:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['unnumbered] --- A section number is not computed or
|
||||
@item{@indexed-racket['unnumbered] --- A section number is not computed or
|
||||
rendered for the section.}
|
||||
|
||||
@item{@racket['hidden-number] --- A section number is computed for
|
||||
@item{@indexed-racket['hidden-number] --- A section number is computed for
|
||||
the section, but it is not rendered as part of the section name.}
|
||||
|
||||
@item{@racket['toc-hidden] --- The part title is not shown in tables
|
||||
@item{@indexed-racket['toc-hidden] --- The part title is not shown in tables
|
||||
of contents, including in ``on this page'' boxes. For Latex
|
||||
rendering, the part title is omitted only if it is unnumbered
|
||||
or has a hidden number.}
|
||||
|
||||
@item{@racket['hidden] --- The part title is not shown; for Latex
|
||||
@item{@indexed-racket['hidden] --- The part title is not shown; for Latex
|
||||
output, the part title is not shown only if its is empty, and
|
||||
in that case, it is also excluded from tables of contents. The
|
||||
@racket['toc-hidden] @tech{style property} usually should be included with
|
||||
@racket['hidden] (for consistency in non-Latex output).}
|
||||
|
||||
@item{@racket['grouper] --- The part is numbered with a Roman
|
||||
@item{@indexed-racket['grouper] --- The part is numbered with a Roman
|
||||
numeral, by default, and its subsections continue numbering as
|
||||
if they appeared in the preceeding part. In other words, the
|
||||
part acts like a ``part'' in a book where chapter numbering is
|
||||
|
@ -403,31 +417,39 @@ The recognized @tech{style properties} are as follows:
|
|||
|
||||
@item{@tech{numberer} --- A @tech{numberer} created with
|
||||
@racket[make-numberer] determines a representation of the
|
||||
part's section number as an extension of it's patent's number.
|
||||
part's section number as an extension of it's parent's number.
|
||||
A @tech{numberer} overrides the default representation, which
|
||||
is a natural number or (in the case of an accompanying
|
||||
@racket['grouper] property) a Roman numeral. If a
|
||||
@racket['unnumbered] property is also present, a
|
||||
@tech{numberer} property is ignored.}
|
||||
|
||||
@item{@racket['toc] --- Sub-parts of the part are rendered on separate
|
||||
@item{@indexed-racket['toc] --- Sub-parts of the part are rendered on separate
|
||||
pages for multi-page HTML mode.}
|
||||
|
||||
@item{@racket['non-toc] --- Initial sub-parts of the part are
|
||||
@item{@indexed-racket['non-toc] --- Initial sub-parts of the part are
|
||||
@emph{not} rendered on separate pages for multi-page HTML
|
||||
mode; this @tech{style property} applies only to the main part.}
|
||||
|
||||
@item{@racket['reveal] --- Shows sub-parts when this part is
|
||||
@item{@indexed-racket['reveal] --- Shows sub-parts when this part is
|
||||
displayed in a table-of-contents panel in HTML output (which
|
||||
normally shows only the top-level sections).}
|
||||
|
||||
@item{@racket['quiet] --- In HTML output and most other output modes,
|
||||
@item{@indexed-racket['quiet] --- In HTML output and most other output modes,
|
||||
hides entries for sub-parts of this part in a
|
||||
@racket[table-of-contents] or @racket[local-table-of-contents]
|
||||
listing except when those sub-parts are top-level entries in
|
||||
the listing.}
|
||||
|
||||
@item{@racket['no-toc] --- As a @tech{style property} for the main part of a
|
||||
@item{@indexed-racket['no-toc+aux] --- As a @tech{style property} for
|
||||
the main part of a rendered page, causes the HTML output to not
|
||||
include a margin box for the main table of contents, ``on this
|
||||
page'', or tables with the @racket['aux] style property. The
|
||||
@racket['no-toc+aux] property effectively implies
|
||||
@racket['no-toc] and @racket['no-sidebar], but also suppresses
|
||||
@racket['aux] tables.}
|
||||
|
||||
@item{@indexed-racket['no-toc] --- As a @tech{style property} for the main part of a
|
||||
rendered page, causes the HTML output to not include a margin box
|
||||
for the main table of contents; the ``on this page'' box that
|
||||
contains @racket[toc-element] and @racket[toc-target-element]
|
||||
|
@ -435,10 +457,18 @@ The recognized @tech{style properties} are as follows:
|
|||
multi-page documents) takes on the location and color of the
|
||||
main table of contents, instead.}
|
||||
|
||||
@item{@racket['no-sidebar] --- As a @tech{style property} for the main part of a
|
||||
@item{@indexed-racket['no-sidebar] --- As a @tech{style property} for the main part of a
|
||||
document, causes the HTML output to not include an ``on this
|
||||
page'' margin box.}
|
||||
|
||||
@item{@indexed-racket['no-index] --- Has no effect as a @tech{style
|
||||
property} on a @racket[part], but as a style property on a
|
||||
@racket[title] or @racket[part-start] that provides a
|
||||
@racket[part]'s style via @racket[decode], the
|
||||
@racket['no-index] @tech{style property} cause @racket[decode]
|
||||
to skip the generation of an entry for the part's title in the
|
||||
document index.}
|
||||
|
||||
@item{@racket[document-version] structure --- A version number for
|
||||
this part and its sub-parts (except as overridden). When it is
|
||||
not @racket[""] may be used when rendering a document; at a
|
||||
|
@ -463,7 +493,7 @@ The recognized @tech{style properties} are as follows:
|
|||
be set separately for parts that start different HTML pages,
|
||||
otherwise it is effectively inherited by sub-parts; the
|
||||
default is @racket["scribble-racket-lang.org"], but
|
||||
@exec{setup-plt} installs @racket["doc-racket-lang.org"] as the
|
||||
@exec{raco setup} installs @racket["doc-racket-lang.org"] as the
|
||||
@tt{id} for any document that it builds.}
|
||||
|
||||
@item{@racket[attributes] structure --- Provides additional HTML
|
||||
|
@ -494,6 +524,19 @@ The recognized @tech{style properties} are as follows:
|
|||
module path plus a section-tag string, so that the user can
|
||||
create a reference to the section.}
|
||||
|
||||
@item{@racket[link-render-style] structure --- Determines the default
|
||||
rendering of links to sections or other destinations within the
|
||||
section. See also @racket[link-element] and
|
||||
@racket[current-link-render-style].}
|
||||
|
||||
@item{@racket['enable-index-merge] --- On an index parts or one of
|
||||
its enclosing parts for Latex output, causes index entries to
|
||||
be merged when they have the same content, with multiple
|
||||
references for the same entry combined with @ltx{Smanypageref}.
|
||||
The @ltx{Smanypageref} Latex macro must be redefined to accept
|
||||
multiple @litchar{,}-separated labels and generate a suitable set of
|
||||
references. See also @racketmodname[scriblib/book-index].}
|
||||
|
||||
]
|
||||
|
||||
The @racket[to-collect] field contains @techlink{content} that is
|
||||
|
@ -505,7 +548,9 @@ sub-parts).
|
|||
|
||||
The @racket[parts] field contains sub-parts.
|
||||
|
||||
}
|
||||
@history[#:changed "1.25" @elem{Added @racket['no-index] support.}
|
||||
#:changed "1.26" @elem{Added @racket[link-render-style] support.}
|
||||
#:changed "1.27" @elem{Added @racket['no-toc+aux] support.}]}
|
||||
|
||||
|
||||
@defstruct[paragraph ([style style?] [content content?])]{
|
||||
|
@ -519,16 +564,16 @@ recognized:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['author] --- Typeset as the author of a document. Such
|
||||
@item{@indexed-racket['author] --- Typeset as the author of a document. Such
|
||||
paragraphs normally should appear only in the initial flow of a
|
||||
@racket[part] for a document, where they are treated specially
|
||||
by the Latex renderer by moving the author information to the
|
||||
title.}
|
||||
|
||||
@item{@racket['pretitle] --- Typeset before the title of the
|
||||
@item{@indexed-racket['pretitle] --- Typeset before the title of the
|
||||
enclosing part.}
|
||||
|
||||
@item{@racket['wraps] --- Like a @racket[#f] @tech{style name}, but not
|
||||
@item{@indexed-racket['wraps] --- Like a @racket[#f] @tech{style name}, but not
|
||||
@tech{boxable} in the sense of @racket[box-mode] for Latex output.}
|
||||
|
||||
]
|
||||
|
@ -540,12 +585,12 @@ The currently recognized @tech{style properties} are as follows:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['omitable] --- When a table cell contains a single
|
||||
@item{@indexed-racket['omitable] --- When a table cell contains a single
|
||||
@racket[paragraph] with the @racket['omitable] @tech{style property},
|
||||
then when rendering to HTML, no @tt{<p>} tag wraps the cell
|
||||
content.}
|
||||
|
||||
@item{@racket['div] --- Generates @tt{<div>} HTML output instead of
|
||||
@item{@indexed-racket['div] --- Generates @tt{<div>} HTML output instead of
|
||||
@tt{<p>} (unless a @racket[alt-tag] property is provided).}
|
||||
|
||||
@item{@racket[alt-tag] structure --- Generates the indicated HTML tag
|
||||
|
@ -554,11 +599,7 @@ The currently recognized @tech{style properties} are as follows:
|
|||
@item{@racket[attributes] structure --- Provides additional HTML
|
||||
attributes for the @tt{<p>}, @tt{<div>}, or alternate tag.}
|
||||
|
||||
@item{@racket[body-id] structure --- For HTML, uses the given string
|
||||
as an @tt{id} attribute of the @tt{<p>}, @tt{<div>}, or
|
||||
alternate tag.}
|
||||
|
||||
@item{@racket['never-indents] --- For Latex and @tech{compound
|
||||
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
|
||||
paragraphs}; see @racket[compound-paragraph].}
|
||||
|
||||
@item{@racket[box-mode] structure --- For Latex output, uses an alternate
|
||||
|
@ -585,14 +626,14 @@ recognized:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['boxed] --- Renders as a definition.
|
||||
@item{@indexed-racket['boxed] --- Renders as a definition.
|
||||
This style name is not intended for use on a table that is
|
||||
nested within a @racket['boxed] table; nested uses may look
|
||||
right for some renders of the style but not others.}
|
||||
|
||||
@item{@racket['centered] --- Centers HTML output horizontally.}
|
||||
@item{@indexed-racket['centered] --- Centers HTML output horizontally.}
|
||||
|
||||
@item{@racket['block] --- Prevents pages breaks in Latex output.}
|
||||
@item{@indexed-racket['block] --- Prevents pages breaks in Latex output.}
|
||||
|
||||
]
|
||||
|
||||
|
@ -613,13 +654,10 @@ The following @tech{style properties} are currently recognized:
|
|||
@item{@racket[attributes] structure --- Provides additional HTML
|
||||
attributes for the @tt{<table>} tag.}
|
||||
|
||||
@item{@racket[body-id] structure --- For HTML, uses the given string
|
||||
as an @tt{id} attribute of the @tt{<table>} tag.}
|
||||
|
||||
@item{@racket['aux] --- For HTML, include the table in the
|
||||
@item{@indexed-racket['aux] --- For HTML, include the table in the
|
||||
table-of-contents display for the enclosing part.}
|
||||
|
||||
@item{@racket['never-indents] --- For Latex and @tech{compound
|
||||
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
|
||||
paragraphs}; see @racket[compound-paragraph].}
|
||||
|
||||
]
|
||||
|
@ -648,9 +686,9 @@ names are recognized:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['compact] --- Reduces space between items.}
|
||||
@item{@indexed-racket['compact] --- Reduces space between items.}
|
||||
|
||||
@item{@racket['ordered] --- Generates @tt{<ol>} HTML output instead
|
||||
@item{@indexed-racket['ordered] --- Generates @tt{<ol>} HTML output instead
|
||||
of @tt{<ul>} or an Latex enumeration instead of an
|
||||
itemization.}
|
||||
]
|
||||
|
@ -662,16 +700,13 @@ The following @tech{style properties} are currently recognized:
|
|||
@item{@racket[attributes] structure --- Provides additional HTML
|
||||
attributes for the @tt{<ul>} or @tt{<ol>} tag.}
|
||||
|
||||
@item{@racket[body-id] structure --- For HTML, uses the given string
|
||||
as an @tt{id} attribute of the @tt{<ul>} or @tt{<ol>} tag.}
|
||||
|
||||
@item{@racket['never-indents] --- For Latex and @tech{compound
|
||||
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
|
||||
paragraphs}; see @racket[compound-paragraph].}
|
||||
|
||||
]}
|
||||
|
||||
|
||||
@defstruct[nested-flow ([style any/c]
|
||||
@defstruct[nested-flow ([style style?]
|
||||
[blocks (listof block?)])]{
|
||||
|
||||
A @techlink{nested flow} has a style and a @tech{flow}.
|
||||
|
@ -683,15 +718,15 @@ names are recognized:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['inset] --- Insets the nested flow relative to
|
||||
@item{@indexed-racket['inset] --- Insets the nested flow relative to
|
||||
surrounding text.}
|
||||
|
||||
@item{@racket['code-inset] --- Insets the nested flow relative to
|
||||
@item{@indexed-racket['code-inset] --- Insets the nested flow relative to
|
||||
surrounding text in a way suitable for code. If the nested flow
|
||||
has a single block, then it is @tech{boxable} in the sense of
|
||||
@racket[box-mode] for Latex output.}
|
||||
|
||||
@item{@racket['vertical-inset] --- Insets the nested flow vertically
|
||||
@item{@indexed-racket['vertical-inset] --- Insets the nested flow vertically
|
||||
relative to surrounding text, but not horizontally. If the
|
||||
nested flow has a single block, then it is @tech{boxable} in the sense
|
||||
of @racket[box-mode] for Latex output.}
|
||||
|
@ -702,33 +737,32 @@ The following @tech{style properties} are currently recognized:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['command] --- For Latex output, a string @tech{style
|
||||
@item{@indexed-racket['command] --- For Latex output, a string @tech{style
|
||||
name} is used as a command name instead of an environment
|
||||
name.}
|
||||
|
||||
@item{@racket['multicommand] --- For Latex output, a string
|
||||
@item{@indexed-racket['multicommand] --- For Latex output, a string
|
||||
@tech{style name} is used as a command name with a separate
|
||||
argument for each block in @racket[blocks].}
|
||||
|
||||
@item{@racket[attributes] structure --- Provides additional HTML
|
||||
attributes for the @tt{<blockquote>} tag.}
|
||||
|
||||
@item{@racket[body-id] structure --- For HTML, uses the given string
|
||||
as an @tt{id} attribute of the @tt{<blockquote>} tag.}
|
||||
|
||||
@item{@racket['never-indents] --- For Latex and @tech{compound
|
||||
@item{@indexed-racket['never-indents] --- For Latex and @tech{compound
|
||||
paragraphs}; see @racket[compound-paragraph].}
|
||||
|
||||
@item{@racket[box-mode] structure --- For Latex output, uses an alternate
|
||||
rendering form for @tech{boxing contexts} (such as a table cell); see
|
||||
@racket[box-mode].}
|
||||
|
||||
@item{@racket['decorative] --- The content of the nested flow is intended
|
||||
@item{@indexed-racket['decorative] --- The content of the nested flow is intended
|
||||
for decoration. Text output skips a decorative nested flow.}
|
||||
|
||||
@item{@racket[alt-tag] structure --- Generates the indicated HTML tag
|
||||
instead of @tt{<blockquote>}.}
|
||||
|
||||
@item{@indexed-racket['pretitle] --- For Latex, raises the contents
|
||||
of the flow to above the title.}
|
||||
]}
|
||||
|
||||
|
||||
|
@ -754,7 +788,7 @@ for Latex output (see @secref["extra-style"]). The following
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['command] --- For Latex output, a string @tech{style
|
||||
@item{@indexed-racket['command] --- For Latex output, a string @tech{style
|
||||
name} is used as a command name instead of an environment
|
||||
name.}
|
||||
|
||||
|
@ -764,10 +798,7 @@ for Latex output (see @secref["extra-style"]). The following
|
|||
@item{@racket[attributes] structure --- Provides additional HTML
|
||||
attributes for the @tt{<p>} or alternate tag.}
|
||||
|
||||
@item{@racket[body-id] structure --- For HTML, uses the given string
|
||||
as an @tt{id} attribute of the @tt{<p>} or alternate tag.}
|
||||
|
||||
@item{@racket['never-indents] --- For Latex within another
|
||||
@item{@indexed-racket['never-indents] --- For Latex within another
|
||||
@tech{compound paragraph}; see above.}
|
||||
|
||||
]}
|
||||
|
@ -792,7 +823,7 @@ The @racket[_get] procedure passed to @racket[traverse] takes a symbol
|
|||
and any value to act as a default; it returns information registered
|
||||
for the symbol or the given default if no value has been
|
||||
registered. The @racket[_set] procedure passed to @racket[traverse]
|
||||
takes a symbol and a value to registered for the symbol.
|
||||
takes a symbol and a value to be registered for the symbol.
|
||||
|
||||
@margin-note*{See also @racket[cond-block] in @racketmodname[scriblib/render-cond].}
|
||||
@;
|
||||
|
@ -829,18 +860,18 @@ recognized:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['tt], @racket['italic], @racket['bold], @racket['roman], @racket['sf],
|
||||
@item{@indexed-racket['tt], @racket['italic], @racket['bold], @racket['roman], @racket['sf],
|
||||
@racket['url], @racket['subscript], @racket['superscript],
|
||||
@racket['smaller], @racket['larger] ---
|
||||
Basic styles recognized by all renders.}
|
||||
|
||||
@item{@racket['hspace] --- Renders its @racket[content] as monospace
|
||||
@item{@indexed-racket['hspace] --- Renders its @racket[content] as monospace
|
||||
blanks.}
|
||||
|
||||
@item{@racket['newline] --- Renders a line break independent of
|
||||
@item{@indexed-racket['newline] --- Renders a line break independent of
|
||||
the @racket[content].}
|
||||
|
||||
@item{@racket['no-break] --- Prevents line breaks when rendering
|
||||
@item{@indexed-racket['no-break] --- Prevents line breaks when rendering
|
||||
@racket[content].}
|
||||
|
||||
]
|
||||
|
@ -873,18 +904,18 @@ The following @tech{style properties} are currently recognized:
|
|||
@item{@racket[script-property] structure --- For HTML, supplies a
|
||||
script alternative to @racket[content].}
|
||||
|
||||
@item{@racket[body-id] structure --- For HTML uses the given
|
||||
string as an @tt{id} attribute of the @tt{<span>} tag.}
|
||||
@item{@racket[xexpr-property] structure --- For HTML, supplies literal
|
||||
HTML to render before and after @racket[content].}
|
||||
|
||||
@item{@racket['aux] --- Intended for use in titles, where the
|
||||
@item{@indexed-racket['aux] --- Intended for use in titles, where the
|
||||
auxiliary part of the title can be omitted in hyperlinks. See,
|
||||
for example, @racket[secref].}
|
||||
|
||||
@item{@racket['tt-chars] --- For Latex output, when the @tech{style
|
||||
@item{@indexed-racket['tt-chars] --- For Latex output, when the @tech{style
|
||||
name} is a string, render the element's content with escapes
|
||||
suitable for Latex @tt{tt} mode.}
|
||||
|
||||
@item{@racket['exact-chars] --- For Latex output, when the @tech{style
|
||||
@item{@indexed-racket['exact-chars] --- For Latex output, when the @tech{style
|
||||
name} is a string or @racket[#f], render the elements content exactly
|
||||
(without escapes).}
|
||||
|
||||
|
@ -894,7 +925,8 @@ The following @tech{style properties} are currently recognized:
|
|||
]
|
||||
|
||||
@history[#:changed "1.6" @elem{Changed @racket['exact-chars] handling to
|
||||
take effect when the style name is @racket[#f].}]}
|
||||
take effect when the style name is @racket[#f].}
|
||||
#:changed "1.27" @elem{Changed to support @racket[xexpr-property].}]}
|
||||
|
||||
|
||||
@defstruct[(image-element element) ([path (or/c path-string?
|
||||
|
@ -960,19 +992,66 @@ field.}
|
|||
|
||||
@defstruct[(link-element element) ([tag tag?])]{
|
||||
|
||||
Hyperlinks the content to @racket[_tag].
|
||||
Represents a hyperlink to @racket[_tag].
|
||||
|
||||
Normally, the content of the element is rendered as the hyperlink.
|
||||
When @racket[_tag] is a part tag and the content of the element is
|
||||
@racket[null], then the hyperlink uses the target part's number and/or
|
||||
title as the content. In that case, if the section number is preceded
|
||||
by a word, the word starts in uppercase if the element's style includes a
|
||||
@racket['uppercase] property.
|
||||
@racket[null], however, rendering is treated specially based on the
|
||||
@racket[_mode] value of a @racket[link-render-style] @tech{style
|
||||
property}:
|
||||
|
||||
The following symbol is recognized as a @tech{style property}:
|
||||
@itemlist[
|
||||
|
||||
@item{For HTML output, in the @racket['default] mode, the generated
|
||||
reference is the hyperlinked title of the elements in the
|
||||
section's title content, except that elements with the
|
||||
@racket['aux] @tech{style property} are omitted in the
|
||||
hyperlink label.
|
||||
|
||||
In @racket['number] mode, the section title is not shown.
|
||||
Instead, the word ``section'' is shown followed by a
|
||||
hyperlinked section number. The word ``section'' starts in
|
||||
uppercase if the element's style includes a @racket['uppercase]
|
||||
property.}
|
||||
|
||||
@item{For Latex/PDF output, the generated reference's format can
|
||||
depend on the document style in addition the @racket[_mode].
|
||||
For the @racket['default] mode and a default document style, a
|
||||
section number is shown by the word ``section'' followed by the
|
||||
section number, and the word ``section'' and the section number
|
||||
are together hyperlinked. The word ``section'' starts in
|
||||
uppercase if the element's style includes a @racket['uppercase]
|
||||
property. The @racketmodname[scribble/manual] style uses the
|
||||
symbol ``§'' in place of the word ``section''.
|
||||
|
||||
In @racket['number] mode, rendering is the same, except that
|
||||
only the number is hyperlinked, not the word ``section'' or
|
||||
the ``§'' symbol.
|
||||
|
||||
A new document style can customize Latex/PDF output (see
|
||||
@secref["config"]) by redefining the @ltx{SecRefLocal}, @|etc|,
|
||||
macros (see @secref["builtin-latex"]). The @ltx{SecRef},
|
||||
@|etc|, variants are used in @racket['number] mode.}
|
||||
|
||||
]
|
||||
|
||||
If a @racket[link-render-style] @tech{style property} is not attached
|
||||
to a @racket[link-element] that refers to a part, a
|
||||
@racket[link-render-style] @tech{style property} that is attached to
|
||||
an enclosing part is used, since attaching a
|
||||
@racket[link-render-style] @tech{style property} to a part causes
|
||||
@racket[current-link-render-style] to be set while rendering the part.
|
||||
Otherwise, the render-time value of @racket[current-link-render-style]
|
||||
determine's a @racket[link-element]'s rendering.
|
||||
|
||||
The following style properties are recognized in addition to the style
|
||||
properties for all @racket[element]s:
|
||||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['indirect-link] --- For HTML output, treats the link as
|
||||
@item{@racket[link-render-style] structure --- As described above.}
|
||||
|
||||
@item{@indexed-racket['indirect-link] --- For HTML output, treats the link as
|
||||
``external''. When rendering to HTML and the
|
||||
@method[render-mixin set-external-tag-path] method is called to
|
||||
provide an external-link URL, then the resolution of the
|
||||
|
@ -980,7 +1059,9 @@ The following symbol is recognized as a @tech{style property}:
|
|||
some cases, patched by JavaScript when the documentation is
|
||||
viewed in a browser).}
|
||||
|
||||
]}
|
||||
]
|
||||
|
||||
@history[#:changed "1.26" @elem{Added @racket[link-render-style] support.}]}
|
||||
|
||||
|
||||
@defstruct[(index-element element) ([tag tag?]
|
||||
|
@ -1115,9 +1196,9 @@ reverse order):
|
|||
any number or lists element, while @racket[""] is used in place
|
||||
of all non-empty strings.}
|
||||
|
||||
]}
|
||||
]
|
||||
|
||||
@history[#:changed "6.4" @elem{Added @racket[(list/c string? string?)]
|
||||
@history[#:changed "1.1" @elem{Added @racket[(list/c string? string?)]
|
||||
number items for
|
||||
@tech{numberer}-generated section
|
||||
numbers.}]}
|
||||
|
@ -1174,26 +1255,26 @@ The following are recognized as cell-@tech{style properties}:
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@racket['left] --- Left-align the cell content.}
|
||||
@item{@indexed-racket['left] --- Left-align the cell content.}
|
||||
|
||||
@item{@racket['right] --- Right-align the cell content top baselines.}
|
||||
@item{@indexed-racket['right] --- Right-align the cell content top baselines.}
|
||||
|
||||
@item{@racket['center] --- Center the cell content horizontally.}
|
||||
@item{@indexed-racket['center] --- Center the cell content horizontally.}
|
||||
|
||||
@item{@racket['top] --- Top-align the cell content.}
|
||||
@item{@indexed-racket['top] --- Top-align the cell content.}
|
||||
|
||||
@item{@racket['baseline] --- Align the cell content top baselines.}
|
||||
@item{@indexed-racket['baseline] --- Align the cell content top baselines.}
|
||||
|
||||
@item{@racket['bottom] --- bottom-align the cell content.}
|
||||
@item{@indexed-racket['bottom] --- bottom-align the cell content.}
|
||||
|
||||
@item{@racket['vcenter] --- Center the cell content vertically.}
|
||||
@item{@indexed-racket['vcenter] --- Center the cell content vertically.}
|
||||
|
||||
@item{@racket['border] --- Draw a line around all sides of the
|
||||
@item{@indexed-racket['border] --- Draw a line around all sides of the
|
||||
cell. Borders along a shared edge of adjacent cells are
|
||||
collapsed into a single line.}
|
||||
|
||||
@item{@racket['left-border], @racket['right-border],
|
||||
@racket['top-border], or @racket['bottom-border] --- Draw a
|
||||
@item{@indexed-racket['left-border], @indexed-racket['right-border],
|
||||
@indexed-racket['top-border], or @indexed-racket['bottom-border] --- Draw a
|
||||
line along the corresponding side of the cell (with the same
|
||||
border collapsing as for @racket['border]).}
|
||||
|
||||
|
@ -1349,10 +1430,10 @@ Returns the width in characters of the given @tech{block}.}
|
|||
@defproc[(part-number-item? [v any/c]) boolean]{
|
||||
|
||||
Return @racket[#t] if @racket[v] is @racket[#f], an exact non-negative
|
||||
integer, a string, or a list containing two strings. See @racket[part]
|
||||
integer, a string, or a list containing two strings. See @racket[collected-info]
|
||||
for information on how different representations are used for numbering.
|
||||
|
||||
@history[#:added "6.4"]}
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
|
||||
@deftogether[(
|
||||
|
@ -1398,7 +1479,47 @@ identity is based on a @racket[generated-tag]. The result of
|
|||
number plus an updated hash table with an incremented value for the
|
||||
@tech{numberer}.
|
||||
|
||||
@history[#:added "6.4"]}
|
||||
Typically, the rendered form of a section number (produced by
|
||||
@racket[numberer-step]) is a list containing two strings. The first
|
||||
string is the part's immediate number, which can be combined with a
|
||||
prefix for enclosing parts' numbers. The second string is a separator
|
||||
that is placed after the part's number and before a subsection's
|
||||
number for each subsection. If @racket[numberer-step] produces a plain
|
||||
string for the rendered number, then it is not added as a prefix to
|
||||
subsection numbers. See also @racket[collected-info].
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
|
||||
@defstruct[link-render-style ([mode (or/c 'default 'number)])]{
|
||||
|
||||
Used as a @tech{style property} for a @racket[part] or a specific
|
||||
@racket[link-element] to control the way that a hyperlink is rendered
|
||||
for a part via @racket[secref] or for a figure via @racket[figure-ref]
|
||||
from @racketmodname[scriblib/figure].
|
||||
|
||||
The @racket['default] and @racket['number] modes represent generic
|
||||
hyperlink-style configurations that could make sense for various kinds
|
||||
of references. The @racket['number] style is intended to mean that a
|
||||
specific number is shown for the reference and that only the number is
|
||||
hyperlinked. The @racket['default] style is more flexible, allowing a
|
||||
more appropriate choice for the rendering context, such as using the
|
||||
target section's name for a hyperlink in HTML.
|
||||
|
||||
@history[#:added "1.26"]}
|
||||
|
||||
|
||||
@defparam[current-link-render-style style link-render-style?]{
|
||||
|
||||
A parameter that determines the default rendering style for a section
|
||||
link.
|
||||
|
||||
When a @racket[part] has a @racket[link-render-style] as one of its
|
||||
@tech{style properties}, then the @racket[current-link-render-style]
|
||||
parameter is set during the @tech{resolve pass} and @tech{render pass}
|
||||
for the @racket[part]'s content.
|
||||
|
||||
@history[#:added "1.26"]}
|
||||
|
||||
|
||||
@defstruct[collect-info ([fp any/c] [ht any/c] [ext-ht any/c]
|
||||
|
@ -1468,7 +1589,7 @@ documentation.
|
|||
@defproc[(resolve-get/ext? [p (or/c part? #f)] [ri resolve-info?] [key info-key?])
|
||||
(values any/c boolean?)]{
|
||||
|
||||
Like @racket[render-get], but returns a second value to indicate
|
||||
Like @racket[resolve-get], but returns a second value to indicate
|
||||
whether the resulting information originated from an external source
|
||||
(i.e., a different document).}
|
||||
|
||||
|
@ -1476,7 +1597,7 @@ whether the resulting information originated from an external source
|
|||
@defproc[(resolve-get/ext-id [p (or/c part? #f)] [ri resolve-info?] [key info-key?])
|
||||
(values any/c (or/c boolean? string?))]{
|
||||
|
||||
Like @racket[render-get/ext?], but the second result can be a string
|
||||
Like @racket[resolve-get/ext?], but the second result can be a string
|
||||
to indicate the source document's identification as established via
|
||||
@racket[load-xref] and a @racket[#:doc-id] argument.
|
||||
|
||||
|
@ -1591,7 +1712,7 @@ tag.}
|
|||
|
||||
Use as a @tech{style property} for an @racket[element],
|
||||
@racket[paragraph], or @racket[compound-paragraph] to substitute an
|
||||
alternate HTML tag (instead of @tt{<span>}, @tt{<p>}, @tt{div},
|
||||
alternate HTML tag (instead of @tt{<span>}, @tt{<p>}, @tt{<div>},
|
||||
@|etc|).}
|
||||
|
||||
|
||||
|
@ -1620,16 +1741,43 @@ Used as a @tech{style property} with @racket[element] to supply a
|
|||
script alternative to the element content.}
|
||||
|
||||
|
||||
@defstruct[xexpr-property ([before xexpr/c]
|
||||
[after xexpr/c])]{
|
||||
|
||||
Used as a @tech{style property} with @racket[element] to supply literal
|
||||
HTML that is rendered before and after element content.
|
||||
|
||||
@as-examples["Example:"
|
||||
@codeblock[#:keep-lang-line? #t]|{
|
||||
#lang scribble/base
|
||||
@(require scribble/core
|
||||
scribble/html-properties
|
||||
(only-in xml cdata))
|
||||
|
||||
@(define comments (xexpr-property
|
||||
(cdata #f #f "<!-- before -->")
|
||||
(cdata #f #f "<!-- after -->")))
|
||||
|
||||
Here is some
|
||||
@elem[#:style (style #f (list comments))]{content with comments around}.
|
||||
}|]
|
||||
|
||||
@history[#:added "1.27"]}
|
||||
|
||||
|
||||
@defstruct[css-addition ([path (or/c path-string?
|
||||
(cons/c 'collects (listof bytes?))
|
||||
url?
|
||||
bytes?)])]{
|
||||
|
||||
Used as a @tech{style property} to supply a CSS file (if @racket[path]
|
||||
is a path, string, or list), URL (if @racket[path] is a @racket[url]) or content (if @racket[path] is a byte
|
||||
string) to be referenced or included in the generated HTML. This
|
||||
property can be attached to any style, and all additions are collected
|
||||
to the top of the generated HTML page.
|
||||
is a path, string, or list), URL (if @racket[path] is a @racket[url])
|
||||
or content (if @racket[path] is a byte string) to be referenced or
|
||||
included in the generated HTML. This property can be attached to any
|
||||
style, and all additions are collected and lifted to the enclosing
|
||||
generated HTML. When the style property is attached to a @tech{part},
|
||||
then it is also propagated to any generated HTML for a subpart of the
|
||||
part.
|
||||
|
||||
The @racket[path] field can be a result of
|
||||
@racket[path->main-collects-relative].}
|
||||
|
@ -1663,7 +1811,7 @@ Like @racket[css-style-addition], but for a JavaScript file instead of a CSS fil
|
|||
@defstruct[body-id ([value string?])]{
|
||||
|
||||
Used as a @tech{style property} to associate an @tt{id} attribute with
|
||||
an HTML tag.}
|
||||
an HTML tag within a main @racket[part].}
|
||||
|
||||
|
||||
@defstruct[document-source ([module-path module-path?])]{
|
||||
|
@ -1703,13 +1851,24 @@ For a @racket[part] that corresponds to an HTML page, adds content to
|
|||
the @tt{<head>} tag.}
|
||||
|
||||
|
||||
@defstruct[render-convertible-as ([types (listof (or/c 'png-bytes 'svg-bytes))])]{
|
||||
@defstruct[head-addition ([xexpr xexpr/c])]{
|
||||
|
||||
Like @racket[head-extra] in content, but propagated to enclosing and
|
||||
nested HTML pages like @racket[css-addition]. Additions to @tt{<head>}
|
||||
via @racket[head-addition] appear before additions via @racket[head-extra].
|
||||
|
||||
@history[#:added "1.38"]}
|
||||
|
||||
|
||||
@defstruct[render-convertible-as ([types (listof (or/c 'png-bytes 'svg-bytes 'gif-bytes))])]{
|
||||
For a @racket[part] that corresponds to an HTML page,
|
||||
controls how objects that subscribe to the @racketmodname[file/convertible]
|
||||
protocol are rendered.
|
||||
|
||||
The alternatives in the @racket[types] field are tried in order
|
||||
and the first one that succeeds is used in the html output.
|
||||
|
||||
@history[#:changed "1.34" @elem{Added support for @racket['gif-bytes].}]
|
||||
}
|
||||
|
||||
@defstruct[part-link-redirect ([url url?])]{
|
||||
|
@ -1772,7 +1931,7 @@ The @racket[path] field can be a result of
|
|||
Used as a @tech{style property} on the main @racket[part] of a document
|
||||
to set a default prefix file, style file, and extra files (see
|
||||
@secref["config-style"]). The defaults are used by the
|
||||
@exec{scribble} command-line tool for and @DFlag{latex} or @DFlag{pdf}
|
||||
@exec{scribble} command-line tool for @DFlag{latex} or @DFlag{pdf}
|
||||
mode if none are supplied via @DFlag{prefix} and @DFlag{style} (where
|
||||
@racket[extra-files] are used only when @racket[prefix] is used). A
|
||||
byte-string value is used directly like file content, and a path can
|
||||
|
@ -1799,3 +1958,31 @@ See also @racketmodname[scribble/latex-prefix].}
|
|||
|
||||
Used as a @tech{style property} on an @racket[element] to add extra
|
||||
arguments to the element's command in Latex output.}
|
||||
|
||||
@defstruct[command-optional ([arguments (listof string?)])]{
|
||||
|
||||
Used as a @tech{style property} on a @racket[element] to add
|
||||
optional arguments to the element's command in Latex output.
|
||||
|
||||
@history[#:added "1.20"]
|
||||
}
|
||||
|
||||
@defstruct[short-title ([text (or/c string? #f)])]{
|
||||
|
||||
Used as a @tech{style property} on a @racket[title-decl].
|
||||
Attaches a short title to the title for a @racket[part] if
|
||||
the Latex class file uses a short title.
|
||||
|
||||
@history[#:added "1.20"]
|
||||
}
|
||||
|
||||
@defstruct[table-row-skip ([amount string?])]{
|
||||
|
||||
Used as a @tech{style property} in @racket[table-cells] to specify a
|
||||
spacing adjustment between the cell's row and the row afterward, such
|
||||
as @racket["1ex"] to increase the space or @racket["-1ex"] to
|
||||
decrease it. If multiple cells on a row provide this property, the
|
||||
first one in the row is used.
|
||||
|
||||
@history[#:added "1.33"]
|
||||
}
|
||||
|
|
|
@ -94,8 +94,15 @@ parsing. Instances of @racket[section] trigger are used as-is as
|
|||
subsections, and instances of @racket[paragraph] and other
|
||||
flow-element datatypes are used as-is in the enclosing flow.
|
||||
|
||||
As a part is decoded, as long as the style for the part does not
|
||||
include the @tech{style property} @racket['hidden] or
|
||||
@racket['no-index], an entry is added to the document index for the
|
||||
part's title.
|
||||
|
||||
Portions of @racket[lst] are within a part are decoded using
|
||||
@racket[decode-flow].}
|
||||
@racket[decode-flow].
|
||||
|
||||
@history[#:changed "1.25" @elem{Added @racket['no-index] support.}]}
|
||||
|
||||
|
||||
@defproc[(decode-part [lst (listof pre-part?)]
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
|
||||
@(define css tt)
|
||||
|
||||
@(define-syntax (opt-example stx)
|
||||
;; A #\? 'paren-shape value triggers RktOpt:
|
||||
#`@racket[#,(syntax-property #'(in-example) 'paren-shape '#\?)])
|
||||
|
||||
@title{Manual All-Styles Document}
|
||||
|
||||
@table-of-contents[]
|
||||
|
@ -76,7 +72,9 @@
|
|||
|
||||
@item{@css{RktModLink} (a linked module reference): @racketmodname[racket/base]}
|
||||
|
||||
@item{@css{RktOpt} (option-argument brackets): brackets in @opt-example[]}
|
||||
@item{@css{RktOpt} (option-argument brackets): brackets in
|
||||
|
||||
@defproc[#:link-target? #f (f [x any/c 1]) any]}
|
||||
|
||||
@item{@css{RktKw} (not normally used): @racketkeywordfont{example}}
|
||||
|
||||
|
|
|
@ -177,10 +177,11 @@ As an example,
|
|||
@codeblock|{
|
||||
#lang scribble/manual
|
||||
@(require racket/sandbox
|
||||
scribble/eval)
|
||||
scribble/example)
|
||||
@(define my-evaluator
|
||||
(parameterize ([sandbox-output 'string]
|
||||
[sandbox-error-output 'string])
|
||||
[sandbox-error-output 'string]
|
||||
[sandbox-memory-limit 50])
|
||||
(make-evaluator 'typed/racket/base)))
|
||||
|
||||
@examples[#:eval my-evaluator
|
||||
|
@ -282,13 +283,13 @@ an evaluator (e.g., because it is defined in a module body).}
|
|||
|
||||
|
||||
@defparam[scribble-eval-handler handler
|
||||
((any/c . -> . any) any/c boolean? . -> . any)]{
|
||||
((any/c . -> . any) boolean? any/c . -> . any)]{
|
||||
|
||||
A parameter that serves as a hook for evaluation. The evaluator to use
|
||||
is supplied as the first argument to the parameter's value, and the
|
||||
second argument is the form to evaluate. The last argument is
|
||||
@racket[#t] if exceptions are being captured (to display exception
|
||||
results), @racket[#f] otherwise.}
|
||||
is supplied as the first argument to the parameter's value.
|
||||
The second argument is @racket[#t] if exceptions are being captured (to display
|
||||
exception results), @racket[#f] otherwise.
|
||||
The third argument is the form to evaluate.}
|
||||
|
||||
@defparam[scribble-exn->string handler (-> (or/c exn? any/c) string?)]{
|
||||
A parameter that controls how exceptions are rendered by
|
||||
|
|
|
@ -10,5 +10,6 @@
|
|||
@include-section["book.scrbl"]
|
||||
@include-section["report.scrbl"]
|
||||
@include-section["sigplan.scrbl"]
|
||||
@include-section["acmart.scrbl"]
|
||||
@include-section["jfp.scrbl"]
|
||||
@include-section["lncs.scrbl"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#lang scribble/doc
|
||||
@(require scribble/manual scribble/bnf "utils.rkt"
|
||||
pict
|
||||
(for-label scriblib/figure scribble/base scribble/sigplan
|
||||
(for-label scriblib/figure scribble/base (only-in scribble/acmart abstract)
|
||||
(except-in pict table)))
|
||||
|
||||
@(define-syntax-rule (samplemod . text) (codeblock . text))
|
||||
|
@ -176,7 +176,7 @@ probably need a different topic. But you can start making the current
|
|||
content look right by changing the first line to
|
||||
|
||||
@samplemod|{
|
||||
#lang scribble/sigplan
|
||||
#lang scribble/acmart
|
||||
}|
|
||||
|
||||
If you're instead working toward Racket library documentation,
|
||||
|
@ -192,15 +192,15 @@ top-level sections turned into chapters that each start on a new page.
|
|||
If you have split the document into multiple files, the first line of
|
||||
the main document file determines the output format.
|
||||
|
||||
Using @racketmodname[scribble/sigplan] or
|
||||
Using @racketmodname[scribble/acmart] or
|
||||
@racketmodname[scribble/manual] does not change the rendered HTML for
|
||||
a document---aside from @racketmodname[scribble/manual] adding a
|
||||
version number---but it changes the set of bindings available in the
|
||||
document body. For example, with @racketmodname[scribble/sigplan], the
|
||||
document body. For example, with @racketmodname[scribble/acmart], the
|
||||
introductory text can be marked as an abstract:
|
||||
|
||||
@samplemod|{
|
||||
#lang scribble/sigplan
|
||||
#lang scribble/acmart
|
||||
|
||||
@title{On the Cookie-Eating Habits of Mice}
|
||||
|
||||
|
@ -221,7 +221,7 @@ When a document is implemented across multiple files, changing the
|
|||
language of the main document can set the style for all of the parts,
|
||||
but it does not introduce bindings into the other part files. For
|
||||
example, if you change the language of @filepath{mouse.scrbl} to
|
||||
@racketmodname[scribble/sigplan], then @racket[abstract] becomes
|
||||
@racketmodname[scribble/acmart], then @racket[abstract] becomes
|
||||
available in @filepath{mouse.scrbl} but not in @filepath{milk.scrbl}
|
||||
or @filepath{straw.scrbl}. In other words, operator names are
|
||||
lexically scoped.
|
||||
|
@ -230,7 +230,7 @@ lexically scoped.
|
|||
@section{More Functions}
|
||||
|
||||
The @racketmodname[scribble/base] language provides a collection of
|
||||
basic operations (and The @racketmodname[scribble/sigplan] and
|
||||
basic operations (both @racketmodname[scribble/acmart] and
|
||||
@racketmodname[scribble/manual] are supersets of
|
||||
@racketmodname[scribble/base]). Many of the operations are style
|
||||
variations that you can apply to text:
|
||||
|
@ -322,7 +322,7 @@ which renders as
|
|||
|
||||
The @racket[tabular] function takes a list of lists to organize into a
|
||||
two-dimensional table. By default, no spacing is added between columns,
|
||||
so supply a @racket[#:sep] argument to acts as a column separator.
|
||||
so supply a @racket[#:sep] argument to act as a column separator.
|
||||
For example,
|
||||
|
||||
@sample|{
|
||||
|
@ -399,7 +399,7 @@ What if you want to provide arguments in text mode, but you also want
|
|||
to supply other optional arguments? You can use both
|
||||
@litchar{[}...@litchar{]} and @litchar["{"]...@litchar["}"] for an
|
||||
operation, as long as the @litchar{[}...@litchar{]} is first, and as
|
||||
long as no character separate the closing @litchar{]} from the
|
||||
long as no characters separate the closing @litchar{]} from the
|
||||
opening @litchar["{"]. For example, calling @racket[italic] is the
|
||||
same as using @racket[elem] with the @racket['italic] style:
|
||||
|
||||
|
@ -491,7 +491,7 @@ label), then the string is typically provided through
|
|||
Sometimes, both @litchar{[}...@litchar{]} and
|
||||
@litchar["{"]...@litchar["}"] are used, where the former surround
|
||||
Racket arguments that precede text to typeset. Finally, if a form is a
|
||||
purely Racket-level form with not typeset result, such as a
|
||||
purely Racket-level form with no typeset result, such as a
|
||||
@racket[require] to import more operations, then typically just
|
||||
@litchar["@"] is used.
|
||||
|
||||
|
@ -573,7 +573,7 @@ and @litchar{'} to suitable curly quotes.
|
|||
The decoding process for document's stream is ultimately determined by
|
||||
the @hash-lang[] line that starts the document. The
|
||||
@racketmodname[scribble/base], @racketmodname[scribble/manual], and
|
||||
@racketmodname[scribble/sigplan] languages all use the same
|
||||
@racketmodname[scribble/acmart] languages all use the same
|
||||
@racket[decode] operation. The @racketmodname[scribble/text] language,
|
||||
however, acts more like a plain-text generator and preprocessor, and it
|
||||
does not perform any such decoding rules. (For more on
|
||||
|
@ -679,4 +679,4 @@ need more power.
|
|||
|
||||
If you are interested in text generation and preprocessing, continue
|
||||
with @secref["reader"], but then switch to
|
||||
@other-doc['(lib "scribblings/scribble/scribble-pp.scrbl")].
|
||||
@other-doc['(lib "scribblings/scribble/scribble-pp.scrbl")].
|
||||
|
|
|
@ -175,7 +175,7 @@ The following example illustrates section hyperlinks:
|
|||
|
||||
Since the page is so short, the hyperlinks in the above example are
|
||||
more effective if you change the @filepath{info.rkt} file to add the
|
||||
@racket['multi-file] flag:
|
||||
@racket['multi-page] flag:
|
||||
|
||||
@racketblock[
|
||||
(define scribblings '(("manual.scrbl" (multi-page))))
|
||||
|
|
|
@ -94,6 +94,7 @@ as XHTML.
|
|||
style ; style info, which may include CDATA sections
|
||||
script ; script statements, which may include CDATA sections
|
||||
noscript ; alternate content container for non script-based rendering
|
||||
slot
|
||||
frameset ; only one noframes element permitted per document
|
||||
frame ; tiled window within frameset
|
||||
iframe ; inline subwindow
|
||||
|
@ -107,6 +108,7 @@ as XHTML.
|
|||
h4
|
||||
h5
|
||||
h6
|
||||
hgroup
|
||||
ul ; Unordered list
|
||||
ol ; Ordered (numbered) list
|
||||
menu ; single column list (DEPRECATED)
|
||||
|
@ -165,7 +167,10 @@ as XHTML.
|
|||
colgroup ; column group, olds col
|
||||
tr ; holds th or td
|
||||
th ; header cell
|
||||
td)
|
||||
td
|
||||
details
|
||||
dialog
|
||||
menuitem)
|
||||
|
||||
@(define-syntax-rule (def-tags/empty tag ...)
|
||||
@deftogether[(
|
||||
|
@ -179,7 +184,8 @@ as XHTML.
|
|||
(output-xml (hr))]})
|
||||
|
||||
@(def-tags/empty
|
||||
base meta link hr br basefont param img area input isindex col)
|
||||
base meta link hr br basefont param img area input isindex col
|
||||
embed keygen wbr)
|
||||
|
||||
@(define-syntax-rule (def-entities ent ...)
|
||||
@deftogether[(
|
||||
|
@ -213,6 +219,52 @@ Procedures a value that renders as an inline style sheet.
|
|||
".racket { font-size: xx-large; }"))]}
|
||||
|
||||
|
||||
@subsection[#:tag "extra-html"]{Other HTML elements}
|
||||
|
||||
@defmodule[scribble/html/extra]
|
||||
|
||||
Provides renderers for
|
||||
@hyperlink["https://html.spec.whatwg.org/multipage/#toc-semantics"]{HTML
|
||||
elements} that are not provided by @racket[scribble/html/html].
|
||||
|
||||
@(def-tags
|
||||
article
|
||||
aside
|
||||
audio
|
||||
bdi
|
||||
canvas
|
||||
data
|
||||
datalist
|
||||
figcaption
|
||||
figure
|
||||
footer
|
||||
header
|
||||
main
|
||||
map
|
||||
mark
|
||||
math
|
||||
meter
|
||||
nav
|
||||
output
|
||||
picture
|
||||
progress
|
||||
rb
|
||||
rp
|
||||
rt
|
||||
rtc
|
||||
ruby
|
||||
section
|
||||
summary
|
||||
svg
|
||||
template
|
||||
time
|
||||
video)
|
||||
|
||||
@(def-tags/empty
|
||||
source
|
||||
track)
|
||||
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@section[#:tag "html-xml"]{Generating XML Strings}
|
||||
|
|
|
@ -55,3 +55,19 @@ If different authors have different affiliations, use
|
|||
use @racket[affiliation-mark] before each different affiliation within
|
||||
a single @racket[affiliation], using @racket[(affiliation-sep)] to
|
||||
separate affiliations.}
|
||||
|
||||
Example:
|
||||
@codeblock|{
|
||||
#lang scribble/jfp
|
||||
|
||||
@title{My First Love Story}
|
||||
|
||||
@((author/short "Romeo M. and Juliet C.")
|
||||
"ROMEO" (affiliation-mark "1")
|
||||
" and "
|
||||
"JULIET" (affiliation-mark "2")
|
||||
@affiliation[
|
||||
"House Montague" (affiliation-mark "1")
|
||||
(affiliation-sep)
|
||||
"House Capulet" (affiliation-mark "2")])
|
||||
}|
|
||||
|
|
|
@ -69,6 +69,15 @@ a @racket[doc] submodule that is expanded (so that the content is
|
|||
effectively re-expanded). The @racketidfont{doc} submodule is declared
|
||||
with @racket[module*].
|
||||
|
||||
To include a @racketmodname[scribble/lp2] document named
|
||||
@filepath{file.scrbl} into another Scribble document,
|
||||
import the @racketidfont{doc} submodule:
|
||||
|
||||
@codeblock[#:keep-lang-line? #false]|{
|
||||
#lang scribble/manual
|
||||
@include-section[(submod "file.scrbl" doc)]
|
||||
}|
|
||||
|
||||
@history[#:added "1.8"
|
||||
#:changed "1.17" @elem{Declared the @racketidfont{doc} submodule with
|
||||
@racket[module*] instead of @racket[module].}]
|
||||
|
@ -127,8 +136,8 @@ used.
|
|||
@defmodule[scribble/lp-include]{The
|
||||
@racketmodname[scribble/lp-include] library is normally used within a
|
||||
Scribble document---that is, a module that starts with something like
|
||||
@racket[#, @hash-lang[] @racketmodname[scribble/base]] or @racket[#, @hash-lang[]
|
||||
@racketmodname[scribble/manual]], instead of @racket[#, @hash-lang[] @racketmodname[racket]].}
|
||||
@hash-lang[] @racketmodname[scribble/base] or @hash-lang[] @racketmodname[scribble/manual],
|
||||
instead of @hash-lang[] @racketmodname[racket].}
|
||||
|
||||
@defform[(lp-include filename)]{
|
||||
Includes the source of @racket[filename] as the typeset version of the literate
|
||||
|
|
|
@ -106,7 +106,7 @@ for-label bindings in the lexical environment of the syntax object
|
|||
provided by @racket[context-expr]. The default @racket[context-expr]
|
||||
has the same lexical context as the first @racket[str-expr].
|
||||
When @racket[line-number-expr] is true, line number is enabled starting
|
||||
from @racket[line-number-expr], and @racket[line-number-sep] controls
|
||||
from @racket[line-number-expr], and @racket[line-number-sep-expr] controls
|
||||
the separation (in spaces; defaults to 1) between the line numbers and
|
||||
code.
|
||||
|
||||
|
@ -184,13 +184,14 @@ produces the typeset result
|
|||
[#:keep-lang-line? keep? any/c #t]
|
||||
[#:line-numbers line-numbers (or/c #f exact-nonnegative-integer?) #f]
|
||||
[#:line-number-sep line-number-sep exact-nonnegative-integer? 1]
|
||||
[#:block? block? #t]
|
||||
[#:block? return-block? any/c #t]
|
||||
[strs string?] ...)
|
||||
block?]{
|
||||
(if return-block? block? element?)]{
|
||||
A function-based version of @racket[codeblock], allowing you to compute the @racket[strs] arguments.
|
||||
|
||||
Unlike @racket[codeblock], the default @racket[context] argument (@racket[#f]) implies that
|
||||
the context is untouched. The other arguments are treated the same way.
|
||||
the context is untouched and the @racket[return-block?] argument determines the result
|
||||
structure. The other arguments are treated the same way as @racket[codeblock].
|
||||
}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
@ -263,7 +264,7 @@ produces
|
|||
(+ 1 (unsyntax (elem (racket x) (subscript "2"))))
|
||||
]
|
||||
|
||||
The @racket[escape-id] that defaults to @racket[unsyntax] is regonized via
|
||||
The @racket[escape-id] that defaults to @racket[unsyntax] is recognized via
|
||||
@racket[free-identifier=?], so a binding can hide the escape behavior:
|
||||
|
||||
@RACKETBLOCK[
|
||||
|
@ -494,18 +495,22 @@ generates
|
|||
#:grammar ([maybe-indirect code:blank
|
||||
#:indirect])]{
|
||||
|
||||
Like @racket[racket], but typeset as a module path. If @racket[datum]
|
||||
is an identifier or @racket[expr] produces a symbol, then it is
|
||||
hyperlinked to the module path's definition as created by
|
||||
@racket[defmodule].
|
||||
Like @racket[racket], but typeset as a module path and without special
|
||||
treatment of identifiers (such as @racketidfont{code:blank} or identifiers
|
||||
that start with @litchar{_}). If @racket[datum] is an identifier or
|
||||
@racket[expr] produces a symbol, then it is hyperlinked to the module
|
||||
path's definition as created by @racket[defmodule].
|
||||
|
||||
If @racket[#:indirect] is specified, then the hyperlink is given the
|
||||
@racket['indirect-link] @tech{style property}, which makes the
|
||||
hyperlink's resolution in HTML potentially delayed; see
|
||||
@racket['indirect-link] for @racket[link-element].}
|
||||
@racket['indirect-link] for @racket[link-element].
|
||||
|
||||
@history[#:changed "1.21" @elem{Disabled @racket[racket]-style special
|
||||
treatment of identifiers.}]}
|
||||
|
||||
@defform[(racketmodlink datum pre-content-expr ...)]{
|
||||
Like @racket[racketmod], but separating the module path to link
|
||||
Like @racket[racketmodname], but separating the module path to link
|
||||
from the content to be linked. The @racket[datum] module path is always
|
||||
linked, even if it is not an identifier.}
|
||||
|
||||
|
@ -550,6 +555,11 @@ sub-form in a procedure being documented).}
|
|||
@defproc[(racketparenfont [pre-content pre-content?] ...) element?]{Like
|
||||
@racket[racketplainfont], but colored like parentheses.}
|
||||
|
||||
@defproc[(racketoptionalfont [pre-content pre-content?] ...) element?]{Like
|
||||
@racket[racketplainfont], but colored as optional.
|
||||
@history[#:added "1.36"]
|
||||
}
|
||||
|
||||
@defproc[(racketmetafont [pre-content pre-content?] ...) element?]{Like
|
||||
@racket[racketplainfont], but colored as meta-syntax, such as backquote or
|
||||
unquote.}
|
||||
|
@ -591,6 +601,7 @@ in a form definition.}
|
|||
@defproc[(schemevarfont [pre-content pre-content?] ...) element?]
|
||||
@defproc[(schemekeywordfont [pre-content pre-content?] ...) element?]
|
||||
@defproc[(schemeparenfont [pre-content pre-content?] ...) element?]
|
||||
@defproc[(schemeoptionalfont [pre-content pre-content?] ...) element?]
|
||||
@defproc[(schememetafont [pre-content pre-content?] ...) element?]
|
||||
@defproc[(schemeerror [pre-content pre-content?] ...) element?]
|
||||
@defproc[(schememodfont [pre-content pre-content?] ...) element?]
|
||||
|
@ -681,7 +692,7 @@ specified explicitly with @racket[#:packages]. Each @racket[pkg-expr]
|
|||
result is passed on to a function like @racket[tt] for
|
||||
typesetting. Provide an empty sequence after @racket[#:packages] to
|
||||
suppress any package name in the output. Each @racket[pkg-expr]
|
||||
expression is are duplicated for a @racket[declare-exporting] form,
|
||||
expression is duplicated for a @racket[declare-exporting] form,
|
||||
unless @racket[#:no-declare] is specified.
|
||||
|
||||
Each @racket[option] form can appear at most once, and @racket[#:lang]
|
||||
|
@ -825,7 +836,7 @@ Equivalent to @racket[defmodule] variants @racket[#:no-declare].}
|
|||
ellipses+]
|
||||
[options (code:line maybe-kind maybe-link maybe-id)]
|
||||
[maybe-kind code:blank
|
||||
(code:line #:kind kind-string-expr)]
|
||||
(code:line #:kind kind-content-expr)]
|
||||
[maybe-link code:blank
|
||||
(code:line #:link-target? link-target?-expr)]
|
||||
[maybe-id code:blank
|
||||
|
@ -934,8 +945,8 @@ by the @racket[current-display-width] parameter.
|
|||
|
||||
An optional @racket[#:kind] specification chooses the decorative
|
||||
label, which defaults to @racket["procedure"]. A @racket[#f]
|
||||
result for @racket[kind-string-expr] uses the default, otherwise
|
||||
@racket[kind-string-expr] should produce a string. An alternate
|
||||
result for @racket[kind-content-expr] uses the default, otherwise
|
||||
@racket[kind-content-expr] should produce content in the sense of @racket[content?]. An alternate
|
||||
label should be all lowercase.
|
||||
|
||||
If @racket[#:id [src-id dest-id-expr]] is supplied, then
|
||||
|
@ -996,7 +1007,7 @@ Examples:
|
|||
pre-flow ...)
|
||||
([options (code:line maybe-kind maybe-link maybe-id maybe-literals)]
|
||||
[maybe-kind code:blank
|
||||
(code:line #:kind kind-string-expr)]
|
||||
(code:line #:kind kind-content-expr)]
|
||||
[maybe-link code:blank
|
||||
(code:line #:link-target? link-target?-expr)]
|
||||
[maybe-id code:blank
|
||||
|
@ -1017,7 +1028,7 @@ result of @racket[id-expr]) whose syntax is described by
|
|||
@racket[id], then @racket[form-datum] must have the form @racket[(id
|
||||
. _datum)].
|
||||
|
||||
If @racket[#:kind kind-string-expr] is supplied, it is used in the
|
||||
If @racket[#:kind kind-content-expr] is supplied, it is used in the
|
||||
same way as for @racket[defproc], but the default kind is
|
||||
@racket["syntax"].
|
||||
|
||||
|
@ -1327,7 +1338,7 @@ Like @racket[defparam], but the contract on a parameter argument is
|
|||
pre-flow ...)
|
||||
([options (code:line maybe-kind maybe-link maybe-id)]
|
||||
[maybe-kind code:blank
|
||||
(code:line #:kind kind-string-expr)]
|
||||
(code:line #:kind kind-content-expr)]
|
||||
[maybe-link code:blank
|
||||
(code:line #:link-target? link-target?-expr)]
|
||||
[maybe-id code:blank
|
||||
|
@ -1337,7 +1348,7 @@ Like @racket[defparam], but the contract on a parameter argument is
|
|||
|
||||
Like @racket[defproc], but for a non-procedure binding.
|
||||
|
||||
If @racket[#:kind kind-string-expr] is supplied,
|
||||
If @racket[#:kind kind-content-expr] is supplied,
|
||||
it is used in the same way as for
|
||||
@racket[defproc], but the default kind is @racket["value"].
|
||||
|
||||
|
@ -1399,10 +1410,12 @@ definition. The @racket[defstruct*] form corresponds to @racket[struct],
|
|||
while @racket[defstruct] corresponds to @racket[define-struct].
|
||||
|
||||
Examples:
|
||||
|
||||
An example using @racket[defstruct]:
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/manual
|
||||
@defstruct[sandwich ([protein ingredient?] [sauce ingredient?])]{
|
||||
A strucure type for sandwiches. Sandwiches are a pan-human foodstuff
|
||||
A structure type for sandwiches. Sandwiches are a pan-human foodstuff
|
||||
composed of a partially-enclosing bread material and various
|
||||
ingredients.
|
||||
}
|
||||
|
@ -1410,11 +1423,28 @@ Examples:
|
|||
@doc-render-examples[
|
||||
@defstruct[#:link-target? #f
|
||||
sandwich ([protein ingredient?] [sauce ingredient?])]{
|
||||
A strucure type for sandwiches. Sandwiches are a pan-human foodstuff
|
||||
A structure type for sandwiches. Sandwiches are a pan-human foodstuff
|
||||
composed of a partially-enclosing bread material and various
|
||||
ingredients.
|
||||
}]
|
||||
|
||||
Additionally, an example using @racket[defstruct*]:
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/manual
|
||||
@defstruct*[burrito ([salsa ingredient?] [tortilla ingredient?])]{
|
||||
A structure type for burritos. Burritos are a pan-human foodstuff
|
||||
composed of a @emph{fully}-encolosed bread material and various
|
||||
ingredients.
|
||||
}
|
||||
}|
|
||||
}
|
||||
@doc-render-examples[
|
||||
@defstruct*[#:link-target? #f
|
||||
burrito ([salsa ingredient?] [tortilla ingredient?])]{
|
||||
A structure type for burritos. Burritos are a pan-human foodstuff
|
||||
composed of a @emph{fully}-encolosed bread material and various
|
||||
ingredients.
|
||||
}]
|
||||
|
||||
|
||||
@defform[(deftogether [def-expr ...] pre-flow ...)]{
|
||||
|
@ -1585,14 +1615,15 @@ accepted and propagated to the superclass.}
|
|||
([maybe-link code:blank
|
||||
(code:line #:link-target? link-target?-expr)]
|
||||
[maybe-mode code:blank
|
||||
(code:line #:mode public)
|
||||
(code:line #:mode public-final)
|
||||
(code:line #:mode override)
|
||||
(code:line #:mode override-final)
|
||||
(code:line #:mode public-final)
|
||||
(code:line #:mode augment)
|
||||
(code:line #:mode augment-final)
|
||||
(code:line #:mode pubment)
|
||||
(code:line #:mode extend)
|
||||
(code:line #:mode extend-final)])]{
|
||||
(code:line #:mode extend-final)
|
||||
(code:line #:mode pubment)])]{
|
||||
|
||||
Like @racket[defproc], but for a method within a @racket[defclass] or
|
||||
@racket[definterface] body.
|
||||
|
@ -1602,7 +1633,10 @@ method from a superclass, and so on. (For these purposes, use
|
|||
@racket[#:mode override] when refining a method of an implemented
|
||||
interface.) The @racket[extend] mode is like @racket[override], but
|
||||
the description of the method should describe only extensions to the
|
||||
superclass implementation.}
|
||||
superclass implementation. When @racket[maybe-mode] is not supplied,
|
||||
it defaults to @racket[public].
|
||||
|
||||
@history[#:changed "1.35" @elem{Added a check against invalid @racket[maybe-mode].}]}
|
||||
|
||||
@defform[(defmethod* maybe-mode maybe-link
|
||||
([(id arg-spec ...)
|
||||
|
@ -1690,9 +1724,8 @@ Typesets the given combination of a GUI's menu and item name.}
|
|||
@tech{decode}d @racket[pre-content] as a file name (e.g., in
|
||||
typewriter font and in quotes).}
|
||||
|
||||
@defproc[(exec [pre-content pre-content?] ...) element?]{Typesets the
|
||||
@tech{decode}d @racket[pre-content] as a command line (e.g., in
|
||||
typewriter font).}
|
||||
@defproc[(exec [content content?] ...) element?]{Typesets the
|
||||
@racket[content] as a command line (e.g., in typewriter font).}
|
||||
|
||||
@defproc[(envvar [pre-content pre-content?] ...) element?]{Typesets the given
|
||||
@tech{decode}d @racket[pre-content] as an environment variable (e.g.,
|
||||
|
@ -1794,10 +1827,10 @@ key; in either case, if @racket[normalize?] is true, the key is normalized in th
|
|||
arguments support cross-document and section-specific references, like
|
||||
in @racket[secref].
|
||||
For example:
|
||||
@racketblock[@tech[#:doc '(lib "scribblings/guide/guide.scrbl")]{blame object}]
|
||||
@racketblock[@tech[#:doc '(lib "scribblings/reference/reference.scrbl")]{blame object}]
|
||||
|
||||
creates a link to @tech[#:doc '(lib "scribblings/guide/guide.scrbl")]{blame object} in
|
||||
@other-doc['(lib "scribblings/guide/guide.scrbl")].
|
||||
creates a link to @tech[#:doc '(lib "scribblings/reference/reference.scrbl")]{blame object} in
|
||||
@other-doc['(lib "scribblings/reference/reference.scrbl")].
|
||||
|
||||
With the default style files, the hyperlink created by @racket[tech]
|
||||
is somewhat quieter than most hyperlinks: the underline in HTML output
|
||||
|
@ -1886,7 +1919,8 @@ order as given.}
|
|||
[#:author author (or/c #f pre-content?) #f]
|
||||
[#:location location (or/c #f pre-content?) #f]
|
||||
[#:date date (or/c #f pre-content?) #f]
|
||||
[#:url url (or/c #f pre-content?) #f])
|
||||
[#:url url (or/c #f pre-content?) #f]
|
||||
[#:note note (or/c #f pre-content?) #f])
|
||||
bib-entry?]{
|
||||
|
||||
Creates a bibliography entry. The @racket[key] is used to refer to the
|
||||
|
@ -1919,7 +1953,12 @@ the entry:
|
|||
bibliography using @racket[tt] and hyperlinked, or it is
|
||||
omitted if given as @racket[#f].}
|
||||
|
||||
]}
|
||||
@item{@racket[note] is an optional comment about the work. It is typeset
|
||||
in the bibliography as given, and appears directly after the date
|
||||
(or URL, if given) with no space or punctuation in between.}
|
||||
]
|
||||
|
||||
@history[#:changed "1.29" @elem{Added the @racket[#:note] option.}]}
|
||||
|
||||
|
||||
@defproc[(bib-entry? [v any/c]) boolean?]{
|
||||
|
@ -1949,6 +1988,28 @@ produced by @racket[content-expr] should normally start with a capital
|
|||
letter and end with a period, but it can be a sentence fragment such
|
||||
as ``Added a @racket[#:changed] form.''
|
||||
|
||||
Examples:
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/manual
|
||||
@defthing[tasty-burrito burrito?]{
|
||||
Compatible with the API of a sandwich, but not legally a
|
||||
sandwich in Massachusetts.
|
||||
|
||||
@history[#:added "1.0"
|
||||
#:changed "1.1" "Refactored tortilla."
|
||||
#:changed "1.2" @elem{Now includes @emph{guacamole}.}]
|
||||
}
|
||||
}|
|
||||
@doc-render-examples[
|
||||
@defthing[tasty-burrito burrito?]{
|
||||
Compatible with the API of a sandwich, but not legally a
|
||||
sandwich in Massachusetts.
|
||||
|
||||
@history[#:added "1.0"
|
||||
#:changed "1.1" "Refactored tortilla."
|
||||
#:changed "1.2" @elem{Now includes @emph{guacamole}.}]
|
||||
}]
|
||||
|
||||
@history[#:added "1.1"]}
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
@ -1976,7 +2037,7 @@ that is hyperlinked to an explanation.}
|
|||
|
||||
@defthing[undefined-const element?]{Returns an element for @|undefined-const|.}
|
||||
|
||||
@defproc[(commandline [pre-content pre-content?] ...) paragraph?]{Produces
|
||||
@defproc[(commandline [content content?] ...) paragraph?]{Produces
|
||||
an inset command-line example (e.g., in typewriter font).}
|
||||
|
||||
@defproc[(inset-flow [pre-flow pre-flow?] ...) nested-flow?]{
|
||||
|
@ -2049,6 +2110,16 @@ rendered document.}
|
|||
Indicates that the index entry corresponds to a module definition via
|
||||
@racket[defmodule] and company.}
|
||||
|
||||
@deftogether[(
|
||||
@defstruct[(language-index-desc module-path-index-desc) ()]{}
|
||||
@defstruct[(reader-index-desc module-path-index-desc) ()]{}
|
||||
)]{
|
||||
Indicates that the index entry corresponds to a module definition via
|
||||
@racket[defmodule] with the @racket[#:lang] or @racket[#:reader] option.
|
||||
For example, a module definition via @racket[defmodulelang] has a
|
||||
@racket[language-index-desc] index entry and a module definition via
|
||||
@racket[defmodulereader] has a @racket[reader-index-desc] index entry.}
|
||||
|
||||
@defstruct[exported-index-desc ([name symbol?]
|
||||
[from-libs (listof module-path?)])]{
|
||||
|
||||
|
@ -2139,7 +2210,7 @@ For HTML rendering:
|
|||
@filepath{manual-style.css} from the @filepath{scribble}
|
||||
collection in @racket[html-defaults].}
|
||||
|
||||
@item{The file @filepath{manual-files.css} from the
|
||||
@item{The file @filepath{manual-fonts.css} from the
|
||||
@filepath{scribble} collection is designated as an additional
|
||||
accompanying file in @racket[html-defaults].}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ relevant libraries and APIs in detail.
|
|||
@local-table-of-contents[]
|
||||
|
||||
@include-section["how-to.scrbl"]
|
||||
@include-section["style.scrbl"]
|
||||
@include-section["manual.scrbl"]
|
||||
@include-section["scheme.scrbl"]
|
||||
@include-section["examples.scrbl"]
|
||||
|
|
|
@ -163,7 +163,7 @@ reports @racket["Hello, friend."].
|
|||
|
||||
In addition to configuring the reader for a module body,
|
||||
@racketmodname[at-exp] attaches a run-time configuration annotation to
|
||||
the module, so that it if it used as the main module, the
|
||||
the module, so that if it used as the main module, the
|
||||
@racket[current-read-interaction] parameter is adjusted to use the
|
||||
@seclink["reader"]{@"@"-reader} readtable extension.
|
||||
|
||||
|
|
|
@ -172,6 +172,7 @@ expression.
|
|||
@scribble-examples|==={
|
||||
@foo{(+ 1 2) -> @(+ 1 2)!}
|
||||
@foo{A @"string" escape}
|
||||
@"@"
|
||||
}===|
|
||||
|
||||
Note that an escaped Racket string is merged with the surrounding text
|
||||
|
@ -355,7 +356,7 @@ Finally, note that there are currently no special rules for using
|
|||
@;--------------------------------------------------------------------
|
||||
@section{The Datum Part}
|
||||
|
||||
The datum part can contains arbitrary Racket expressions, which
|
||||
The datum part can contain arbitrary Racket expressions, which
|
||||
are simply stacked before the body text arguments:
|
||||
|
||||
@scribble-examples|==={
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"utils.rkt"
|
||||
(for-label racket/class
|
||||
scribble/render
|
||||
scribble/xref))
|
||||
scribble/xref
|
||||
setup/dirs))
|
||||
|
||||
@(define-syntax-rule (defmodule/local lib . content)
|
||||
(begin
|
||||
|
@ -169,9 +170,9 @@ information on the @racket[dests] argument. The @racket[ci] argument
|
|||
is a result from the @method[render<%> collect] method.}
|
||||
|
||||
@defmethod[(render [srcs (listof part?)]
|
||||
[dests (listof path-string?)]
|
||||
[dests (listof (or/c path-string? #f))]
|
||||
[ri resolve-info?])
|
||||
void?]{
|
||||
list?]{
|
||||
|
||||
Produces the final output. The @racket[ri] argument is a result from
|
||||
the @method[render<%> render] method.
|
||||
|
@ -181,7 +182,11 @@ HTML output, or names of sub-directories for multi-file HTML output.
|
|||
If the @racket[dests] are relative, they're relative to the current
|
||||
directory; normally, they should indicates a path within the
|
||||
@racket[_dest-dir] supplied on initialization of the @racket[render%]
|
||||
object.}
|
||||
object.
|
||||
|
||||
If an element of @racket[dests] is @racket[#f], then the corresponding
|
||||
position of the result list contains a string for rendered document.
|
||||
Some renderers require that @racket[dest] contains all path strings.}
|
||||
|
||||
|
||||
@defmethod[(serialize-info [ri resolve-info?])
|
||||
|
@ -298,7 +303,284 @@ list are more preferred. The renderer may not support all of the
|
|||
formats listed in @racket[image-preferences].
|
||||
|
||||
@history[#:changed "1.4" @elem{Added the @racket[image-preferences]
|
||||
initialization argument.}]}}
|
||||
initialization argument.}]}
|
||||
|
||||
@defmethod[(traverse [parts (listof part?)]
|
||||
[dests (listof path-string?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(start-traverse [parts (listof part?)]
|
||||
[dests (listof path-string?)]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-part [p part?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-flow [bs (listof block?)]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-block [b block?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-nested-flow [nf nested-flow?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-table [t table?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-itemization [i itemization?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-compound-paragraph [cp compound-paragraph?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-paragraph [p paragraph?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-content [c content?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-target-element [e target-element?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]
|
||||
@defmethod[(traverse-index-element [e index-element?]
|
||||
[fp (and/c hash? immutable?)])
|
||||
(and/c hash? immutable?)]{
|
||||
|
||||
These methods implement the @tech{traverse pass} of document rendering.
|
||||
Except for the entry point @method[render% traverse] as described by
|
||||
as described at @xmethod[render<%> traverse], these methods
|
||||
generally would not be called to render a document, but instead
|
||||
provide natural points to interpose on the default implementation.
|
||||
|
||||
A renderer for a specific format is relatively unlikely to override
|
||||
any of these methods. Each method accepts the information accumulated
|
||||
so far and returns augmented information as a result.}
|
||||
|
||||
|
||||
@defmethod[(collect [parts (listof part?)]
|
||||
[dests (listof path-string?)]
|
||||
[fp (and/c hash? immutable?)]
|
||||
[demand (tag? collect-info? . -> . any/c) (lambda (_tag _ci) #f)])
|
||||
collect-info?]
|
||||
@defmethod[(start-collect [parts (listof part?)]
|
||||
[dests (listof path-string?)]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-part [p part?]
|
||||
[parent (or/c #f part?)]
|
||||
[ci collect-info?]
|
||||
[number (listof part-number-item?)]
|
||||
[init-sub-number part-number-item?]
|
||||
[init-sub-numberers (listof numberer?)])
|
||||
(values part-number-item? numberer?)]
|
||||
@defmethod[(collect-part-tags [p part?]
|
||||
[ci collect-info?]
|
||||
[number (listof part-number-item?)])
|
||||
void?]
|
||||
@defmethod[(collect-flow [bs (listof block?)]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-block [b block?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-nested-flow [nf nested-flow?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-table [t table?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-itemization [i itemization?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-compound-paragraph [cp compound-paragraph?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-paragraph [p paragraph?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-content [c content?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-target-element [e target-element?]
|
||||
[ci collect-info?])
|
||||
void?]
|
||||
@defmethod[(collect-index-element [e index-element?]
|
||||
[ci collect-info?])
|
||||
void?]{
|
||||
|
||||
These methods implement the @tech{collect pass} of document rendering.
|
||||
Except for the entry point @method[render% collect] as described at
|
||||
@xmethod[render<%> collect], these methods generally would not be
|
||||
called to render a document, but instead provide natural points to
|
||||
interpose on the default implementation.
|
||||
|
||||
A renderer for a specific format is most likely to override
|
||||
@method[render% collect-part-tags], @method[render%
|
||||
collect-target-element], and perhaps @method[render% start-collect] to
|
||||
set up and record cross-reference information in a way that is
|
||||
suitable for the target format.}
|
||||
|
||||
@defmethod[(resolve [parts (listof part?)]
|
||||
[dests (listof path-string?)]
|
||||
[ci collect-info?])
|
||||
resolve-info?]
|
||||
@defmethod[(start-resolve [parts (listof part?)]
|
||||
[dests (listof path-string?)]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-part [p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-flow [bs (listof block?)]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-block [b block?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-nested-flow [nf nested-flow?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-table [t table?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-itemization [i itemization?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-compound-paragraph [cp compound-paragraph?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-paragraph [p paragraph?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]
|
||||
@defmethod[(resolve-content [c content?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
void?]{
|
||||
|
||||
These methods implement the @tech{resolve pass} of document rendering.
|
||||
Except for the entry point @method[render% resolve] as described at
|
||||
@xmethod[render<%> resolve], these methods generally would not be
|
||||
called to render a document, but instead provide natural points to
|
||||
interpose on the default implementation.
|
||||
|
||||
A renderer for a specific format is unlikely to override any of these
|
||||
methods. Each method for a document fragment within a part receives
|
||||
the enclosing part as an argument, as well as resolve information as
|
||||
@racket[ri] to update.}
|
||||
|
||||
|
||||
@defmethod[(render [parts (listof part?)]
|
||||
[dests (listof (or/c path-string? #f))]
|
||||
[ri resolve-info?])
|
||||
list?]
|
||||
@defmethod[(render-one [part part?]
|
||||
[ri resolve-info?]
|
||||
[dest (or/c path-string? #f)])
|
||||
any/c]
|
||||
@defmethod[(render-part [p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]
|
||||
@defmethod[(render-part-content [p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]
|
||||
@defmethod[(render-flow [bs (listof block?)]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?]
|
||||
[first-in-part-or-item? boolean?])
|
||||
any/c]
|
||||
@defmethod[(render-block [b block?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?]
|
||||
[first-in-part-or-item? boolean?])
|
||||
any/c]
|
||||
@defmethod[(render-nested-flow [nf nested-flow?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?]
|
||||
[first-in-part-or-item? boolean?])
|
||||
any/c]
|
||||
@defmethod[(render-table [t table?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?]
|
||||
[first-in-part-or-item? boolean?])
|
||||
any/c]
|
||||
@defmethod[(render-auxiliary-table [t table?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]
|
||||
@defmethod[(render-itemization [i itemization?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]
|
||||
@defmethod[(render-compound-paragraph [cp compound-paragraph?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?]
|
||||
[first-in-part-or-item? boolean?])
|
||||
any/c]
|
||||
@defmethod[(render-intrapara-block [p paragraph?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?]
|
||||
[first-in-compound-paragraph? boolean?]
|
||||
[last-in-compound-paragraph? boolean?]
|
||||
[first-in-part-or-item? boolean?])
|
||||
any/c]
|
||||
@defmethod[(render-paragraph [p paragraph?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]
|
||||
@defmethod[(render-content [c content?]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]
|
||||
@defmethod[(render-other [c (and/c content? (not/c element?) (not/c convertible?))]
|
||||
[enclosing-p part?]
|
||||
[ri resolve-info?])
|
||||
any/c]{
|
||||
|
||||
These methods implement the @tech{render pass} of document rendering.
|
||||
Except for the entry point @method[render% render] as described at
|
||||
@xmethod[render<%> render], these methods generally would not be
|
||||
called to render a document, but instead provide natural points to
|
||||
interpose on the default implementation.
|
||||
|
||||
A renderer for a specific format is likely to override most or all of
|
||||
these methods. The result of each method can be anything, and the
|
||||
default implementations of the methods propagate results and collect
|
||||
them into a list as needed. The value of @racket[current-output-port]
|
||||
is set by @method[render% render] for each immediate @racket[part]
|
||||
before calling @method[render% render-one], so methods might
|
||||
individually print to render, or they might return values that are
|
||||
used both other methods to print. The interposition points for this
|
||||
pass are somewhat different than for other passes:
|
||||
|
||||
@itemlist[
|
||||
|
||||
@item{@method[render% render-one] is called by the @method[render%
|
||||
render] method on each immediate @racket[part] in the list for
|
||||
its first argument.}
|
||||
|
||||
@item{@method[render% render-auxiliary-table] is called by the
|
||||
default @method[render% render-block] on any @racket[table]
|
||||
that has the @racket['aux] @tech{style property}.}
|
||||
|
||||
@item{@method[render% render-intrapara-block] is called on blocks
|
||||
within a @racket[compound-paragraph], where the default
|
||||
implementation just chains to @racket[render% render-block].}
|
||||
|
||||
|
||||
@item{@method[render% render-other] is called by the default
|
||||
implementation of @racket[render-content] for any content that
|
||||
does not satisfy @racket[element?] or @racket[convertible?].}
|
||||
|
||||
]}
|
||||
|
||||
}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
|
@ -325,6 +607,13 @@ Code blocks are marked using the
|
|||
"Github convention"] @verbatim{```racket} so that they are lexed and
|
||||
formatted as Racket code.}}
|
||||
|
||||
@defboolparam[current-markdown-link-sections enabled?]{
|
||||
|
||||
Determines whether section links within an output document are
|
||||
rendered as a section link. The default is @racket[#f].
|
||||
|
||||
@history[#:added "1.31"]}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@section{HTML Renderer}
|
||||
|
@ -354,6 +643,7 @@ Configures the renderer to redirect links to external documents via
|
|||
@racket[url], adding a @tt{tag} query element to the end of the
|
||||
URL that contains the Base64-encoded, @racket[print]ed, serialized
|
||||
original tag (in the sense of @racket[link-element]) for the link.
|
||||
The result of @racket[get-doc-search-url] is intended for use as @racket[url].
|
||||
|
||||
If the link is based on a cross-reference entry that has a
|
||||
document-identifying string (see @racket[load-xref] and its
|
||||
|
@ -396,6 +686,16 @@ are own their own pages. A value of @racket[0] is treated the same as
|
|||
|
||||
Specializes a @racket[render<%>] class for generating Latex input.}}
|
||||
|
||||
@defparam[extra-character-conversions convs (-> char? (or/c string? #f))]{
|
||||
Function that maps (special) characters to strings corresponding to the Latex
|
||||
code that should be used to render them. This function should return false for
|
||||
any character it does not know how to handle.
|
||||
|
||||
Scribble already converts many special characters to the proper Latex
|
||||
commands. This parameter should be used in case you need characters it does not
|
||||
support yet.
|
||||
}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@section{PDF Renderer}
|
||||
|
@ -405,7 +705,20 @@ Specializes a @racket[render<%>] class for generating Latex input.}}
|
|||
@defmixin[render-mixin (render<%>) ()]{
|
||||
|
||||
Specializes a @racket[render<%>] class for generating PDF output via
|
||||
Latex, building on @|latex:render-mixin| from @racketmodname[scribble/latex-render].}}
|
||||
Latex, building on @|latex:render-mixin| from @racketmodname[scribble/latex-render].}
|
||||
|
||||
@defmixin[dvi-render-mixin (render<%>) ()]{
|
||||
|
||||
Like @racket[render-mixin], but generates PDF output via @exec{latex},
|
||||
@exec{dvips}, and @exec{pstopdf}.
|
||||
|
||||
@history[#:added "1.4"]}}
|
||||
|
||||
@defmixin[xelatex-render-mixin (render<%>) ()]{
|
||||
|
||||
Like @racket[render-mixin], but generates PDF output via @exec{xelatex}.
|
||||
|
||||
@history[#:added "1.19"]}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ its file suffix:
|
|||
@item{@DFlag{pdf} --- PDF @filepath{@|fn|.pdf} that is generated
|
||||
via @exec{pdflatex}}
|
||||
|
||||
@item{@DFlag{xelatex} --- PDF @filepath{@|fn|.pdf} that is generated
|
||||
via @exec{xelatex}}
|
||||
|
||||
@item{@DFlag{dvipdf} --- PDF @filepath{@|fn|.pdf} that is generated
|
||||
via @exec{latex}, @exec{dvips}, and @exec{pstopdf}}
|
||||
|
||||
|
@ -65,14 +68,17 @@ source declares a module. The module should either have a @racket[doc]
|
|||
that exports @racket[doc] as a @racket[part], or it should directly
|
||||
export @racket[doc] as a @racket[part]. (The submodule is tried first,
|
||||
and the main module is not directly loaded or evaluated if the
|
||||
submodule can be loaded on its own.)
|
||||
submodule can be loaded on its own.) Use @DFlag{doc-binding} to
|
||||
access an alternate exported name in place of @racket[doc].
|
||||
|
||||
When multiple documents are rendered at the same time, cross-reference
|
||||
information in one document is visible to the other documents. See
|
||||
@secref["xref-flags"] for information on references that cross
|
||||
documents that are built separately.
|
||||
|
||||
@history[#:changed "1.4" @elem{Added @DFlag{dvipdf}.}]
|
||||
@history[#:changed "1.4" @elem{Added @DFlag{dvipdf}.}
|
||||
#:changed "1.18" @elem{Added @DFlag{doc-binding}.}
|
||||
#:changed "1.19" @elem{Added @DFlag{xelatex}.}]
|
||||
|
||||
@section{Extra and Format-Specific Files}
|
||||
|
||||
|
@ -142,7 +148,7 @@ information for all installed documentation, and @PFlag{m} or
|
|||
setup/xref load-collections-xref}.
|
||||
|
||||
The @DFlag{redirect-main} flag for HTML output redirects links to the local
|
||||
installation's documentation to a given URL, such as
|
||||
installation's documentation (not user-scope documentation) to a given URL, such as
|
||||
@tt{http://docs.racket-lang.org/}. Beware that documentation links
|
||||
sometimes change (although Scribble generates HTML paths and anchors
|
||||
in a relatively stable way), so
|
||||
|
@ -150,11 +156,13 @@ in a relatively stable way), so
|
|||
more reliable when building with an installation for @italic{version}.
|
||||
The @DFlag{redirect-main} flag is ignored for non-HTML output.
|
||||
|
||||
The @DFlag{redirect} flag is like @DFlag{redirect-main}, except
|
||||
that it builds on the given URL to indicate a cross-reference tag that
|
||||
is more stable than an HTML path and anchor (in case the documentation
|
||||
for a function changes sections, for example). No server currently
|
||||
exists to serve such tag requests, however.
|
||||
The @DFlag{redirect} flag is like @DFlag{redirect-main}, except that
|
||||
it builds on the given URL to indicate a cross-reference tag that is
|
||||
more stable than an HTML path and anchor (in case the documentation
|
||||
for a function changes sections, for example), and it can generate
|
||||
redirected linked for documentation that is installed in user scope.
|
||||
The URL @tt{https://docs.racket-lang.org/local-redirect/index.html} can
|
||||
work for these redirections.
|
||||
|
||||
For cross-references among documentation that is not part of the
|
||||
Racket installation, use @DFlag{info-out} to save information from a
|
||||
|
@ -209,4 +217,4 @@ and rendered, which could affect the content that
|
|||
@filepath{turtle.scrbl} generates if it uses
|
||||
@racket[current-command-line-arguments].
|
||||
|
||||
@history[#:changed "1.1" @elem{Added the empty-vector default and @DPFlag{arg} flag.}]
|
||||
@history[#:changed "1.1" @elem{Added the empty-vector default and @DPFlag{arg} flag.}]
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
@defmodulelang[scribble/sigplan]{The @racketmodname[scribble/sigplan]
|
||||
language is like @racketmodname[scribble/base], but configured with
|
||||
Latex style defaults to use the @filepath{sigplanconf.cls} class
|
||||
LaTeX style defaults to use the @filepath{sigplanconf.cls} class
|
||||
file that is included with Scribble.}
|
||||
|
||||
@defidform[preprint]{
|
||||
|
|
|
@ -26,17 +26,10 @@ same way that the module system keeps expansion-time code separate
|
|||
from run-time code, and documentation information is recorded in a
|
||||
submodule to be separately loadable from the enclosing module.
|
||||
|
||||
For an example use, see the @filepath{file} collection's
|
||||
@filepath{gif.rkt} source file and the corresponding extraction in
|
||||
@filepath{scribblings/gif.scrbl}. As that example illustrates,
|
||||
starting the module declaration with
|
||||
For an example use, see
|
||||
@hyperlink["https://blog.racket-lang.org/2012/06/submodules.html"]{this post}
|
||||
at @url{blog.racket-lang.org}.
|
||||
|
||||
@racketblock[
|
||||
@#,hash-lang[] @#,racketmodname[at-exp]
|
||||
]
|
||||
|
||||
enables the @"@"-reader, which is handy for writing documentation
|
||||
expressions.
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
|
@ -187,6 +180,27 @@ See @racket[defform] for information on @racket[options],
|
|||
@history[#:added "1.6"]}
|
||||
|
||||
|
||||
@defform[(class*-doc id super (intf-id ...) pre-flow)]{
|
||||
|
||||
Like @racket[proc-doc], but for class declarations that use @racket[class*].
|
||||
|
||||
The @racket[id], @racket[super], and @racket[intf-id] expressions have the same
|
||||
meaning as in @racket[defclass].
|
||||
|
||||
@history[#:added "1.30"]}
|
||||
|
||||
|
||||
@defform[(class-doc id super pre-flow)]{
|
||||
|
||||
Like @racket[class*-doc], but for class declarations that use @racket[class]
|
||||
omitting @racket[interface-expr]s.
|
||||
|
||||
The @racket[id], and @racket[super] expressions have the same meaning as in
|
||||
@racket[defclass].
|
||||
|
||||
@history[#:added "1.30"]}
|
||||
|
||||
|
||||
@defform[(begin-for-doc form ...)]{
|
||||
|
||||
Like to @racket[begin-for-syntax], but for documentation time instead
|
||||
|
|
|
@ -1,231 +0,0 @@
|
|||
#lang scribble/doc
|
||||
@(require scribble/manual scribble/eval "utils.rkt"
|
||||
(for-label scribble/manual scribble/eval))
|
||||
|
||||
@title[#:tag "reference-style"]{Style Guide}
|
||||
|
||||
Consistent style---for terms, typesetting, and prose---makes
|
||||
documentation clearer. As much as possible, follow the rules listed in
|
||||
this section. Many of the rules are arbitrary in the sense that a
|
||||
different choice of rule could work fine, but the only way to make our
|
||||
documentation consistent is to pick one of the choices.
|
||||
|
||||
There are too many rules to absorb easily on a first reading. Re-read
|
||||
this section after writing documentation for a library or two, and
|
||||
revisit the section periodically to refresh your memory and check for
|
||||
new rules.
|
||||
|
||||
@section{Prose and Terminology}
|
||||
|
||||
In the descriptive body of @racket[defform], @racket[defproc], etc.,
|
||||
do not start with ``This ...'' Instead, start with a sentence whose
|
||||
implicit subject is the form or value being described (but only start
|
||||
the first sentence that way). Capitalize the first word. Thus, the
|
||||
description will often start with ``Returns'' or ``Produces.'' Refer
|
||||
to arguments and sub-forms by name.
|
||||
|
||||
Do not use the word ``argument'' to describe a sub-form in a syntactic
|
||||
form; use the term ``sub-form'' instead, reserving ``argument'' for
|
||||
values or expressions in a function call. Refer to libraries and
|
||||
languages as such, rather than as ``modules'' (even though the form to
|
||||
typeset a library or language name is called @racket[racketmodname]).
|
||||
Do not call an identifier (i.e., a syntactic element) a ``variable''
|
||||
or a ``symbol.'' Do not use the word ``expression'' for a form that is
|
||||
a definition or might be a definition; use the word ``form,'' instead.
|
||||
Prefer ``function'' to ``procedure.''
|
||||
|
||||
Use the word ``list'' only when you mean a run-time value consisting
|
||||
of the empty list and cons cells; use the word ``sequence'' in other
|
||||
cases, if you must use any word. For example, do not write that
|
||||
@racket[begin] has a ``list of sub-forms;'' instead, it has a
|
||||
``sequence of sub-forms.'' Similarly, do not refer to a ``list of
|
||||
arguments'' in a function call; just write ``arguments'' if possible,
|
||||
or write ``sequence of argument expressions.'' (Unfortunately,
|
||||
``@tech[#:doc '(lib
|
||||
"scribblings/reference/reference.scrbl")]{sequence}'' has acquired a
|
||||
specific run-time meaning, too, but the collision is less severe than
|
||||
the historical confusion between lists and other entities in Lisp.)
|
||||
|
||||
Avoid cut-and-paste for descriptive text. If two functions are
|
||||
similar, consider documenting them together with
|
||||
@racket[deftogether]. To abstract a description, consider using
|
||||
explicit prose abstraction, such as ``@racket[x] is like @racket[y],
|
||||
except that ...,'' instead of abstracting the source and instantiating
|
||||
it multiple times; often, a prose abstraction is clearer to the reader
|
||||
than a hidden abstraction in the document implementation.
|
||||
|
||||
Hyphenate the words ``sub-form'' and ``sub-expression.''
|
||||
|
||||
Use ``Windows,'' ``Mac OS X,'' and ``Unix'' for the three
|
||||
``platforms'' (as opposed to ``systems'') on which Racket runs. Use
|
||||
``Unix'' as a generic term for Unix-like operating systems---notably
|
||||
including Linux---other than Mac OS X. Use ``Unix'' even when ``Gtk''
|
||||
or ``the X11 windowing system'' would be more precisely correct, but
|
||||
use ``X11'' as adjective when necessary, such as ``X11 display.''
|
||||
Racket runs ``on'' a platform, as opposed to ``under'' a platform.
|
||||
|
||||
|
||||
@section{Typesetting Code}
|
||||
|
||||
Use @racketidfont{id} or a name that ends @racketidfont{-id} in
|
||||
@racket[defform] to mean an identifier, not @racketidfont{identifier},
|
||||
@racketidfont{variable}, @racketidfont{name}, or
|
||||
@racketidfont{symbol}. Similarly, use @racketidfont{expr} or something
|
||||
that ends @racketidfont{-expr} for an expression position within a
|
||||
syntactic form. Use @racketidfont{body} for a form (definition or
|
||||
expression) in an internal-definition position---always followed by
|
||||
@racket[...+] in a grammar description. Do not use
|
||||
@racketidfont{expr} for something that isn't exactly an expression,
|
||||
@racket[id] for something that isn't exactly an identifier, etc.;
|
||||
instead, use @racket[defform/subs] to define a new non-terminal.
|
||||
|
||||
Beware of using @racket[deftogether] to define multiple variants of a
|
||||
syntactic form or procedure, because each @racket[defform] or
|
||||
@racket[defproc] creates a definition point, but each form or
|
||||
procedure should have a single definition point. (Scribble issues a
|
||||
warning when a binding has multiple definition points.) Instead, use
|
||||
@racket[defproc*] or @racket[defform*].
|
||||
|
||||
For function arguments, use @racket[v] as the meta-variable for ``any
|
||||
value.'' Use @racket[x] as a meta-variable only for numerical
|
||||
values. Other conventions include @racket[lst] for a list and
|
||||
@racket[proc] for a procedure.
|
||||
|
||||
Pay attention to the difference between identifiers and meta-variables
|
||||
when using @racket[racket], especially outside of @racket[defproc] or
|
||||
@racket[defform]. Prefix a meta-variable with @litchar{_}; for
|
||||
example,
|
||||
|
||||
@verbatim[#:indent 2]|{@racket[(rator-expr rand-expr ...)]}|
|
||||
|
||||
would be the wrong way to refer to the grammar of a function call,
|
||||
because it produces @racket[(rator-expr rand-expr ...)], where
|
||||
@racketidfont{rator-expr} and @racketidfont{rand-expr} are
|
||||
typeset as variables. The correct description is
|
||||
|
||||
@verbatim[#:indent 2]|{@racket[(_rator-expr _rand-expr ...)]}|
|
||||
|
||||
which produces @racket[(_rator-expr _rand-expr ...)], where
|
||||
@racketidfont{rator-expr} and @racketidfont{rand-expr} are typeset as
|
||||
meta-variables. The @racket[defproc], @racket[defform], @|etc| forms
|
||||
greatly reduce this burden in descriptions, since they automatically
|
||||
set up meta-variable typesetting for non-literal identifiers. In
|
||||
@racket[defform], be sure to include literal identifiers (i.e., those
|
||||
not meant as variables, other than the form name being defined) in a
|
||||
@racket[#:literals] clause.
|
||||
|
||||
To typeset an identifier with no particular interpretation---syntax,
|
||||
variable, meta-variable, etc.---use @racket[racketidfont] (e.g., as in
|
||||
@racketidfont{rand-expr} above). Otherwise, use @racket[litchar],
|
||||
not merely @racket[racketfont] or @racket[verbatim], to refer to a
|
||||
specific sequence of characters.
|
||||
|
||||
When a syntactic form synthesizes an identifier from a given
|
||||
identifier, use a combination of @racket[racketidfont] and
|
||||
@racket[racket] to describe the identifiers. For example, if
|
||||
@racket[_id] is combined with @racketidfont{is-} and @racketidfont{?}
|
||||
to form @racketidfont{is-}@racket[_id]@racketidfont{?}, then implement
|
||||
that identifier as
|
||||
@code[#:lang "at-exp racket"]|{@racketidfont{is-}@racket[id]@racketidfont{?}}|.
|
||||
|
||||
When using @racket[defform] to describe a syntactic form, don't
|
||||
confuse the @racket[#:contracts] clause with a grammar
|
||||
specification. Use @racket[#:contracts] only for expressions within the
|
||||
syntactic form, and the contract is a run-time constraint---not a
|
||||
syntactic constraint, such as requiring a sub-form to be an identifier.
|
||||
Use @racket[defform/subs] for syntactic constraints.
|
||||
|
||||
When showing example evaluations, use the REPL-snapshot style:
|
||||
|
||||
@verbatim[#:indent 2]|{
|
||||
@interaction[
|
||||
(+ 1 2)
|
||||
]
|
||||
}|
|
||||
|
||||
See also the @racket[scribble/eval] library and @secref["examples-style"].
|
||||
|
||||
Use four dots, @litchar{....}, in place of omitted code, since
|
||||
@litchar{...} means repetition.
|
||||
|
||||
|
||||
@section{Typesetting Prose}
|
||||
|
||||
Refrain from referring to documentation ``above'' or ``below,'' and
|
||||
instead have a hyperlink point to the right place.
|
||||
|
||||
In prose, use @litchar{``} and @litchar{''} quotation marks instead of
|
||||
@litchar{"}. Use @litchar{---} for an em dash, and do not include
|
||||
spaces on either side. Use American style for quotation marks and punctuation
|
||||
@; [Eli] BTW, I've asked several people about this, and the general
|
||||
@; agreement that I've seen is that this is a rather arbitrary rule
|
||||
@; and there's no harm in doing the more logical thing of putting
|
||||
@; the punctuations outside quotations and parens. Just like you
|
||||
@; did at the end of this sentence...
|
||||
@; [Matthew] See intro of this section.
|
||||
at the end of quotation marks (i.e., a sentence-terminating period
|
||||
goes inside the quotation marks). Of course, this rule does not apply
|
||||
for quotation marks that are part of code.
|
||||
|
||||
Do not use a citation reference (as created by @racket[cite]) as a
|
||||
noun; use it as an annotation.
|
||||
|
||||
Do not start a sentence with a Racket variable name, since it is
|
||||
normally lowercase. For example, use ``The @racket[_thing] argument
|
||||
is...'' instead of ``@racket[_thing] is...''
|
||||
|
||||
Use @racket[etc] for ``@|etc|'' when it does not end a sentence, and
|
||||
include a comma after ``@|etc|'' unless it ends a sentence of is
|
||||
followed by other punctuation (such as a parenthesis).
|
||||
|
||||
@section{Section Titles}
|
||||
|
||||
Capitalize all words except articles (``the,'' ``a,'' etc.),
|
||||
prepositions, and conjunctions that are not at the start of the title.
|
||||
|
||||
A manual title should normally start with a suitable keyword or key
|
||||
phrase (such as ``Scribble'' for this manual) that is in boldface. If
|
||||
the key word is primarily an executable name, use @racket[exec]
|
||||
instead of @racket[bold]. Optionally add further descriptive text in
|
||||
the title after a colon, where the text starting with the colon is not
|
||||
in boldface.
|
||||
|
||||
@section{Indexing}
|
||||
|
||||
Document and section titles, identifiers that are documented with
|
||||
@racket[defproc], @racket[defform], etc. are automatically indexed, as
|
||||
are terms defined with @racket[deftech].
|
||||
|
||||
Symbols are not indexed automatically. Use @racket[indexed-racket]
|
||||
instead of @racket[racket] for the instance of a symbol that roughly
|
||||
defines the use. For an example, try searching for ``truncate'' to
|
||||
find @racket['truncate] as used with @racket[open-output-file]. Do no
|
||||
use something like @racket[(index "'truncate")] to index a symbol,
|
||||
because it will not typeset correctly (i.e., in a fixed-width font
|
||||
with the color of a literal).
|
||||
|
||||
Use @racket[index], @racket[as-index], and @racket[section-index] as a
|
||||
last resort. Create index entries for terms that are completely
|
||||
different from terms otherwise indexed. Do not try to index minor
|
||||
variations of a term or phrase in an attempt to improve search
|
||||
results; if search fails to find a word or phrase due to a minor
|
||||
variation, then the search algorithm should be fixed, not the index
|
||||
entry.
|
||||
|
||||
@section[#:tag "examples-style"]{Examples}
|
||||
|
||||
Strive to include examples (using @racket[examples]) with the
|
||||
documentation of every function and syntactic form. When writing
|
||||
examples, refrain from using nonsense words like ``foo'' and ``bar.''
|
||||
For example, when documenting @racket[member], resist the temptation
|
||||
to write
|
||||
|
||||
@interaction[
|
||||
(member "foo" '("bar" "foo" "baz"))
|
||||
]
|
||||
|
||||
and instead write something like
|
||||
|
||||
@interaction[
|
||||
(member "Groucho" '("Harpo" "Groucho" "Zeppo"))
|
||||
]
|
|
@ -215,7 +215,7 @@
|
|||
(define (ltx s) (tt "\\" s)) ; command
|
||||
(define (ltxe s) (tt s)) ; enviornment
|
||||
(define (ltxd n s)
|
||||
(make-element #f (cons (index (list s) (ltx s))
|
||||
(make-element #f (cons (index (list (format "\\~a" s)) (ltx s))
|
||||
(for/list ([i (in-range n)]) (tt "{}")))))
|
||||
|
||||
;; Utility to render examples of scribble documentation forms
|
||||
|
|
|
@ -20,6 +20,10 @@ by @racket[load-xref], @racket[#f] otherwise.}
|
|||
|
||||
|
||||
@defproc[(load-xref [sources (listof (-> (or/c any/c (-> list?))))]
|
||||
[#:demand-source-for-use
|
||||
demand-source-for-use
|
||||
(tag? symbol? -> (or/c (-> any/c) #f))
|
||||
(lambda (_tag _use-id) (demand-source _tag))]
|
||||
[#:demand-source demand-source
|
||||
(tag? -> (or/c (-> any/c) #f))
|
||||
(lambda (_tag) #f)]
|
||||
|
@ -45,10 +49,22 @@ information, a @racket[#f] to be ignored, or a value produced by
|
|||
and the @racket[_doc-id] part (if any) overrides
|
||||
@racket[doc-id-string] to identify the source document.
|
||||
|
||||
The @racket[demand-source] function can effectively add a new source
|
||||
to @racket[sources] in response to a search for information on the
|
||||
given tag. The @racket[demand-source] function returns @racket[#f]
|
||||
to indicate that no new sources satisfy the given tag.
|
||||
The @racket[demand-source-for-use] function can effectively add a new
|
||||
source to @racket[sources] in response to a search for information on
|
||||
the given tag in the given rendering, where @racket[_use-id] is unique
|
||||
to a particular rendering request, a particular transfer (in the sense
|
||||
of @racket[xref-transfer-info]), or all direct queries of the
|
||||
cross-reference information (such as through
|
||||
@racket[xref-binding->definition-tag]). The
|
||||
@racket[demand-source-for-use] function should return @racket[#f] to
|
||||
indicate that no new sources satisfy the given tag for the given
|
||||
@racket[_use-id].
|
||||
|
||||
The default @racket[demand-source-for-use] function uses
|
||||
@racket[demand-source], which is provided only for backward
|
||||
compatibility. Since the @racket[demand-source] function accepts only
|
||||
a tag, it is suitable only when the result of @racket[load-xref] will
|
||||
only have a single use context, such as a single rendering.
|
||||
|
||||
Since the format of serialized information is specific to a rendering
|
||||
class, the optional @racket[using-render%] argument accepts the
|
||||
|
@ -72,7 +88,8 @@ method of @racket[render-mixin].
|
|||
Use @racket[load-collections-xref] from @racketmodname[setup/xref] to
|
||||
get all cross-reference information for installed documentation.
|
||||
|
||||
@history[#:changed "1.1" @elem{Added the @racket[#:doc-id] argument.}]}
|
||||
@history[#:changed "1.1" @elem{Added the @racket[#:doc-id] argument.}
|
||||
#:changed "1.34" @elem{Added the @racket[#:demand-source-for-use] argument.}]}
|
||||
|
||||
|
||||
@defproc[(xref-binding->definition-tag [xref xref?]
|
||||
|
@ -80,12 +97,18 @@ get all cross-reference information for installed documentation.
|
|||
(list/c (or/c module-path?
|
||||
module-path-index?)
|
||||
symbol?)
|
||||
(listof module-path-index?
|
||||
(list/c module-path-index?
|
||||
symbol?
|
||||
module-path-index?
|
||||
symbol?
|
||||
(one-of/c 0 1)
|
||||
(or/c exact-integer? false/c)
|
||||
(or/c exact-integer? false/c))
|
||||
(list/c (or/c module-path?
|
||||
module-path-index?)
|
||||
symbol?
|
||||
(one-of/c 0 1)
|
||||
(or/c exact-integer? false/c)
|
||||
(or/c exact-integer? false/c)))]
|
||||
[mode (or/c exact-integer? false/c)])
|
||||
(or/c tag? false/c)]{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#lang scribble/manual
|
||||
@(require (for-label scribble/struct
|
||||
@(require (for-label (only-in scribble/core content?)
|
||||
scribble/struct
|
||||
scriblib/autobib
|
||||
scheme/base
|
||||
scheme/contract))
|
||||
|
@ -52,19 +53,22 @@ includes a citation to section 8 of the Racket reference.
|
|||
([option (code:line #:style style-expr)
|
||||
(code:line #:disambiguate disambiguator-expr)
|
||||
(code:line #:spaces spaces-expr)
|
||||
(code:line #:render-date-bib render-date-expr)
|
||||
(code:line #:render-date-cite render-date-expr)
|
||||
(code:line #:render-date-in-bib render-date-expr)
|
||||
(code:line #:render-date-in-cite render-date-expr)
|
||||
(code:line #:date<? date-compare-expr)
|
||||
(code:line #:date=? date-compare-expr)])
|
||||
#:contracts ([style-expr (or/c author+date-style number-style)]
|
||||
[spaces-expr number]
|
||||
(code:line #:date=? date-compare-expr)
|
||||
(code:line #:cite-author cite-author-id)
|
||||
(code:line #:cite-year cite-year-id)])
|
||||
#:contracts ([style-expr (or/c number-style author+date-style author+date-square-bracket-style)]
|
||||
[spaces-expr number?]
|
||||
[disambiguator-expr (or/c #f (-> exact-nonnegative-integer? element?))]
|
||||
[render-date-expr (or/c #f (-> date? element?))]
|
||||
[date-compare-expr (or/c #f (-> date? date? boolean?))])]{
|
||||
|
||||
Binds @racket[~cite-id], @racket[citet-id], and
|
||||
@racket[generate-bibliography-id], which share state to accumulate and
|
||||
render citations.
|
||||
Binds @racket[~cite-id], @racket[citet-id],
|
||||
@racket[generate-bibliography-id], (optionally)
|
||||
@racket[cite-author-id], and (optionally) @racket[cite-year-id] which
|
||||
share state to accumulate and render citations.
|
||||
|
||||
The function bound to @racket[~cite-id] produces a citation referring
|
||||
to one or more bibliography entries with a preceding non-breaking
|
||||
|
@ -90,6 +94,30 @@ section for the bibliography. It has the contract
|
|||
(->* () (#:tag string? #:sec-title string?) part?)
|
||||
]
|
||||
|
||||
If provided, the function bound to @racket[cite-author-id]
|
||||
generates an element containing the authors of a paper.
|
||||
|
||||
@racketblock[
|
||||
(->* (bib?) element?)
|
||||
]
|
||||
|
||||
If provided, the function bound to @racket[cite-year-id]
|
||||
generates an element containing the year the paper was
|
||||
published in, or possibly multiple years if multiple papers
|
||||
are provided.
|
||||
|
||||
@racketblock[
|
||||
(->* (bib?) #:rest (listof? bib?) element?)
|
||||
]
|
||||
|
||||
The functions bound to @racket[cite-author-id] and
|
||||
@racket[cite-year-id] make it possible to create possessive textual citations.
|
||||
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/base
|
||||
@citeauthor[scribble-cite]'s (@citeyear[scribble-cite]) autobib library is pretty nifty.
|
||||
}|
|
||||
|
||||
The default value for the @racket[#:tag] argument is @racket["doc-bibliography"]
|
||||
and for @racket[#:sec-title] is @racket["Bibliography"].
|
||||
|
||||
|
@ -110,14 +138,23 @@ to add an extra element after the date; the default disambiguator adds
|
|||
ambiguous raises an exception. Date comparison is controlled by
|
||||
@racket[date-compare-expr]s. Dates in citations and dates in the
|
||||
bibliography may be rendered differently, as specified by the
|
||||
optionally given @racket[render-date-expr] functions.}
|
||||
optionally given @racket[render-date-expr] functions.
|
||||
|
||||
@history[#:changed "1.22" "Add optional ids for author-name and author-year"]
|
||||
}
|
||||
|
||||
@deftogether[(
|
||||
@defthing[author+date-style any/c]
|
||||
@defthing[author+date-square-bracket-style any/c]
|
||||
@defthing[number-style any/c]
|
||||
)]{
|
||||
|
||||
Styles for use with @racket[define-cite].}
|
||||
Styles for use with @racket[define-cite].
|
||||
|
||||
The @racket[author+date-square-bracket-style] definition is the same
|
||||
as @racket[author+date-style], except that references to citations
|
||||
are enclosed in @litchar["[]"] instead of @litchar["()"].
|
||||
}
|
||||
|
||||
|
||||
@defproc[(bib? [v any/c]) boolean?]{
|
||||
|
@ -182,16 +219,17 @@ describing a paper's location within a journal.}
|
|||
element?]{
|
||||
|
||||
Combines elements to generate an element that is suitable for
|
||||
describing a book's location.}
|
||||
describing a book's location.
|
||||
Both arguments are optional, but at least one must be supplied.}
|
||||
|
||||
@defproc[(techrpt-location [#:institution institution edition any/c]
|
||||
@defproc[(techrpt-location [#:institution institution any/c]
|
||||
[#:number number any/c])
|
||||
element?]{
|
||||
|
||||
Combines elements to generate an element that is suitable for
|
||||
describing a technical report's location.}
|
||||
|
||||
@defproc[(dissertation-location [#:institution institution edition any/c]
|
||||
@defproc[(dissertation-location [#:institution institution any/c]
|
||||
[#:degree degree any/c "PhD"])
|
||||
element?]{
|
||||
|
||||
|
@ -199,6 +237,17 @@ Combines elements to generate an element that is suitable for
|
|||
describing a dissertation.}
|
||||
|
||||
|
||||
@defproc[(book-chapter-location [title any/c]
|
||||
[#:pages pages (or (list/c any/c any/c) #f) #f]
|
||||
[#:section section any/c #f]
|
||||
[#:volume volume any/c #f]
|
||||
[#:publisher publisher any/c #f])
|
||||
element?]{
|
||||
|
||||
Combines elements to generate an element that is suitable for
|
||||
describing a paper's location within a chapter or part of a book.}
|
||||
|
||||
|
||||
@defproc[(author-name [first any/c]
|
||||
[last any/c]
|
||||
[#:suffix suffix any/c #f])
|
||||
|
@ -216,7 +265,7 @@ alphabetized appropriately. Any of @racket[name] or @racket[names]
|
|||
that are strings are
|
||||
parsed in the same way as by @racket[make-bib].}
|
||||
|
||||
@defproc[(org-author-name [name any/c]) element?]{
|
||||
@defproc[(org-author-name [name (or/c element? string?)]) element?]{
|
||||
|
||||
Converts an element for an organization name to one suitable for use
|
||||
as a bib-value author.}
|
||||
|
@ -227,7 +276,7 @@ Generates an element that is suitable for use as a ``others'' author.
|
|||
When combined with another author element via @racket[authors], the
|
||||
one created by @racket[other-authors] renders as ``et al.''}
|
||||
|
||||
@defproc[(editor [name name/c]) element?]{
|
||||
@defproc[(editor [name (or/c element? string?)]) element?]{
|
||||
|
||||
Takes an author-name element and create one that represents the editor
|
||||
of a collection. If a @racket[name] is a string, it is parsed in the
|
||||
|
|
35
scribble-doc/scriblib/scribblings/book-index.scrbl
Normal file
35
scribble-doc/scriblib/scribblings/book-index.scrbl
Normal file
|
@ -0,0 +1,35 @@
|
|||
#lang scribble/manual
|
||||
@(require (for-label scribble/core
|
||||
racket/base
|
||||
scriblib/book-index))
|
||||
|
||||
@title[#:tag "book-index"]{Book-Style Indexing}
|
||||
|
||||
@defmodule[scriblib/book-index]{Provides a list of style properties to
|
||||
attach to a Scribble document that contains an index part, making the
|
||||
index more suitable for a traditional rendering on paper. The style
|
||||
properties cause index entries to be merged when they have the same
|
||||
content, with (potentially) multiple page numbers attached to the
|
||||
merged entry.}
|
||||
|
||||
@defthing[book-index-style-properties list?]{
|
||||
|
||||
Combine these style properties with others for the style of a part
|
||||
(typically specified in @racket[title]) for a document that contains
|
||||
an index. The style properties enable index merging and select an
|
||||
implementation based on the @tt{cleveref} Latex package.
|
||||
|
||||
Example:
|
||||
|
||||
@codeblock[#:keep-lang-line? #t]|{
|
||||
#lang scribble/base
|
||||
@(require scriblib/book-index
|
||||
(only-in scribble/core make-style))
|
||||
|
||||
@title[#:style (make-style #f book-index-style-properties)]{Demo}
|
||||
|
||||
This paragraph is about @as-index{examples}.
|
||||
|
||||
This paragraph is about @as-index{examples}, too.
|
||||
|
||||
@index-section[]}|}
|
|
@ -15,21 +15,29 @@
|
|||
@defproc[(figure [tag string?] [caption content?]
|
||||
[p pre-flow?] ...
|
||||
[#:style style style? center-figure-style]
|
||||
[#:label-sep label-sep pre-content? ": "]
|
||||
[#:label-style label-style element-style? #f]
|
||||
[#:continue? continue? any/c #f])
|
||||
block?]
|
||||
@defproc[(figure* [tag string?] [caption content?]
|
||||
[p pre-flow?] ...
|
||||
[#:style style style? center-figure-style]
|
||||
[#:continue? continue? any/c #f])
|
||||
[#:label-sep label-sep pre-content? ": "]
|
||||
[#:label-style label-style element-style? #f]
|
||||
[#:continue? continue? any/c #f])
|
||||
block?]
|
||||
@defproc[(figure** [tag string?] [caption content?]
|
||||
[p pre-flow?] ...
|
||||
[#:style style style? center-figure-style]
|
||||
[#:label-sep label-sep pre-content? ": "]
|
||||
[#:label-style label-style element-style? #f]
|
||||
[#:continue? continue? any/c #f])
|
||||
block?]
|
||||
@defproc[(figure-here [tag string?] [caption content?]
|
||||
[pre-flow pre-flow?] ...
|
||||
[#:style style style? center-figure-style]
|
||||
[#:label-sep label-sep pre-content? ": "]
|
||||
[#:label-style label-style element-style? #f]
|
||||
[#:continue? continue? any/c #f])
|
||||
block?]
|
||||
)]{
|
||||
|
@ -52,8 +60,18 @@ By default, @racket[style] is set so that the content of the figure is
|
|||
centered. Use @racket[left-figure-style], @racket[center-figure-style],
|
||||
or @racket[right-figure-style] to specify the alignment.
|
||||
|
||||
The @racket[label-sep] and @racket[label-style] arguments adjust the
|
||||
way that the caption's label is shown. By default, the label is the
|
||||
word ``Figure'' followed by a space, the figure number, ``:'', and a
|
||||
space, but @racket[label-sep] can specify an alternative to the ``:''
|
||||
and ending space. The composed label is given the style specified by
|
||||
@racket[label-style].
|
||||
|
||||
If @racket[continue?] is a true value, then the figure counter is not
|
||||
incremented.}
|
||||
incremented.
|
||||
|
||||
@history[#:changed "1.24" @elem{Added the @racket[#:label-sep] and
|
||||
@racket[#:label-style] arguments.}]}
|
||||
|
||||
@deftogether[(
|
||||
@defthing[left-figure-style style?]
|
||||
|
@ -67,14 +85,28 @@ The @racket[left] binding is a synonym for @racket[left-figure-style],
|
|||
provided for backward compatibility.}
|
||||
|
||||
|
||||
@defproc[(figure-ref [tag string?] ...+) element?]{
|
||||
@defproc[(figure-ref [tag string?] ...+
|
||||
[#:link-render-style link-style (or/c link-render-style? #f)])
|
||||
element?]{
|
||||
|
||||
Generates a reference to one or more figures, using a lowercase word ``figure''.}
|
||||
Generates a reference to one or more figures, using a lowercase word ``figure''.
|
||||
|
||||
If @racket[link-style] or @racket[(current-link-render-style)] at the
|
||||
time of rendering indicates the @racket['number] style mode, then the
|
||||
word ``figure'' itself is not hyperlinked. Otherwise, the word
|
||||
@racket[figure] is hyperlinked together with the referenced figure's
|
||||
number.
|
||||
|
||||
@history[#:changed "1.26" @elem{Added the @racket[#:link-render-style] argument.}]}
|
||||
|
||||
|
||||
@defproc[(Figure-ref [tag string?] ...+) element?]{
|
||||
@defproc[(Figure-ref [tag string?] ...+
|
||||
[#:link-render-style link-style (or/c link-render-style? #f)])
|
||||
element?]{
|
||||
|
||||
Generates a reference to one or more figures, capitalizing the word ``Figure''.}
|
||||
Like @racket[figure-ref], but capitalizes the word ``Figure''.
|
||||
|
||||
@history[#:changed "1.26" @elem{Added the @racket[#:link-render-style] argument.}]}
|
||||
|
||||
|
||||
@defproc[(Figure-target [tag string?]
|
||||
|
|
|
@ -14,13 +14,12 @@ Creates a margin note for HTML and a footnote for Latex/PDF output.}
|
|||
|
||||
@defform[(define-footnote footnote-id footnote-part-id)]{
|
||||
|
||||
Binds @racket[footnote-id] to a form like @racket[note] that generates
|
||||
a footnote in HTML output as well as Latex/PDF output. To trigger the
|
||||
HTML output of the footnotes that are registered through
|
||||
@racket[footnote-id], the function bound to @racket[footnote-part-id]
|
||||
must be called at a position that corresponds the bottom of the HTML
|
||||
page. (The generated section will not show a title or appear in a
|
||||
table of contents; it will look like a footnote area.)
|
||||
Binds @racket[footnote-id] to a form like @racket[note] that registers a
|
||||
footnote.
|
||||
Binds @racket[footnote-part-id] to a function that generates a section to
|
||||
display the registered footnotes.
|
||||
(The section generated by @racket[footnote-part-id] will not show a title or
|
||||
appear in a table of contents; it will look like a footnote area.)
|
||||
|
||||
Beware that any content passed to @racket[footnote-id] will occur
|
||||
twice in at least an intermediate form of the document, and perhaps
|
||||
|
@ -28,6 +27,24 @@ also in the rendered form of the document. Consequently, the content
|
|||
passed to @racket[footnote-id] should not bind link targets or include
|
||||
other one-time declarations.}
|
||||
|
||||
Example:
|
||||
@codeblock|{
|
||||
#lang scribble/manual
|
||||
@require[scriblib/footnote]
|
||||
|
||||
@define-footnote[my-note make-my-note]
|
||||
|
||||
@title{Months of the Year}
|
||||
|
||||
@section{January}
|
||||
January has 31 days.
|
||||
|
||||
@section{February}
|
||||
February has 28 days in common years.@my-note{In leap years,
|
||||
February has 29 days.}
|
||||
|
||||
@make-my-note[]
|
||||
|
||||
@section{March}
|
||||
March has 30 days.
|
||||
}|
|
||||
|
|
|
@ -10,3 +10,4 @@
|
|||
@include-section["bibtex.scrbl"]
|
||||
@include-section["footnote.scrbl"]
|
||||
@include-section["render-cond.scrbl"]
|
||||
@include-section["book-index.scrbl"]
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
scribble-text-lib
|
||||
Copyright (c) 2010-2014 PLT Design Inc.
|
||||
|
||||
This package is distributed under the GNU Lesser General Public
|
||||
License (LGPL). This means that you can link this package into proprietary
|
||||
applications, provided you follow the rules stated in the LGPL. You
|
||||
can also modify this package; if you distribute a modified version,
|
||||
you must distribute it under the terms of the LGPL, which in
|
||||
particular means that you must release the source code for the
|
||||
modified software. See http://www.gnu.org/copyleft/lesser.html
|
||||
for more information.
|
42
scribble-html-lib/scribble/html/extra.rkt
Normal file
42
scribble-html-lib/scribble/html/extra.rkt
Normal file
|
@ -0,0 +1,42 @@
|
|||
#lang racket/base
|
||||
|
||||
;; (X)HTML elements that are uncommon / likely to cause namespace conflicts
|
||||
|
||||
(require "xml.rkt")
|
||||
|
||||
(define/provide-elements/empty
|
||||
source
|
||||
track)
|
||||
|
||||
(define/provide-elements/not-empty
|
||||
article
|
||||
aside
|
||||
audio
|
||||
bdi
|
||||
canvas
|
||||
data
|
||||
datalist
|
||||
figcaption
|
||||
figure
|
||||
footer
|
||||
header
|
||||
main
|
||||
map
|
||||
mark
|
||||
math
|
||||
meter
|
||||
nav
|
||||
output
|
||||
picture
|
||||
progress
|
||||
rb
|
||||
rp
|
||||
rt
|
||||
rtc
|
||||
ruby
|
||||
section
|
||||
summary
|
||||
svg
|
||||
template
|
||||
time
|
||||
video)
|
|
@ -1,6 +1,9 @@
|
|||
#lang racket/base
|
||||
|
||||
;; (X)HTML elements etc.
|
||||
;; Keep this file up to date with:
|
||||
;; https://html.spec.whatwg.org/multipage/#toc-semantics
|
||||
;; Put esoteric elements in scribble/html/extra
|
||||
|
||||
(require "xml.rkt" scribble/text)
|
||||
|
||||
|
@ -59,6 +62,7 @@
|
|||
style ; style info, which may include CDATA sections
|
||||
script ; script statements, which may include CDATA sections
|
||||
noscript ; alternate content container for non script-based rendering
|
||||
slot
|
||||
;; ========== Frames
|
||||
frameset ; only one noframes element permitted per document
|
||||
frame ; tiled window within frameset
|
||||
|
@ -76,6 +80,7 @@
|
|||
h4
|
||||
h5
|
||||
h6
|
||||
hgroup
|
||||
;; ========== Lists
|
||||
ul ; Unordered list
|
||||
ol ; Ordered (numbered) list
|
||||
|
@ -163,11 +168,16 @@
|
|||
tr ; holds th or td
|
||||
th ; header cell
|
||||
td ; table cell
|
||||
;; ========== Interactive Elements
|
||||
details
|
||||
dialog
|
||||
menuitem
|
||||
)
|
||||
|
||||
;; [*] empty elements, these are listed with an `EMPTY' content in
|
||||
;; http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
|
||||
(define/provide-elements/empty
|
||||
embed keygen wbr
|
||||
base meta link hr br basefont param img area input isindex col)
|
||||
|
||||
;; [*] elements with a cdata/comment body
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
(let loop ([xs xs] [as '()])
|
||||
(define a (and (pair? xs) (attribute->symbol (car xs))))
|
||||
(cond [(not a) (values (reverse as) xs)]
|
||||
[(null? (cdr xs)) (error 'attriubtes+body
|
||||
[(null? (cdr xs)) (error 'attributes+body
|
||||
"missing attribute value for `~s:'" a)]
|
||||
[else (loop (cddr xs) (cons (cons a (cadr xs)) as))])))
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
scribble-lib
|
||||
Copyright (c) 2010-2014 PLT Design Inc.
|
||||
|
||||
This package is distributed under the GNU Lesser General Public
|
||||
License (LGPL). This means that you can link this package into proprietary
|
||||
applications, provided you follow the rules stated in the LGPL. You
|
||||
can also modify this package; if you distribute a modified version,
|
||||
you must distribute it under the terms of the LGPL, which in
|
||||
particular means that you must release the source code for the
|
||||
modified software. See http://www.gnu.org/copyleft/lesser.html
|
||||
for more information.
|
|
@ -39,11 +39,16 @@
|
|||
(string->url
|
||||
(format "q?~a" query)))
|
||||
null))])))]
|
||||
[else
|
||||
(let* ([path (build-path (find-user-doc-dir) sub)]
|
||||
[path (if (file-exists? path) path (build-path (find-doc-dir) sub))])
|
||||
(notify path)
|
||||
(send-url/file path #:fragment fragment #:query query))]))
|
||||
[else
|
||||
(let* ([path (build-path (find-user-doc-dir) sub)]
|
||||
[path (if (file-exists? path) path (build-path (find-doc-dir) sub))])
|
||||
(notify path)
|
||||
(if (file-exists? path)
|
||||
(send-url/file path #:fragment fragment #:query query)
|
||||
(let ([part (lambda (pfx x) (if x (string-append pfx x) ""))])
|
||||
(send-url (string-append
|
||||
"https://docs.racket-lang.org/"
|
||||
sub (part "#" fragment) (part "?" query))))))]))
|
||||
|
||||
;; This is an example of changing this code to use the online manuals.
|
||||
;; Normally, it's better to set `doc-open-url` in "etc/config.rktd",
|
||||
|
|
|
@ -23,4 +23,4 @@
|
|||
|
||||
(define pkg-authors '(mflatt eli))
|
||||
|
||||
(define version "1.17")
|
||||
(define version "1.38")
|
||||
|
|
445
scribble-lib/scribble/acmart.rkt
Normal file
445
scribble-lib/scribble/acmart.rkt
Normal file
|
@ -0,0 +1,445 @@
|
|||
#lang racket/base
|
||||
|
||||
(require setup/collects
|
||||
racket/contract/base
|
||||
racket/list
|
||||
racket/string
|
||||
scribble/core
|
||||
scribble/base
|
||||
scribble/decode
|
||||
scribble/html-properties
|
||||
scribble/latex-properties
|
||||
scribble/private/tag
|
||||
scribble/private/lang-parameters
|
||||
(for-syntax racket/base))
|
||||
|
||||
(struct affiliation (position institution street-address city state postcode country)
|
||||
#:constructor-name author-affiliation
|
||||
#:name author-affiliation
|
||||
#:transparent)
|
||||
|
||||
(struct email (text)
|
||||
#:constructor-name author-email
|
||||
#:name author-email
|
||||
#:transparent)
|
||||
|
||||
(struct institution (name departments)
|
||||
#:constructor-name author-institution
|
||||
#:name author-institution
|
||||
#:transparent)
|
||||
|
||||
(provide/contract
|
||||
[title (->* ()
|
||||
(#:short pre-content?
|
||||
#:tag (or/c string? (listof string?) #f)
|
||||
#:tag-prefix (or/c string? module-path? #f)
|
||||
#:style (or/c style? string? symbol? #f)
|
||||
#:version (or/c string? #f)
|
||||
#:date (or/c string? #f))
|
||||
#:rest (listof pre-content?)
|
||||
title-decl?)]
|
||||
[author (->* ()
|
||||
(#:orcid (or/c pre-content? #f)
|
||||
#:affiliation (or/c pre-content?
|
||||
affiliation?
|
||||
(listof affiliation?)
|
||||
#f)
|
||||
#:email (or/c pre-content? email? (listof email?)))
|
||||
#:rest (listof pre-content?)
|
||||
block?)]
|
||||
[authorsaddresses (->* ()
|
||||
()
|
||||
#:rest (listof pre-content?)
|
||||
block?)]
|
||||
[shortauthors (->* ()
|
||||
()
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
[institution (->* ()
|
||||
(#:departments (listof (or/c pre-content? institution?)))
|
||||
#:rest pre-content?
|
||||
institution?)]
|
||||
[institution? (-> any/c boolean?)]
|
||||
[email (->* ()
|
||||
#:rest (listof pre-content?)
|
||||
email?)]
|
||||
[email-string (->* ()
|
||||
#:rest (listof string?)
|
||||
email?)]
|
||||
[email? (-> any/c boolean?)]
|
||||
[affiliation (->* ()
|
||||
(#:position (or/c pre-content? #f)
|
||||
#:institution (or/c pre-content? institution? (listof institution?) #f)
|
||||
#:street-address (or/c pre-content? #f)
|
||||
#:city (or/c pre-content? #f)
|
||||
#:state (or/c pre-content? #f)
|
||||
#:postcode (or/c pre-content? #f)
|
||||
#:country (or/c pre-content? #f))
|
||||
affiliation?)]
|
||||
[affiliation? (-> any/c boolean?)]
|
||||
[abstract
|
||||
(->* () () #:rest (listof pre-content?)
|
||||
block?)]
|
||||
[acmConference
|
||||
(-> string? string? string? block?)]
|
||||
[grantsponsor
|
||||
(-> string? string? string? content?)]
|
||||
[grantnum
|
||||
(->* (string? string?) (#:url string?) content?)]
|
||||
[acmBadgeR (->* (string?) (#:url string?) block?)]
|
||||
[acmBadgeL (->* (string?) (#:url string?) block?)]
|
||||
[received (->* (string?) (#:stage string?) block?)]
|
||||
[citestyle (-> content? block?)]
|
||||
[ccsdesc (->* (string?) (#:number exact-integer?) block?)]
|
||||
[CCSXML
|
||||
(->* () () #:rest (listof pre-content?)
|
||||
any/c)])
|
||||
(provide
|
||||
invisible-element-to-collect-for-acmart-extras
|
||||
include-abstract)
|
||||
|
||||
(define-syntax-rule (defopts name ...)
|
||||
(begin (define-syntax (name stx)
|
||||
(raise-syntax-error #f
|
||||
"option must appear on the same line as `#lang scribble/acmart'"
|
||||
stx))
|
||||
...
|
||||
(provide name ...)))
|
||||
|
||||
(define-syntax-rule (define-commands name ...)
|
||||
(begin
|
||||
(begin
|
||||
(provide/contract [name (->* () () #:rest (listof pre-content?)
|
||||
block?)])
|
||||
(define (name . str)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(make-element (make-style (symbol->string 'name) command-props)
|
||||
(decode-content str)))))
|
||||
...))
|
||||
|
||||
(define-syntax-rule (define-environments name ...)
|
||||
(begin
|
||||
(begin
|
||||
(provide/contract [name (->* () () #:rest (listof pre-flow?)
|
||||
block?)])
|
||||
(define (name . str)
|
||||
(make-nested-flow (make-style (symbol->string 'name) acmart-extras)
|
||||
(decode-flow str))))
|
||||
...))
|
||||
|
||||
; comment environments ensure the \begin and \end are on their own lines
|
||||
(define-syntax-rule (define-comment-environments name ...)
|
||||
(begin
|
||||
(begin
|
||||
(provide/contract [name (->* () () #:rest (listof pre-flow?)
|
||||
block?)])
|
||||
(define (name . str)
|
||||
(make-nested-flow (make-style (symbol->string 'name) acmart-extras)
|
||||
(append (list (make-paragraph (style #f '()) '("")))
|
||||
(decode-flow str)
|
||||
(list (make-paragraph (style #f '()) '("")))))))
|
||||
...))
|
||||
|
||||
; format options
|
||||
(defopts manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi sigchi-a
|
||||
dtrap pacmcgit tiot tdsci)
|
||||
; boolean options
|
||||
(defopts review screen natbib anonymous authorversion 9pt 10pt 11pt 12pt)
|
||||
|
||||
(define acmart-extras
|
||||
(let ([abs (lambda (s)
|
||||
(path->collects-relative
|
||||
(collection-file-path s "scribble" "acmart")))])
|
||||
(list
|
||||
(make-css-addition (abs "acmart.css"))
|
||||
(make-tex-addition (abs "acmart.tex")))))
|
||||
|
||||
(define invisible-element-to-collect-for-acmart-extras
|
||||
(make-element (make-style "invisible-element-to-collect-for-acmart-extras" acmart-extras) '()))
|
||||
|
||||
;; ----------------------------------------
|
||||
;; Abstracts:
|
||||
|
||||
(define abstract-style (make-style "abstract" (cons 'pretitle acmart-extras)))
|
||||
|
||||
(define command-props (cons 'command acmart-extras))
|
||||
(define multicommand-props (cons 'multicommand acmart-extras))
|
||||
|
||||
(define (abstract . strs)
|
||||
(make-nested-flow
|
||||
abstract-style
|
||||
(decode-flow strs)))
|
||||
|
||||
(define (extract-abstract p)
|
||||
(unless (part? p)
|
||||
(error 'include-abstract "doc binding is not a part: ~e" p))
|
||||
(unless (null? (part-parts p))
|
||||
(error 'include-abstract "abstract part has sub-parts: ~e" (part-parts p)))
|
||||
(when (part-title-content p)
|
||||
(error 'include-abstract "abstract part has title content: ~e" (part-title-content p)))
|
||||
(part-blocks p))
|
||||
|
||||
(define-syntax-rule (include-abstract mp)
|
||||
(begin
|
||||
(require (only-in mp [doc abstract-doc]))
|
||||
(make-nested-flow abstract-style (extract-abstract abstract-doc))))
|
||||
|
||||
(define (acmConference name date venue)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(make-multiarg-element (make-style "acmConference" multicommand-props)
|
||||
(list (decode-string name)
|
||||
(decode-string date)
|
||||
(decode-string venue)))))
|
||||
|
||||
(define (grantsponsor id name url)
|
||||
(make-multiarg-element (make-style "grantsponsor" multicommand-props)
|
||||
(list (decode-string id)
|
||||
(decode-string name)
|
||||
(decode-string url))))
|
||||
|
||||
(define (grantnum #:url [url #f] id num)
|
||||
(if url
|
||||
(make-multiarg-element (make-style "SgrantnumURL" multicommand-props)
|
||||
(list (decode-string url)
|
||||
(decode-string id)
|
||||
(decode-string num)))
|
||||
(make-multiarg-element (make-style "grantnum" multicommand-props)
|
||||
(list (decode-string id)
|
||||
(decode-string num)))))
|
||||
|
||||
(define (acmBadgeR #:url [url #f] str)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(if url
|
||||
(make-multiarg-element (make-style "SacmBadgeRURL" (cons 'exact-chars multicommand-props))
|
||||
(list (decode-string url)
|
||||
(decode-string str)))
|
||||
(make-element (make-style "acmBadgeR" (cons 'exact-chars command-props))
|
||||
(decode-string str)))))
|
||||
|
||||
(define (acmBadgeL #:url [url #f] str)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(if url
|
||||
(make-multiarg-element (make-style "SacmBadgeLURL" (cons 'exact-chars multicommand-props))
|
||||
(list (decode-string url)
|
||||
(decode-string str)))
|
||||
(make-element (make-style "acmBadgeL" (cons 'exact-chars command-props))
|
||||
(decode-string str)))))
|
||||
|
||||
(define (received #:stage [s #f] str)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(if s
|
||||
(make-multiarg-element (make-style "SreceivedStage" multicommand-props)
|
||||
(list (decode-string s)
|
||||
(decode-string str)))
|
||||
(make-element (make-style "received" command-props)
|
||||
(decode-string str)))))
|
||||
|
||||
(define (citestyle str)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(make-element (make-style "citestyle" command-props)
|
||||
(decode-string str))))
|
||||
|
||||
(define (ccsdesc #:number [n #f] str)
|
||||
(make-paragraph (make-style 'pretitle '())
|
||||
(if n
|
||||
(make-multiarg-element (make-style "SccsdescNumber" (cons 'exact-chars multicommand-props))
|
||||
(list (number->string n)
|
||||
(decode-string str)))
|
||||
(make-element (make-style "ccsdesc" (cons 'exact-chars command-props))
|
||||
(decode-string str)))))
|
||||
|
||||
(define (title #:tag [tag #f]
|
||||
#:tag-prefix [prefix #f]
|
||||
#:style [style plain]
|
||||
#:version [version #f]
|
||||
#:date [date #f]
|
||||
#:short [short #f]
|
||||
. str)
|
||||
(let ([content (decode-content str)])
|
||||
(make-title-decl (prefix->string prefix)
|
||||
(convert-tag tag content)
|
||||
version
|
||||
(let* ([s (convert-part-style 'title style)]
|
||||
[s (if date
|
||||
(make-style (style-name s)
|
||||
(cons (make-document-date date)
|
||||
(style-properties s)))
|
||||
s)]
|
||||
[s (if short
|
||||
(make-style (style-name s)
|
||||
(cons (short-title short)
|
||||
(style-properties s)))
|
||||
s)])
|
||||
s)
|
||||
content)))
|
||||
|
||||
(define (author #:orcid [orcid #f]
|
||||
#:affiliation [affiliation '()]
|
||||
#:email [email '()]
|
||||
. name)
|
||||
(make-paragraph
|
||||
(make-style 'author command-props)
|
||||
(decode-content
|
||||
(list
|
||||
(make-multiarg-element (make-style "SAuthorinfo" multicommand-props)
|
||||
(list (make-element #f (decode-content name))
|
||||
(make-element #f
|
||||
(if orcid
|
||||
(make-element
|
||||
(make-style "SAuthorOrcid" multicommand-props)
|
||||
(decode-content (list orcid)))
|
||||
'()))
|
||||
(make-element #f
|
||||
(cond
|
||||
[(affiliation? affiliation)
|
||||
(convert-affiliation affiliation)]
|
||||
[(pre-content? affiliation)
|
||||
(make-element
|
||||
(make-style "SAuthorPlace" multicommand-props)
|
||||
(decode-content (list affiliation)))]
|
||||
[else
|
||||
(for/list ([a (in-list affiliation)])
|
||||
(convert-affiliation a))]))
|
||||
(make-element #f
|
||||
(cond
|
||||
[(email? email)
|
||||
(convert-email email)]
|
||||
[(pre-content? email)
|
||||
(make-element
|
||||
(make-style "SAuthorEmail" multicommand-props)
|
||||
(decode-content (list email)))]
|
||||
[else
|
||||
(for/list ([e (in-list email)])
|
||||
(convert-email e))]))))))))
|
||||
|
||||
(define (authorsaddresses . content)
|
||||
(make-paragraph
|
||||
(make-style 'pretitle command-props)
|
||||
(make-element (make-style "authorsaddresses" command-props)
|
||||
(decode-content content))))
|
||||
|
||||
(define (shortauthors . content)
|
||||
(make-element (make-style "Sshortauthors" command-props)
|
||||
(decode-content content)))
|
||||
|
||||
(define (institution #:departments [departments '()]
|
||||
. name)
|
||||
(author-institution name departments))
|
||||
|
||||
(define (convert-institution inst
|
||||
#:department? [department? #f])
|
||||
(define level 0)
|
||||
(define (mk-inst name
|
||||
#:department? [department? department?]
|
||||
#:level [level level])
|
||||
(case department?
|
||||
[(#f) (make-element (make-style "institution" command-props)
|
||||
(decode-content name))]
|
||||
[(sub) (make-element (make-style "department"
|
||||
(cons (command-optional (list (number->string level)))
|
||||
command-props))
|
||||
(decode-content name))]
|
||||
[else (make-element (make-style "department"
|
||||
(append
|
||||
(if (> level 0)
|
||||
(list (command-optional (list (number->string level))))
|
||||
(list))
|
||||
command-props))
|
||||
(decode-content name))]))
|
||||
(define lst
|
||||
(append
|
||||
(for/list ([i (in-list (institution-departments inst))])
|
||||
(cond
|
||||
[(institution? i)
|
||||
(define-values (content new-level)
|
||||
(convert-institution i
|
||||
#:department? (or (and department? 'sub)
|
||||
#t)))
|
||||
(set! level (max level (+ 1 new-level)))
|
||||
content]
|
||||
[else
|
||||
(set! level 1)
|
||||
(mk-inst (list i)
|
||||
#:department? (or (and department? 'sub)
|
||||
#t)
|
||||
#:level 0)]))
|
||||
(list (mk-inst (institution-name inst)))))
|
||||
(if department?
|
||||
(values lst level)
|
||||
lst))
|
||||
|
||||
(define (email . text)
|
||||
(author-email text))
|
||||
|
||||
(define (email-string . text)
|
||||
(define text-escaped
|
||||
(for/list ([str (in-list text)])
|
||||
(escape-email-string str)))
|
||||
(author-email
|
||||
(list
|
||||
(make-element
|
||||
(make-style #f '(exact-chars))
|
||||
text-escaped))))
|
||||
|
||||
(define (convert-email email)
|
||||
(make-element
|
||||
(make-style "SAuthorEmail" command-props)
|
||||
(decode-content (email-text email))))
|
||||
|
||||
(define escape-email-map
|
||||
#(("#" . "\\#")
|
||||
("%" . "\\%")))
|
||||
(define (escape-email-string str)
|
||||
(for/fold ([str str])
|
||||
([escape-map (in-vector escape-email-map)])
|
||||
(string-replace str (car escape-map) (cdr escape-map))))
|
||||
|
||||
(define (affiliation #:position [position #f]
|
||||
#:institution [institution #f]
|
||||
#:street-address [street-address #f]
|
||||
#:city [city #f]
|
||||
#:state [state #f]
|
||||
#:postcode [postcode #f]
|
||||
#:country [country #f])
|
||||
(author-affiliation position institution street-address city state postcode country))
|
||||
|
||||
(define (convert-affiliation aff)
|
||||
(define (maybe-element str content)
|
||||
(and (content aff) (make-element str (decode-content (list (content aff))))))
|
||||
(make-element
|
||||
(make-style "SAuthorPlace" command-props)
|
||||
(make-multiarg-element
|
||||
(make-style #f multicommand-props)
|
||||
(filter values
|
||||
(append (list (maybe-element "position" affiliation-position))
|
||||
(if (institution? (affiliation-institution aff))
|
||||
(convert-institution (affiliation-institution aff))
|
||||
(list (maybe-element "institution" affiliation-institution)))
|
||||
(list (maybe-element "streetaddress" affiliation-street-address)
|
||||
(maybe-element "city" affiliation-city)
|
||||
(maybe-element "state" affiliation-state)
|
||||
(maybe-element "postcode" affiliation-postcode)
|
||||
(maybe-element "country" affiliation-country)))))))
|
||||
|
||||
(define-commands subtitle acmJournal
|
||||
thanks titlenote subtitlenote authornote acmVolume acmNumber acmArticle acmYear acmMonth
|
||||
acmArticleSeq acmPrice acmISBN acmDOI
|
||||
startPage terms keywords
|
||||
setcopyright copyrightyear
|
||||
settopmatter hortauthors)
|
||||
|
||||
(define (CCSXML . strs)
|
||||
(make-nested-flow (make-style "CCSXML" '())
|
||||
(list (make-paragraph (make-style #f '())
|
||||
(make-element (make-style #f '(exact-chars))
|
||||
(apply string-append strs))))))
|
||||
|
||||
(define-environments teaserfigure sidebar marginfigure margintable)
|
||||
(define-comment-environments printonly screenonly anonsuppress acks)
|
||||
|
||||
; FIXME: theorem styles
|
||||
|
||||
(default-figure-label-text (make-element 'sf "Fig."))
|
||||
(default-figure-label-sep ". ")
|
||||
(default-figure-caption-style 'sf)
|
||||
(default-figure-counter-style 'sf)
|
13
scribble-lib/scribble/acmart/acmart-load.tex
Normal file
13
scribble-lib/scribble/acmart/acmart-load.tex
Normal file
|
@ -0,0 +1,13 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% BEGIN acmart-load.tex
|
||||
% Avoid package option conflict
|
||||
\renewcommand\packageColor\relax
|
||||
\renewcommand\packageTocstyle\relax
|
||||
\renewcommand\packageMathabx{\ifx\bigtimes\undefined \usepackage{mathabx} \else \relax \fi}
|
||||
% Both 'mathabx' and 'newtxmath' (required by the 'acmart' class) define a '\bigtimes' command.
|
||||
\renewcommand\packageTxfonts\relax
|
||||
\let\Footnote\undefined
|
||||
\let\captionwidth\undefined
|
||||
\renewcommand{\renewrmdefault}{}
|
||||
% END acmart-load.tex
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2922
scribble-lib/scribble/acmart/acmart.cls
Normal file
2922
scribble-lib/scribble/acmart/acmart.cls
Normal file
File diff suppressed because it is too large
Load Diff
13
scribble-lib/scribble/acmart/acmart.css
Normal file
13
scribble-lib/scribble/acmart/acmart.css
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* Support for styles in scribble/acmart */
|
||||
|
||||
.SAuthorPlace, .SAuthorEmail,
|
||||
.SConferenceInfo, .SCopyrightYear, .SCopyrightData,
|
||||
.Sdoi, .SPexclusivelicense,
|
||||
.SCategory, .SCategoryPlus, .STerms, .SKeywords {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.SSubtitle {
|
||||
display: block;
|
||||
font-size: smaller;
|
||||
}
|
31
scribble-lib/scribble/acmart/acmart.tex
Normal file
31
scribble-lib/scribble/acmart/acmart.tex
Normal file
|
@ -0,0 +1,31 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% BEGIN acmart/acmart.tex
|
||||
% Support for styles in scribble/acmart
|
||||
|
||||
% These are replaced by scribble/acmart/style.tex,
|
||||
% which is used in combination with acmart.cls
|
||||
|
||||
\newcommand{\SAuthorinfo}[4]{#1}
|
||||
\newcommand{\SAuthorPlace}[1]{#1}
|
||||
\newcommand{\SAuthorEmail}[1]{#1}
|
||||
\newcommand{\SAuthorOrcid}[1]{#1}
|
||||
|
||||
\newcommand{\SConferenceInfo}[2]{}
|
||||
\newcommand{\SCopyrightYear}[1]{}
|
||||
\newcommand{\SCopyrightData}[1]{}
|
||||
\newcommand{\Sdoi}[1]{}
|
||||
\newcommand{\SPexclusivelicense}[0]{}
|
||||
|
||||
\newcommand{\SCategory}[3]{}
|
||||
\newcommand{\SCategoryPlus}[4]{}
|
||||
\newcommand{\STerms}[1]{}
|
||||
\newcommand{\SKeywords}[1]{}
|
||||
|
||||
% Normally gets re-written by the title macro:
|
||||
\newcommand{\SSubtitle}[1]{{\bf #1}}
|
||||
|
||||
% Use ACM color; it would be better to use `citecolor` here somehow,
|
||||
% but I can't figure out how to do that
|
||||
\newcommand{\AutobibLink}[1]{\color{ACMPurple}{#1}}
|
||||
% END acmart/acmart.tex
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
192
scribble-lib/scribble/acmart/lang.rkt
Normal file
192
scribble-lib/scribble/acmart/lang.rkt
Normal file
|
@ -0,0 +1,192 @@
|
|||
#lang racket/base
|
||||
(require scribble/doclang
|
||||
scribble/core
|
||||
(except-in scribble/base author title)
|
||||
scribble/acmart
|
||||
scribble/latex-prefix
|
||||
racket/list
|
||||
"../private/defaults.rkt"
|
||||
(for-syntax racket/base
|
||||
syntax/parse))
|
||||
(provide (except-out (all-from-out scribble/doclang) #%module-begin)
|
||||
(all-from-out scribble/acmart)
|
||||
(all-from-out scribble/base)
|
||||
(rename-out [module-begin #%module-begin]))
|
||||
|
||||
(define-syntax (module-begin stx)
|
||||
(syntax-case stx ()
|
||||
[(_ id . body)
|
||||
(let ([format? #f]
|
||||
[review? #f]
|
||||
[screen? #f]
|
||||
[natbib? #f]
|
||||
[anonymous? #f]
|
||||
[authorversion? #f]
|
||||
[font-size #f]
|
||||
[nonacm? #f]
|
||||
[timestamp? #f]
|
||||
[author-draft? #f]
|
||||
[acmthm? #f])
|
||||
(let loop ([stuff #'body])
|
||||
(syntax-parse stuff
|
||||
#:datum-literals (manuscript acmsmall acmlarge acmtog sigconf siggraph sigplan sigchi
|
||||
sigchi-a dtrap pacmcgit tiot tdsci review screen natbib
|
||||
anonymous authorversion 9pt 10pt 11pt 12pt nonacm timestamp
|
||||
authordraft acmthm)
|
||||
|
||||
;; Skip intraline whitespace to find options:
|
||||
[(ws . body)
|
||||
#:when (and (string? (syntax-e #'ws))
|
||||
(regexp-match? #rx"^ *$" (syntax-e #'ws)))
|
||||
(loop #'body)]
|
||||
|
||||
; boolean options
|
||||
[((review #t) . body)
|
||||
(set! review? "review=true")
|
||||
(loop #'body)]
|
||||
[((review #f) . body)
|
||||
(set! review? "review=false")
|
||||
(loop #'body)]
|
||||
[(review . body)
|
||||
(set! review? "review=true")
|
||||
(loop #'body)]
|
||||
[((screen #t) . body)
|
||||
(set! screen? "screen=true")
|
||||
(loop #'body)]
|
||||
[((screen #f) . body)
|
||||
(set! screen? "screen=false")
|
||||
(loop #'body)]
|
||||
[(screen . body)
|
||||
(set! screen? "screen=true")
|
||||
(loop #'body)]
|
||||
[((natbib #t) . body)
|
||||
(set! natbib? "natbib=true")
|
||||
(loop #'body)]
|
||||
[((natbib #f) . body)
|
||||
(set! natbib? "natbib=false")
|
||||
(loop #'body)]
|
||||
[(natbib . body)
|
||||
(set! natbib? "natbib=true")
|
||||
(loop #'body)]
|
||||
|
||||
[((anonymous #t) . body)
|
||||
(set! anonymous? "anonymous=true")
|
||||
(loop #'body)]
|
||||
[((anonymous #f) . body)
|
||||
(set! anonymous? "anonymous=false")
|
||||
(loop #'body)]
|
||||
[(anonymous . body)
|
||||
(set! anonymous? "anonymous=true")
|
||||
(loop #'body)]
|
||||
[((authorversion #t) . body)
|
||||
(set! authorversion? "authorversion=true")
|
||||
(loop #'body)]
|
||||
[((authorversion #f) . body)
|
||||
(set! authorversion? "authorversion=false")
|
||||
(loop #'body)]
|
||||
[(authorversion . body)
|
||||
(set! authorversion? "authorversion=true")
|
||||
(loop #'body)]
|
||||
[(9pt . body)
|
||||
(set! font-size "9pt")
|
||||
(loop #'body)]
|
||||
[(10pt . body)
|
||||
(set! font-size "10pt")
|
||||
(loop #'body)]
|
||||
[(11pt . body)
|
||||
(set! font-size "11pt")
|
||||
(loop #'body)]
|
||||
[(12pt . body)
|
||||
(set! font-size "12pt")
|
||||
(loop #'body)]
|
||||
[((nonacm #t) . body)
|
||||
(set! nonacm? "nonacm=true")
|
||||
(loop #'body)]
|
||||
[((nonacm #f) . body)
|
||||
(set! nonacm? "nonacm=false")
|
||||
(loop #'body)]
|
||||
[(nonacm . body)
|
||||
(set! nonacm? "nonacm=true")
|
||||
(loop #'body)]
|
||||
[(timestamp . body)
|
||||
(set! timestamp? "timestamp=true")
|
||||
(loop #'body)]
|
||||
[((timestamp #t) . body)
|
||||
(set! timestamp? "timestamp=true")
|
||||
(loop #'body)]
|
||||
[((timestamp #f) . body)
|
||||
(set! timestamp? "timestamp=false")
|
||||
(loop #'body)]
|
||||
[(authordraft . body)
|
||||
(set! author-draft? "authordraft=true")
|
||||
(loop #'body)]
|
||||
[((authordraft #t) . body)
|
||||
(set! author-draft? "authordraft=true")
|
||||
(loop #'body)]
|
||||
[((authordraft #f) . body)
|
||||
(set! author-draft? "authordraft=false")
|
||||
(loop #'body)]
|
||||
[(acmthm . body)
|
||||
(set! acmthm? "acmthm=true")
|
||||
(loop #'body)]
|
||||
[((acmthm #t) . body)
|
||||
(set! acmthm? "acmthm=true")
|
||||
(loop #'body)]
|
||||
[((acmthm #f) . body)
|
||||
(set! acmthm? "acmthm=false")
|
||||
(loop #'body)]
|
||||
|
||||
; format options
|
||||
[((~and fmt
|
||||
(~or manuscript
|
||||
acmsmall
|
||||
acmlarge
|
||||
acmtog
|
||||
sigconf
|
||||
siggraph
|
||||
sigplan
|
||||
sigchi
|
||||
sigchi-a
|
||||
dtrap
|
||||
pacmcgit
|
||||
tiot
|
||||
tdsci))
|
||||
. body)
|
||||
(set! format? (symbol->string (syntax->datum #'fmt)))
|
||||
(loop #'body)]
|
||||
|
||||
[body
|
||||
#`(#%module-begin id (post-process #,review? #,screen? #,natbib? #,anonymous?
|
||||
#,authorversion? #,font-size #,nonacm? #,timestamp?
|
||||
#,author-draft? #,acmthm? #,format?) () . body)])))]))
|
||||
|
||||
(define ((post-process . opts) doc)
|
||||
(let ([options
|
||||
(if (ormap values opts)
|
||||
(format "[~a]" (apply string-append (add-between (filter values opts) ", ")))
|
||||
"")])
|
||||
(add-acmart-styles
|
||||
(add-defaults doc
|
||||
(string->bytes/utf-8
|
||||
(format "\\documentclass~a{acmart}\n~a"
|
||||
options
|
||||
unicode-encoding-packages))
|
||||
(scribble-file "acmart/style.tex")
|
||||
(list (scribble-file "acmart/acmart.cls"))
|
||||
#f
|
||||
#:replacements (hash "scribble-load-replace.tex" (scribble-file "acmart/acmart-load.tex"))))))
|
||||
|
||||
(define (add-acmart-styles doc)
|
||||
(struct-copy part doc
|
||||
[to-collect
|
||||
;; Ensure that "acmart.tex" is used, since "style.tex"
|
||||
;; re-defines commands.
|
||||
(cons invisible-element-to-collect-for-acmart-extras
|
||||
(part-to-collect doc))]
|
||||
[style (let ([s (part-style doc)])
|
||||
(struct-copy style s
|
||||
[properties
|
||||
;; Immitate Latex-based links where only the
|
||||
;; number part is hyperlinked.
|
||||
(cons (link-render-style 'number)
|
||||
(style-properties s))]))]))
|
3
scribble-lib/scribble/acmart/lang/reader.rkt
Normal file
3
scribble-lib/scribble/acmart/lang/reader.rkt
Normal file
|
@ -0,0 +1,3 @@
|
|||
#lang s-exp scribble/base/reader
|
||||
scribble/acmart/lang
|
||||
#:wrapper1 (lambda (t) (cons 'doc (t)))
|
53
scribble-lib/scribble/acmart/style.tex
Normal file
53
scribble-lib/scribble/acmart/style.tex
Normal file
|
@ -0,0 +1,53 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% BEGIN acmart/style.tex
|
||||
|
||||
\renewcommand{\titleAndVersionAndAuthors}[3]{\title{#1}#3\maketitle}
|
||||
\renewcommand{\titleAndEmptyVersionAndAuthors}[3]{\titleAndVersionAndAuthors{#1}{#2}{#3}}
|
||||
\renewcommand{\titleAndVersionAndEmptyAuthors}[3]{\title{#1}\author{Anonymous Author(s)}\maketitle}
|
||||
\renewcommand{\titleAndEmptyVersionAndEmptyAuthors}[3]{\titleAndVersionAndEmptyAuthors{#1}{#2}{#3}}
|
||||
\renewcommand{\titleAndVersionAndAuthorsAndShort}[4]{\title[#4]{#1}#3\maketitle}
|
||||
\renewcommand{\titleAndEmptyVersionAndAuthorsAndShort}[4]{\titleAndVersionAndAuthorsAndShort{#1}{#2}{#3}{#4}}
|
||||
\renewcommand{\titleAndVersionAndEmptyAuthorsAndShort}[4]{\title[#4]{#1}\author{Anonymous Author(s)}\maketitle}
|
||||
\renewcommand{\titleAndEmptyVersionAndEmptyAuthorsAndShort}[4]{\titleAndVersionAndEmptyAuthorsAndShort{#1}{#2}{#3}{#4}}
|
||||
|
||||
% Support plain `author' while enabling `authorinfo': for each
|
||||
% use of \SAuthor, check whether it contains an \SAuthorinfo form:
|
||||
\def\SAuthor#1{\SAutoAuthor#1\SAutoAuthorDone{#1}}
|
||||
\def\SAutoAuthorDone#1{}
|
||||
\def\SAutoAuthor{\futurelet\next\SAutoAuthorX}
|
||||
\def\SAutoAuthorX{\ifx\next\SAuthorinfo \let\Snext\relax \else \let\Snext\SToAuthorDone \fi \Snext}
|
||||
\def\SToAuthorDone{\futurelet\next\SToAuthorDoneX}
|
||||
\def\SToAuthorDoneX#1{\ifx\next\SAutoAuthorDone \let\Snext\SAddAuthorInfo \else \let\Snext\SToAuthorDone \fi \Snext}
|
||||
\newcommand{\SAddAuthorInfo}[1]{\SAuthorinfo{#1}{}{}}
|
||||
|
||||
\renewcommand{\SAuthorinfo}[4]{\author{#1}{#2}{#3}{#4}}
|
||||
\renewcommand{\SAuthorSep}[1]{}
|
||||
\renewcommand{\SAuthorOrcid}[1]{\orcid{#1}}
|
||||
\renewcommand{\SAuthorPlace}[1]{\affiliation{#1}}
|
||||
\renewcommand{\SAuthorEmail}[1]{\email{#1}}
|
||||
|
||||
\renewcommand{\SConferenceInfo}[2]{\conferenceinfo{#1}{#2}}
|
||||
\renewcommand{\SCopyrightYear}[1]{\copyrightyear{#1}}
|
||||
\renewcommand{\SCopyrightData}[1]{\copyrightdata{#1}}
|
||||
%\renewcommand{\Sdoi}[1]{\doi{#1}}
|
||||
\renewcommand{\SPexclusivelicense}[0]{\exclusivelicense}
|
||||
|
||||
\renewcommand{\SCategory}[3]{\category{#1}{#2}{#3}}
|
||||
\renewcommand{\SCategoryPlus}[4]{\category{#1}{#2}{#3}[#4]}
|
||||
\renewcommand{\STerms}[1]{\terms{#1}}
|
||||
\renewcommand{\SKeywords}[1]{\keywords{#1}}
|
||||
|
||||
\newcommand{\StitleShort}[2]{\title[#1]{#2}}
|
||||
|
||||
\newcommand{\Sshortauthors}[1]{\renewcommand{\shortauthors}{#1}}
|
||||
|
||||
\newcommand{\SacmBadgeRURL}[2]{\acmBadgeR[#1]{#2}}
|
||||
\newcommand{\SacmBadgeLURL}[2]{\acmBadgeL[#1]{#2}}
|
||||
|
||||
\newcommand{\SgrantnumURL}[3]{\grantnum[#1]{#2}{#3}}
|
||||
|
||||
\newcommand{\SreceivedStage}[2]{\received[#1]{#2}}
|
||||
|
||||
\newcommand{\SccsdescNumber}[2]{\ccsdesc[#1]{#2}}
|
||||
% END acmart/style.tex
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@ -39,6 +39,7 @@
|
|||
render-nested-flow
|
||||
render-block
|
||||
render-other
|
||||
link-render-style-at-element
|
||||
get-dest-directory
|
||||
format-number
|
||||
number-depth))
|
||||
|
@ -72,35 +73,41 @@
|
|||
#f)
|
||||
|
||||
(define/public (format-number number sep [keep-separator? #f])
|
||||
(if (or (null? number)
|
||||
(andmap (lambda (x) (or (not x) (equal? x "")))
|
||||
number)
|
||||
(and (not (car number))
|
||||
(not (ormap number? number))))
|
||||
null
|
||||
(cons (let ([s (string-append
|
||||
(apply
|
||||
string-append
|
||||
(map (lambda (n)
|
||||
(cond
|
||||
[(number? n) (format "~a." n)]
|
||||
[(or (not n) (string? n)) ""]
|
||||
[(pair? n) (string-append (car n) (cadr n))]))
|
||||
(reverse (cdr number))))
|
||||
(if (and (car number)
|
||||
(not (equal? "" (car number))))
|
||||
(if (pair? (car number))
|
||||
(if keep-separator?
|
||||
(string-append (caar number)
|
||||
(cadar number))
|
||||
(caar number))
|
||||
(format "~a." (car number)))
|
||||
""))])
|
||||
(if (or keep-separator?
|
||||
(pair? (car number)))
|
||||
s
|
||||
(substring s 0 (sub1 (string-length s)))))
|
||||
sep)))
|
||||
(cond
|
||||
[(or (null? number)
|
||||
(andmap (lambda (x) (or (not x) (equal? x "")))
|
||||
number)
|
||||
(and (not (car number))
|
||||
(not (ormap number? number))))
|
||||
null]
|
||||
[else
|
||||
(define result-s
|
||||
(let ([s (string-append
|
||||
(apply
|
||||
string-append
|
||||
(map (lambda (n)
|
||||
(cond
|
||||
[(number? n) (format "~a." n)]
|
||||
[(or (not n) (string? n)) ""]
|
||||
[(pair? n) (string-append (car n) (cadr n))]))
|
||||
(reverse (cdr number))))
|
||||
(if (and (car number)
|
||||
(not (equal? "" (car number))))
|
||||
(if (pair? (car number))
|
||||
(if keep-separator?
|
||||
(string-append (caar number)
|
||||
(cadar number))
|
||||
(caar number))
|
||||
(format "~a." (car number)))
|
||||
""))])
|
||||
(if (or keep-separator?
|
||||
(pair? (car number))
|
||||
(equal? s ""))
|
||||
s
|
||||
(substring s 0 (sub1 (string-length s))))))
|
||||
(if (equal? result-s "")
|
||||
null
|
||||
(cons result-s sep))]))
|
||||
|
||||
(define/public (number-depth number)
|
||||
(if (null? number)
|
||||
|
@ -245,25 +252,42 @@
|
|||
(document-date-text v)))
|
||||
(style-properties (part-style d))))
|
||||
|
||||
(define/private (extract-pre-paras d sym)
|
||||
(define/private (extract-content d lift-proc)
|
||||
(let loop ([l (part-blocks d)])
|
||||
(apply append
|
||||
(for/list ([b (in-list l)])
|
||||
(define lifted (lift-proc b loop))
|
||||
lifted))))
|
||||
|
||||
(define/private (extract-pre-paras-proc sym)
|
||||
(λ (v loop)
|
||||
(cond
|
||||
[(null? l) null]
|
||||
[else (let ([v (car l)])
|
||||
(cond
|
||||
[(and (paragraph? v)
|
||||
(eq? sym (style-name (paragraph-style v))))
|
||||
(cons v (loop (cdr l)))]
|
||||
[(compound-paragraph? v)
|
||||
(append (loop (compound-paragraph-blocks v))
|
||||
(loop (cdr l)))]
|
||||
[else (loop (cdr l))]))])))
|
||||
[(and (paragraph? v)
|
||||
(eq? sym (style-name (paragraph-style v))))
|
||||
(list v)]
|
||||
[(compound-paragraph? v)
|
||||
(loop (compound-paragraph-blocks v))]
|
||||
[else '()])))
|
||||
|
||||
(define/private (extract-pre-content-proc sym)
|
||||
(λ (v loop)
|
||||
(define pre-para ((extract-pre-paras-proc sym) v loop))
|
||||
(cond
|
||||
[(not (null? pre-para)) pre-para]
|
||||
[(and (nested-flow? v)
|
||||
(member sym (style-properties (nested-flow-style v))))
|
||||
(list v)]
|
||||
[else '()])))
|
||||
|
||||
|
||||
(define/public (extract-authors d)
|
||||
(extract-pre-paras d 'author))
|
||||
|
||||
(extract-content d (extract-pre-paras-proc 'author)))
|
||||
|
||||
(define/public (extract-pretitle d)
|
||||
(extract-pre-paras d 'pretitle))
|
||||
(extract-content d (extract-pre-paras-proc 'pretitle)))
|
||||
|
||||
(define/public (extract-pretitle-content d)
|
||||
(extract-content d (extract-pre-content-proc 'pretitle)))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
||||
|
@ -583,17 +607,28 @@
|
|||
number))
|
||||
sub-pos
|
||||
sub-numberers))
|
||||
(define unnumbered-and-unnumbered-subsections?
|
||||
(and (not sub-grouper?)
|
||||
;; If this section wasn't marked with
|
||||
;; 'grouper but is unnumbered and doesn't
|
||||
;; have numbered subsections, then didn't
|
||||
;; reset counters, so propagate the old
|
||||
;; position
|
||||
(and unnumbered?
|
||||
(= next-sub-pos sub-pos))))
|
||||
(loop (cdr parts)
|
||||
(if (or unnumbered? numberer)
|
||||
pos
|
||||
(add1 pos))
|
||||
next-numberers
|
||||
(if sub-grouper?
|
||||
next-sub-pos
|
||||
1)
|
||||
(if sub-grouper?
|
||||
next-sub-numberers
|
||||
#hash())))))))
|
||||
(cond
|
||||
[sub-grouper? next-sub-pos]
|
||||
[unnumbered-and-unnumbered-subsections? sub-pos]
|
||||
[else 1])
|
||||
(cond
|
||||
[sub-grouper? next-sub-numberers]
|
||||
[unnumbered-and-unnumbered-subsections? sub-numberers]
|
||||
[else #hash()])))))))
|
||||
(let ([prefix (part-tag-prefix d)])
|
||||
(for ([(k v) (collect-info-ht p-ci)])
|
||||
(when (cadr k)
|
||||
|
@ -674,6 +709,8 @@
|
|||
(begin (when (target-element? i) (collect-target-element i ci))
|
||||
(when (index-element? i) (collect-index-element i ci))
|
||||
(when (collect-element? i) ((collect-element-collect i) ci))
|
||||
(when (traverse-element? i)
|
||||
(collect-content (traverse-element-content i ci) ci))
|
||||
(when (element? i)
|
||||
(collect-content (element-content i) ci))
|
||||
(when (multiarg-element? i)
|
||||
|
@ -708,11 +745,12 @@
|
|||
ri))
|
||||
|
||||
(define/public (start-resolve ds fns ri)
|
||||
(map (lambda (d) (resolve-part d ri)) ds))
|
||||
(for-each (lambda (d) (resolve-part d ri)) ds))
|
||||
|
||||
(define/public (resolve-part d ri)
|
||||
(parameterize ([current-tag-prefixes
|
||||
(extend-prefix d (fresh-tag-resolve-context? d ri))])
|
||||
(extend-prefix d (fresh-tag-resolve-context? d ri))]
|
||||
[current-link-render-style (part-render-style d)])
|
||||
(when (part-title-content d)
|
||||
(resolve-content (part-title-content d) d ri))
|
||||
(resolve-flow (part-blocks d) d ri)
|
||||
|
@ -786,6 +824,15 @@
|
|||
[(multiarg-element? i)
|
||||
(resolve-content (multiarg-element-contents i) d ri)]))
|
||||
|
||||
(define/public (link-render-style-at-element e)
|
||||
(link-render-style-mode
|
||||
(or (let ([s (element-style e)])
|
||||
(and (style? s)
|
||||
(for/or ([p (in-list (style-properties s))]
|
||||
#:when (link-render-style? p))
|
||||
p)))
|
||||
(current-link-render-style))))
|
||||
|
||||
;; ----------------------------------------
|
||||
;; render methods
|
||||
|
||||
|
@ -846,9 +893,16 @@
|
|||
|
||||
(define/public (render-part d ri)
|
||||
(parameterize ([current-tag-prefixes
|
||||
(extend-prefix d (fresh-tag-render-context? d ri))])
|
||||
(extend-prefix d (fresh-tag-render-context? d ri))]
|
||||
[current-link-render-style (part-render-style d)])
|
||||
(render-part-content d ri)))
|
||||
|
||||
(define/private (part-render-style d)
|
||||
(or (for/or ([p (in-list (style-properties (part-style d)))]
|
||||
#:when (link-render-style? p))
|
||||
p)
|
||||
(current-link-render-style)))
|
||||
|
||||
(define/public (render-part-content d ri)
|
||||
(list
|
||||
(when (part-title-content d)
|
||||
|
@ -937,7 +991,11 @@
|
|||
(render-content (traverse-element-content i ri) part ri)]
|
||||
[(part-relative-element? i)
|
||||
(render-content (part-relative-element-content i ri) part ri)]
|
||||
[(convertible? i) (list "???")]
|
||||
[(convertible? i)
|
||||
(define s (convert i 'text))
|
||||
(if (string? s)
|
||||
(render-other s part ri)
|
||||
(render-other (format "~s" i) part ri))]
|
||||
[else (render-other i part ri)]))
|
||||
|
||||
(define/public (render-other i part ri)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"decode-struct.rkt"
|
||||
"html-properties.rkt"
|
||||
"tag.rkt"
|
||||
"private/tag.rkt"
|
||||
scheme/list
|
||||
scheme/class
|
||||
racket/contract/base
|
||||
|
@ -42,29 +43,6 @@
|
|||
block?)])
|
||||
(provide include-section)
|
||||
|
||||
(define (gen-tag content)
|
||||
(datum-intern-literal
|
||||
(regexp-replace* "[^-a-zA-Z0-9_=]" (content->string content) "_")))
|
||||
|
||||
(define (prefix->string p)
|
||||
(and p (if (string? p)
|
||||
(datum-intern-literal p)
|
||||
(module-path-prefix->string p))))
|
||||
|
||||
(define (convert-tag tag content)
|
||||
(if (list? tag)
|
||||
(append-map (lambda (t) (convert-tag t content)) tag)
|
||||
`((part ,(or tag (gen-tag content))))))
|
||||
|
||||
(define (convert-part-style who s)
|
||||
(cond
|
||||
[(style? s) s]
|
||||
[(not s) plain]
|
||||
[(string? s) (make-style s null)]
|
||||
[(symbol? s) (make-style #f (list s))]
|
||||
[(and (list? s) (andmap symbol? s)) (make-style #f s)]
|
||||
[else (raise-argument-error who "(or/c style? string? symbol? (listof symbol?) #f)" s)]))
|
||||
|
||||
(define (title #:tag [tag #f] #:tag-prefix [prefix #f] #:style [style plain]
|
||||
#:version [version #f] #:date [date #f]
|
||||
. str)
|
||||
|
@ -280,7 +258,7 @@
|
|||
(make-element 'larger (decode-content str)))
|
||||
|
||||
(define (emph . str)
|
||||
(make-element 'italic (decode-content str)))
|
||||
(make-element 'emph (decode-content str)))
|
||||
|
||||
(define (tt . str)
|
||||
(let* ([l (decode-content str)]
|
||||
|
@ -351,7 +329,8 @@
|
|||
#:sep (or/c content? block? #f)
|
||||
#:column-properties (listof any/c)
|
||||
#:row-properties (listof any/c)
|
||||
#:cell-properties (listof (listof any/c)))
|
||||
#:cell-properties (listof (listof any/c))
|
||||
#:sep-properties (or/c list? #f))
|
||||
table?)])
|
||||
|
||||
(define (convert-block-style style)
|
||||
|
@ -374,6 +353,7 @@
|
|||
|
||||
(define (tabular #:style [style #f]
|
||||
#:sep [sep #f]
|
||||
#:sep-properties [sep-props #f]
|
||||
#:column-properties [column-properties null]
|
||||
#:row-properties [row-properties null]
|
||||
#:cell-properties [cell-properties null]
|
||||
|
@ -448,7 +428,7 @@
|
|||
[(null? column-properties)
|
||||
(if (or (zero? n) (not sep))
|
||||
(cons prev (loop null (add1 n) prev))
|
||||
(list* prev prev (loop null (+ n 2) prev)))]
|
||||
(list* (or sep-props prev) prev (loop null (+ n 2) prev)))]
|
||||
[else
|
||||
(define (to-list v) (if (list? v) v (list v)))
|
||||
(define props (to-list (car column-properties)))
|
||||
|
@ -459,7 +439,7 @@
|
|||
props))
|
||||
(if (or (zero? n) (not sep))
|
||||
(cons props rest)
|
||||
(list* null props rest))])))
|
||||
(list* (or sep-props prev) props rest))])))
|
||||
(define full-column-properties
|
||||
(make-full-column-properties column-properties))
|
||||
(define (make-full-cell-properties cell-properties)
|
||||
|
@ -571,45 +551,55 @@
|
|||
|
||||
;; ----------------------------------------
|
||||
|
||||
(provide/contract
|
||||
[elemtag (->* ((or/c tag? string?))
|
||||
()
|
||||
#:rest (listof pre-content?)
|
||||
(provide
|
||||
(contract-out
|
||||
[elemtag (->* ((or/c taglet? generated-tag?))
|
||||
()
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
[elemref (->* ((or/c taglet? generated-tag?))
|
||||
(#:underline? any/c)
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
[secref (->* (string?)
|
||||
(#:doc (or/c #f module-path?)
|
||||
#:tag-prefixes (or/c #f (listof string?))
|
||||
#:underline? any/c
|
||||
#:link-render-style (or/c #f link-render-style?))
|
||||
element?)]
|
||||
[elemref (->* ((or/c tag? string?))
|
||||
(#:underline? any/c)
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
[secref (->* (string?)
|
||||
(#:doc module-path?
|
||||
#:tag-prefixes (or/c #f (listof string?))
|
||||
#:underline? any/c)
|
||||
element?)]
|
||||
[Secref (->* (string?)
|
||||
(#:doc module-path?
|
||||
#:tag-prefixes (or/c #f (listof string?))
|
||||
#:underline? any/c)
|
||||
element?)]
|
||||
[seclink (->* (string?)
|
||||
[Secref (->* (string?)
|
||||
(#:doc module-path?
|
||||
#:tag-prefixes (or/c #f (listof string?))
|
||||
#:underline? any/c
|
||||
#:indirect? any/c)
|
||||
#:rest (listof pre-content?)
|
||||
#:tag-prefixes (or/c #f (listof string?))
|
||||
#:underline? any/c
|
||||
#:link-render-style (or/c #f link-render-style?))
|
||||
element?)]
|
||||
[other-doc (->* (module-path?)
|
||||
(#:underline? any/c
|
||||
#:indirect (or/c #f content?))
|
||||
element?)])
|
||||
[seclink (->* (string?)
|
||||
(#:doc module-path?
|
||||
#:tag-prefixes (or/c #f (listof string?))
|
||||
#:underline? any/c
|
||||
#:indirect? any/c)
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
[other-doc (->* (module-path?)
|
||||
(#:underline? any/c
|
||||
#:indirect (or/c #f content?))
|
||||
element?)]))
|
||||
|
||||
(define (elemtag t . body)
|
||||
(make-target-element #f (decode-content body) `(elem ,t)))
|
||||
(define (elemref #:underline? [u? #t] t . body)
|
||||
(make-link-element (if u? #f "plainlink") (decode-content body) `(elem ,t)))
|
||||
|
||||
(define (secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f])
|
||||
(make-link-element (if u? #f "plainlink") null (make-section-tag s #:doc doc #:tag-prefixes prefix)))
|
||||
(define (Secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f])
|
||||
(define (secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f]
|
||||
#:link-render-style [link-style #f])
|
||||
(make-link-element (let ([name (if u? #f "plainlink")])
|
||||
(if link-style
|
||||
(style name (list link-style))
|
||||
name))
|
||||
null
|
||||
(make-section-tag s #:doc doc #:tag-prefixes prefix)))
|
||||
(define (Secref s #:underline? [u? #t] #:doc [doc #f] #:tag-prefixes [prefix #f]
|
||||
#:link-render-style [link-style #f])
|
||||
(let ([le (secref s #:underline? u? #:doc doc #:tag-prefixes prefix)])
|
||||
(make-link-element
|
||||
(make-style (element-style le) '(uppercase))
|
||||
|
@ -769,7 +759,7 @@
|
|||
;; and non-strings --- to a paragraph for the line:
|
||||
(let* ([line (indent (strs->elts line))])
|
||||
(list (make-paragraph omitable-style (make-nonempty line)))))
|
||||
(make-table plain (map make-line lines)))
|
||||
(make-table (make-style "SVerbatim" null) (map make-line lines)))
|
||||
|
||||
(define omitable-style (make-style 'omitable null))
|
||||
|
||||
|
|
|
@ -1,93 +1,122 @@
|
|||
(module bnf racket
|
||||
(require "struct.rkt"
|
||||
"decode.rkt"
|
||||
(only-in "core.rkt"
|
||||
make-style
|
||||
make-table-columns)
|
||||
mzlib/kw)
|
||||
#lang racket
|
||||
|
||||
(provide BNF
|
||||
nonterm
|
||||
BNF-seq BNF-seq-lines
|
||||
BNF-alt BNF-alt/close ; single-line alternatives
|
||||
BNF-etc
|
||||
BNF-group
|
||||
optional kleenestar kleeneplus kleenerange)
|
||||
(require scribble/decode
|
||||
(except-in scribble/struct
|
||||
element?)
|
||||
(only-in scribble/core
|
||||
content?
|
||||
element?
|
||||
make-style
|
||||
make-table-columns)
|
||||
)
|
||||
|
||||
(define spacer (make-element 'hspace (list " ")))
|
||||
(define equals (make-element 'tt (list spacer "::=" spacer)))
|
||||
(define alt (make-element 'tt (list spacer spacer "|" spacer spacer)))
|
||||
|
||||
(define (as-flow i) (make-flow (list (if (block? i)
|
||||
i
|
||||
(make-paragraph (list i))))))
|
||||
(provide (contract-out
|
||||
[BNF (-> (cons/c (or/c block? content?)
|
||||
(non-empty-listof (or/c block? content?)))
|
||||
...
|
||||
table?)]
|
||||
[BNF-etc element?]
|
||||
;; operate on content
|
||||
[BNF-seq (-> content? ...
|
||||
(or/c element? ""))]
|
||||
[BNF-seq-lines (-> (listof content?) ...
|
||||
block?)]
|
||||
[BNF-alt (-> content? ...
|
||||
element?)]
|
||||
[BNF-alt/close (-> content? ...
|
||||
element?)]
|
||||
;; operate on pre-content
|
||||
[BNF-group (-> pre-content? ...
|
||||
element?)]
|
||||
[nonterm (-> pre-content? ...
|
||||
element?)]
|
||||
[optional (-> pre-content? ...
|
||||
element?)]
|
||||
[kleenestar (-> pre-content? ...
|
||||
element?)]
|
||||
[kleeneplus (-> pre-content? ...
|
||||
element?)]
|
||||
[kleenerange (-> any/c any/c pre-content? ...
|
||||
element?)]
|
||||
))
|
||||
|
||||
|
||||
(define baseline (make-style #f '(baseline)))
|
||||
(define spacer (make-element 'hspace (list " ")))
|
||||
(define equals (make-element 'tt (list spacer "::=" spacer)))
|
||||
(define alt (make-element 'tt (list spacer spacer "|" spacer spacer)))
|
||||
|
||||
(define (BNF . defns)
|
||||
(make-table
|
||||
(make-style #f
|
||||
(list
|
||||
(make-table-columns
|
||||
(list baseline baseline baseline baseline))))
|
||||
(apply
|
||||
append
|
||||
(map (lambda (defn)
|
||||
(cons
|
||||
(list (as-flow spacer) (as-flow (car defn)) (as-flow equals) (as-flow (cadr defn)))
|
||||
(map (lambda (i)
|
||||
(list (as-flow spacer) (as-flow " ") (as-flow alt) (as-flow i)))
|
||||
(cddr defn))))
|
||||
defns))))
|
||||
(define (as-flow i) (make-flow (list (if (block? i)
|
||||
i
|
||||
(make-paragraph (list i))))))
|
||||
|
||||
(define (interleave l spacer)
|
||||
(make-element #f (cons (car l)
|
||||
(apply append
|
||||
(map (lambda (i)
|
||||
(list spacer i))
|
||||
(cdr l))))))
|
||||
|
||||
(define (BNF-seq . l)
|
||||
(if (null? l)
|
||||
""
|
||||
(interleave l spacer)))
|
||||
(define baseline (make-style #f '(baseline)))
|
||||
|
||||
(define (BNF-seq-lines . l)
|
||||
(make-table #f (map (lambda (row) (list (as-flow (apply BNF-seq row))))
|
||||
l)))
|
||||
(define (BNF . defns)
|
||||
(make-table
|
||||
(make-style #f
|
||||
(list
|
||||
(make-table-columns
|
||||
(list baseline baseline baseline baseline))))
|
||||
(apply
|
||||
append
|
||||
(map (match-lambda
|
||||
[(cons lhs (cons rhs0 more-rhs))
|
||||
(cons
|
||||
(list (as-flow spacer) (as-flow lhs) (as-flow equals) (as-flow rhs0))
|
||||
(map (lambda (i)
|
||||
(list (as-flow spacer) (as-flow " ") (as-flow alt) (as-flow i)))
|
||||
more-rhs))])
|
||||
defns))))
|
||||
|
||||
(define (BNF-alt . l)
|
||||
(interleave l alt))
|
||||
;; interleave : (listof content?) element? -> element?
|
||||
(define (interleave l spacer)
|
||||
(make-element #f (cons (car l)
|
||||
(apply append
|
||||
(map (lambda (i)
|
||||
(list spacer i))
|
||||
(cdr l))))))
|
||||
|
||||
(define (BNF-alt/close . l)
|
||||
(interleave l (make-element 'roman " | ")))
|
||||
(define (BNF-seq . l)
|
||||
(if (null? l)
|
||||
""
|
||||
(interleave l spacer)))
|
||||
|
||||
(define BNF-etc (make-element 'roman "..."))
|
||||
(define (BNF-seq-lines . l)
|
||||
(make-table #f (map (lambda (row) (list (as-flow (apply BNF-seq row))))
|
||||
l)))
|
||||
|
||||
(define/kw (nonterm #:body s)
|
||||
(make-element 'roman (append (list 'lang)
|
||||
(list (make-element 'italic (decode-content s)))
|
||||
(list 'rang))))
|
||||
(define (BNF-alt . l)
|
||||
(interleave l alt))
|
||||
|
||||
(define/kw (optional #:body s)
|
||||
(make-element #f (append (list (make-element 'roman "["))
|
||||
(decode-content s)
|
||||
(list (make-element 'roman "]")))))
|
||||
(define (BNF-alt/close . l)
|
||||
(interleave l (make-element 'roman " | ")))
|
||||
|
||||
(define/kw (BNF-group #:body s)
|
||||
(make-element #f (append (list (make-element 'roman "{"))
|
||||
(list (apply BNF-seq (decode-content s)))
|
||||
(list (make-element 'roman "}")))))
|
||||
(define BNF-etc (make-element 'roman "..."))
|
||||
|
||||
(define/kw (kleenestar #:body s)
|
||||
(make-element #f (append (decode-content s) (list (make-element 'roman "*")))))
|
||||
(define (nonterm . s)
|
||||
(make-element 'roman (append (list 'lang)
|
||||
(list (make-element 'italic (decode-content s)))
|
||||
(list 'rang))))
|
||||
|
||||
(define/kw (kleeneplus #:body s)
|
||||
(make-element #f (append (decode-content s) (list (make-element 'superscript (list "+"))))))
|
||||
(define (optional . s)
|
||||
(make-element #f (append (list (make-element 'roman "["))
|
||||
(decode-content s)
|
||||
(list (make-element 'roman "]")))))
|
||||
|
||||
(define/kw (kleenerange a b #:body s)
|
||||
(make-element #f (append (decode-content s)
|
||||
(list (make-element 'roman
|
||||
(make-element 'superscript
|
||||
(list (format "{~a,~a}" a b)))))))))
|
||||
(define (BNF-group . s)
|
||||
(make-element #f (append (list (make-element 'roman "{"))
|
||||
(list (apply BNF-seq (decode-content s)))
|
||||
(list (make-element 'roman "}")))))
|
||||
|
||||
(define (kleenestar . s)
|
||||
(make-element #f (append (decode-content s) (list (make-element 'roman "*")))))
|
||||
|
||||
(define (kleeneplus . s)
|
||||
(make-element #f (append (decode-content s) (list (make-element 'superscript (list "+"))))))
|
||||
|
||||
(define (kleenerange a b . s)
|
||||
(make-element #f (append (decode-content s)
|
||||
(list (make-element 'roman
|
||||
(make-element 'superscript
|
||||
(list (format "{~a,~a}" a b))))))))
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
\renewcommand{\Ssubsubsubsectiongrouperstar}[1]{\setcounter{GrouperTemp}{\value{subsubsection}}\Ssubsubsectionstar{#1}\setcounter{subsubsection}{\value{GrouperTemp}}}
|
||||
\renewcommand{\Ssubsubsubsubsectiongrouperstar}[1]{\Ssubsubsubsubsectionstar{#1}}
|
||||
|
||||
% To increments section numbers:
|
||||
% To increment section numbers:
|
||||
\renewcommand{\Sincpart}{\stepcounter{part}}
|
||||
\renewcommand{\Sincsection}{\stepcounter{chapter}}
|
||||
\renewcommand{\Sincsubsection}{\stepcounter{section}}
|
||||
|
|
|
@ -1,83 +1,84 @@
|
|||
(module comment-reader scheme/base
|
||||
(require (only-in racket/port peeking-input-port))
|
||||
#lang scheme/base
|
||||
|
||||
(provide (rename-out [*read read]
|
||||
[*read-syntax read-syntax])
|
||||
make-comment-readtable)
|
||||
(require (only-in racket/port peeking-input-port))
|
||||
|
||||
(define unsyntaxer (make-parameter 'unsyntax))
|
||||
(provide (rename-out [*read read]
|
||||
[*read-syntax read-syntax])
|
||||
make-comment-readtable)
|
||||
|
||||
(define (*read [inp (current-input-port)])
|
||||
(parameterize ([unsyntaxer (read-unsyntaxer inp)]
|
||||
[current-readtable (make-comment-readtable)])
|
||||
(read/recursive inp)))
|
||||
(define unsyntaxer (make-parameter 'unsyntax))
|
||||
|
||||
(define (*read-syntax src [port (current-input-port)])
|
||||
(parameterize ([unsyntaxer (read-unsyntaxer port)]
|
||||
[current-readtable (make-comment-readtable)])
|
||||
(read-syntax/recursive src port)))
|
||||
(define (*read [inp (current-input-port)])
|
||||
(parameterize ([unsyntaxer (read-unsyntaxer inp)]
|
||||
[current-readtable (make-comment-readtable)])
|
||||
(read/recursive inp)))
|
||||
|
||||
(define (*read-syntax src [port (current-input-port)])
|
||||
(parameterize ([unsyntaxer (read-unsyntaxer port)]
|
||||
[current-readtable (make-comment-readtable)])
|
||||
(read-syntax/recursive src port)))
|
||||
|
||||
(define (read-unsyntaxer port)
|
||||
(let ([p (peeking-input-port port)])
|
||||
(if (eq? (read p) '#:escape-id)
|
||||
(begin (read port) (read port))
|
||||
'unsyntax)))
|
||||
(define (read-unsyntaxer port)
|
||||
(let ([p (peeking-input-port port)])
|
||||
(if (eq? (read p) '#:escape-id)
|
||||
(begin (read port) (read port))
|
||||
'unsyntax)))
|
||||
|
||||
(define (make-comment-readtable #:readtable [rt (current-readtable)])
|
||||
(make-readtable rt
|
||||
#\; 'terminating-macro
|
||||
(case-lambda
|
||||
[(char port)
|
||||
(do-comment port (lambda () (read/recursive port #\@)))]
|
||||
[(char port src line col pos)
|
||||
(let ([v (do-comment port (lambda () (read-syntax/recursive src port #\@)))])
|
||||
(let-values ([(eline ecol epos) (port-next-location port)])
|
||||
(datum->syntax
|
||||
#f
|
||||
v
|
||||
(list src line col pos (and pos epos (- epos pos))))))])))
|
||||
(define (make-comment-readtable #:readtable [rt (current-readtable)])
|
||||
(make-readtable rt
|
||||
#\; 'terminating-macro
|
||||
(case-lambda
|
||||
[(char port)
|
||||
(do-comment port (lambda () (read/recursive port #\@)))]
|
||||
[(char port src line col pos)
|
||||
(let ([v (do-comment port (lambda () (read-syntax/recursive src port #\@)))])
|
||||
(let-values ([(eline ecol epos) (port-next-location port)])
|
||||
(datum->syntax
|
||||
#f
|
||||
v
|
||||
(list src line col pos (and pos epos (- epos pos))))))])))
|
||||
|
||||
(define (do-comment port recur)
|
||||
(let loop ()
|
||||
(when (equal? #\; (peek-char port))
|
||||
(read-char port)
|
||||
(loop)))
|
||||
(when (equal? #\space (peek-char port))
|
||||
(read-char port))
|
||||
`(code:comment
|
||||
(,(unsyntaxer)
|
||||
(t
|
||||
,@(append-strings
|
||||
(let loop ()
|
||||
(let ([c (read-char port)])
|
||||
(cond
|
||||
[(or (eof-object? c)
|
||||
(char=? c #\newline))
|
||||
null]
|
||||
[(char=? c #\@)
|
||||
(cons (recur) (loop))]
|
||||
[else
|
||||
(cons (string c)
|
||||
(loop))]))))))))
|
||||
(define (do-comment port recur)
|
||||
(let loop ()
|
||||
(when (equal? #\; (peek-char port))
|
||||
(read-char port)
|
||||
(loop)))
|
||||
(when (equal? #\space (peek-char port))
|
||||
(read-char port))
|
||||
`(code:comment
|
||||
(,(unsyntaxer)
|
||||
(t
|
||||
,@(append-strings
|
||||
(let loop ()
|
||||
(let ([c (read-char port)])
|
||||
(cond
|
||||
[(or (eof-object? c)
|
||||
(char=? c #\newline))
|
||||
null]
|
||||
[(char=? c #\@)
|
||||
(cons (recur) (loop))]
|
||||
[else
|
||||
(cons (string c)
|
||||
(loop))]))))))))
|
||||
|
||||
(define (append-strings l)
|
||||
(let loop ([l l][s null])
|
||||
(cond
|
||||
[(null? l) (if (null? s)
|
||||
null
|
||||
(preserve-space (apply string-append (reverse s))))]
|
||||
[(string? (car l))
|
||||
(loop (cdr l) (cons (car l) s))]
|
||||
[else
|
||||
(append (loop null s)
|
||||
(cons
|
||||
(car l)
|
||||
(loop (cdr l) null)))])))
|
||||
(define (append-strings l)
|
||||
(let loop ([l l][s null])
|
||||
(cond
|
||||
[(null? l) (if (null? s)
|
||||
null
|
||||
(preserve-space (apply string-append (reverse s))))]
|
||||
[(string? (car l))
|
||||
(loop (cdr l) (cons (car l) s))]
|
||||
[else
|
||||
(append (loop null s)
|
||||
(cons
|
||||
(car l)
|
||||
(loop (cdr l) null)))])))
|
||||
|
||||
(define (preserve-space s)
|
||||
(let ([m (regexp-match-positions #rx" +" s)])
|
||||
(if m
|
||||
(append (preserve-space (substring s 0 (caar m)))
|
||||
(list `(hspace ,(- (cdar m) (caar m))))
|
||||
(preserve-space (substring s (cdar m))))
|
||||
(list s)))))
|
||||
(define (preserve-space s)
|
||||
(let ([m (regexp-match-positions #rx" +" s)])
|
||||
(if m
|
||||
(append (preserve-space (substring s 0 (caar m)))
|
||||
(list `(hspace ,(- (cdar m) (caar m))))
|
||||
(preserve-space (substring s (cdar m))))
|
||||
(list s))))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#lang mzscheme
|
||||
|
||||
(module config mzscheme
|
||||
(provide value-color)
|
||||
|
||||
(provide value-color)
|
||||
|
||||
(define value-color "schemevalue"))
|
||||
(define value-color "schemevalue")
|
||||
|
|
|
@ -162,6 +162,36 @@
|
|||
|
||||
;; ----------------------------------------
|
||||
|
||||
(define-struct link-render-style (mode)
|
||||
#:constructor-name link-render-style
|
||||
#:property
|
||||
prop:serializable
|
||||
(make-serialize-info
|
||||
(lambda (s)
|
||||
(vector (link-render-style-mode s)))
|
||||
#'deserialize-link-render-style
|
||||
#f
|
||||
(or (current-load-relative-directory) (current-directory))))
|
||||
|
||||
(provide deserialize-link-render-style)
|
||||
(define deserialize-link-render-style
|
||||
(make-deserialize-info (lambda (s)
|
||||
(link-render-style s))
|
||||
(lambda (tag init-val)
|
||||
(error "cannot allocate link-render-style for cycle"))))
|
||||
|
||||
(define current-link-render-style (make-parameter (link-render-style 'default)))
|
||||
|
||||
(provide
|
||||
link-render-style?
|
||||
link-render-style-mode
|
||||
(contract-out
|
||||
[link-render-style ((or/c 'default 'number)
|
||||
. -> . link-render-style?)]
|
||||
[current-link-render-style (parameter/c link-render-style?)]))
|
||||
|
||||
;; ----------------------------------------
|
||||
|
||||
(define-struct numberer (tag step-proc initial-value)
|
||||
#:constructor-name numberer
|
||||
#:property
|
||||
|
@ -640,6 +670,7 @@
|
|||
[(rarr) "->"]
|
||||
[(lang) "<"]
|
||||
[(rang) ">"]
|
||||
[(nbsp) "\xA0"]
|
||||
[else (format "~s" c)])
|
||||
op)])]
|
||||
[(op c renderer sec ri)
|
||||
|
|
|
@ -166,8 +166,9 @@
|
|||
#f))
|
||||
keys k-tags)
|
||||
colls)])
|
||||
(if (and title
|
||||
(not (memq 'hidden (style-properties style))))
|
||||
(if (and title
|
||||
(not (memq 'hidden (style-properties style)))
|
||||
(not (memq 'no-index (style-properties style))))
|
||||
(cons (make-index-element
|
||||
#f null (car tags)
|
||||
(list (clean-up-index-string
|
||||
|
@ -258,9 +259,6 @@
|
|||
[(list? (car l))
|
||||
(loop (append (car l) (cdr l))
|
||||
next? keys colls accum title tag-prefix tags vers style)]
|
||||
[(null? (cdr l))
|
||||
(loop null #f keys colls (cons (car l) accum) title tag-prefix tags
|
||||
vers style)]
|
||||
[(part-index-decl? (car l))
|
||||
(loop (cdr l) next? (cons (car l) keys) colls accum title tag-prefix
|
||||
tags vers style)]
|
||||
|
@ -272,6 +270,9 @@
|
|||
(loop (cdr l) next? keys colls accum title tag-prefix
|
||||
(append tags (list (part-tag-decl-tag (car l))))
|
||||
vers style)]
|
||||
[(null? (cdr l))
|
||||
(loop null #f keys colls (cons (car l) accum) title tag-prefix tags
|
||||
vers style)]
|
||||
[(and (pair? (cdr l))
|
||||
(or (splice? (cadr l))
|
||||
(list? (cadr l))))
|
||||
|
|
|
@ -181,7 +181,7 @@ in the command itself, which can lead to things like:
|
|||
|
||||
** The Datum Part
|
||||
|
||||
The datum part can contains arbitrary Scheme expressions, which are
|
||||
The datum part can contain arbitrary Scheme expressions, which are
|
||||
simply stacked before the body text arguments:
|
||||
|
||||
@foo[1 (* 2 3)]{bar} --reads-as--> (foo 1 (* 2 3) "bar")
|
||||
|
|
2
scribble-lib/scribble/elsarticle/.gitignore
vendored
Normal file
2
scribble-lib/scribble/elsarticle/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# to avoid committing it by accident, since we can't distribute it
|
||||
/elsarticle.cls
|
5
scribble-lib/scribble/elsarticle/elsarticle.tex
Normal file
5
scribble-lib/scribble/elsarticle/elsarticle.tex
Normal file
|
@ -0,0 +1,5 @@
|
|||
\newcommand{\ELSauthor}[1]{\author{#1}}
|
||||
\newcommand{\ELSaddress}[1]{\address{#1}}
|
||||
\newcommand{\ELSemail}[1]{\ead{#1}}
|
||||
|
||||
\newcommand{\ELSabstract}[1]{\begin{abstract}#1\end{abstract}}
|
68
scribble-lib/scribble/elsarticle/lang.rkt
Normal file
68
scribble-lib/scribble/elsarticle/lang.rkt
Normal file
|
@ -0,0 +1,68 @@
|
|||
#lang racket/base
|
||||
(require scribble/doclang
|
||||
scribble/core
|
||||
racket/file
|
||||
(except-in scribble/base author)
|
||||
(prefix-in s/b: scribble/base)
|
||||
scribble/decode
|
||||
"../private/defaults.rkt"
|
||||
setup/collects
|
||||
scribble/html-properties
|
||||
scribble/latex-properties
|
||||
scribble/latex-prefix
|
||||
racket/stxparam
|
||||
net/ftp
|
||||
file/gunzip
|
||||
(for-syntax racket/base
|
||||
racket/list
|
||||
racket/stxparam-exptime))
|
||||
|
||||
(module test racket/base)
|
||||
|
||||
(provide (except-out (all-from-out scribble/doclang) #%module-begin)
|
||||
(all-from-out scribble/base)
|
||||
(rename-out [module-begin #%module-begin])
|
||||
frontmatter
|
||||
abstract author email address)
|
||||
|
||||
(define-syntax (module-begin stx)
|
||||
;; No options, currently, but keep in case we want to support some:
|
||||
(syntax-case* stx () (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
|
||||
[(_ id ws . body)
|
||||
;; Skip intraline whitespace to find options:
|
||||
(and (string? (syntax-e #'ws))
|
||||
(regexp-match? #rx"^ *$" (syntax-e #'ws)))
|
||||
#'(module-begin id . body)]
|
||||
[(_ id . body)
|
||||
#'(#%module-begin id (post-process) () . body)]))
|
||||
|
||||
(define ((post-process) doc)
|
||||
(add-defaults doc
|
||||
(string->bytes/utf-8 (string-append "\\documentclass{elsarticle}\n"
|
||||
unicode-encoding-packages))
|
||||
(scribble-file "elsarticle/style.tex")
|
||||
'()
|
||||
#f))
|
||||
|
||||
(define elsarticle-extras
|
||||
(let ([abs (lambda (s)
|
||||
(path->collects-relative
|
||||
(collection-file-path s "scribble" "elsarticle")))])
|
||||
(list
|
||||
(make-tex-addition (abs "elsarticle.tex")))))
|
||||
|
||||
(define (LaTeX-element i)
|
||||
(λ strs
|
||||
(make-element (style i elsarticle-extras)
|
||||
;; XXX maybe decode-content
|
||||
(decode-content strs))))
|
||||
|
||||
(define abstract (LaTeX-element "ELSabstract"))
|
||||
(define author (LaTeX-element "ELSauthor"))
|
||||
(define address (LaTeX-element "ELSaddress"))
|
||||
(define email (LaTeX-element "ELSemail"))
|
||||
|
||||
(define (frontmatter #:authors as
|
||||
#:abstract a)
|
||||
(paragraph (style 'author '())
|
||||
(append as (list a))))
|
3
scribble-lib/scribble/elsarticle/lang/reader.rkt
Normal file
3
scribble-lib/scribble/elsarticle/lang/reader.rkt
Normal file
|
@ -0,0 +1,3 @@
|
|||
#lang s-exp scribble/base/reader
|
||||
scribble/elsarticle/lang
|
||||
#:wrapper1 (lambda (t) (cons 'doc (t)))
|
3
scribble-lib/scribble/elsarticle/style.tex
Normal file
3
scribble-lib/scribble/elsarticle/style.tex
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
\renewcommand{\titleAndVersionAndAuthors}[3]{\begin{frontmatter}\title{#1}#3\end{frontmatter}}
|
||||
\renewcommand{\titleAndEmptyVersionAndAuthors}[3]{\titleAndVersionAndAuthors{#1}{#1}{#3}}
|
|
@ -33,18 +33,30 @@
|
|||
defexamples*
|
||||
as-examples
|
||||
|
||||
make-base-eval
|
||||
make-base-eval-factory
|
||||
make-eval-factory
|
||||
close-eval
|
||||
(contract-out
|
||||
[make-base-eval
|
||||
(->* [] [#:pretty-print? any/c #:lang lang-option/c] #:rest any/c any)]
|
||||
[make-base-eval-factory
|
||||
eval-factory/c]
|
||||
[make-eval-factory
|
||||
eval-factory/c]
|
||||
[close-eval
|
||||
(-> any/c any)]
|
||||
|
||||
[scribble-exn->string
|
||||
(parameter/c (-> any/c string?))]
|
||||
[scribble-eval-handler
|
||||
(parameter/c (-> (-> any/c any) boolean? any/c any))]
|
||||
[make-log-based-eval
|
||||
(-> path-string? (or/c 'record 'replay) any)])
|
||||
|
||||
scribble-exn->string
|
||||
scribble-eval-handler
|
||||
with-eval-preserve-source-locations)
|
||||
|
||||
(provide/contract
|
||||
[make-log-based-eval
|
||||
(-> path-string? (or/c 'record 'replay) (-> any/c any))])
|
||||
(define lang-option/c
|
||||
(or/c module-path? (list/c 'special symbol?) (cons/c 'begin list?)))
|
||||
|
||||
(define eval-factory/c
|
||||
(->* [(listof module-path?)] [#:pretty-print? any/c #:lang lang-option/c] any))
|
||||
|
||||
(define scribble-eval-handler
|
||||
(make-parameter (lambda (ev c? x) (ev x))))
|
||||
|
@ -99,13 +111,15 @@
|
|||
[(eof-object? v)
|
||||
(let* ([line-accum (add-string string-accum line-accum)]
|
||||
[flow-accum (add-line line-accum flow-accum)])
|
||||
(list
|
||||
(list.flow.list
|
||||
(if (= 1 (length flow-accum))
|
||||
(car flow-accum)
|
||||
(make-table
|
||||
#f
|
||||
(map list.flow.list (reverse flow-accum)))))))]
|
||||
(if (null? flow-accum)
|
||||
null
|
||||
(list
|
||||
(list.flow.list
|
||||
(if (= 1 (length flow-accum))
|
||||
(car flow-accum)
|
||||
(make-table
|
||||
#f
|
||||
(map list.flow.list (reverse flow-accum))))))))]
|
||||
[(equal? #\newline v)
|
||||
(loop #f #f (add-line (add-string string-accum line-accum)
|
||||
flow-accum))]
|
||||
|
@ -311,8 +325,25 @@
|
|||
(when expect
|
||||
(let ([expect (do-plain-eval ev (car expect) #t)])
|
||||
(unless (equal? val expect)
|
||||
(error 'eval "example result check failed: ~.s" s))))
|
||||
(define result " result: ")
|
||||
(define expected " expected: ")
|
||||
(error 'eval "example result check failed: ~.s\n~a\n~a\n"
|
||||
s
|
||||
(string-append result (to-lines val (string-length result)))
|
||||
(string-append expected (to-lines expect (string-length expected)))))))
|
||||
render+output)
|
||||
|
||||
(define (to-lines exps blank-space)
|
||||
(define blank (make-string blank-space #\space))
|
||||
(apply
|
||||
string-append
|
||||
(for/list ([exp (in-list exps)]
|
||||
[i (in-naturals)])
|
||||
(define first-line? (= i 0))
|
||||
(if (= i 0)
|
||||
(format "~e" exp)
|
||||
(format "\n~a~e" blank exp)))))
|
||||
|
||||
(lambda (str)
|
||||
(if (eval-results? str)
|
||||
(list #f
|
||||
|
@ -718,7 +749,7 @@
|
|||
(define-syntax racketblock*
|
||||
(syntax-rules (eval:alts code:comment eval:check eval:no-prompt eval:error eval:result eval:results)
|
||||
[(_ #:escape id (code:comment . rest)) (racketblock0 #:escape id (code:comment . rest))]
|
||||
[(_ #:escape id (eval:alts a b)) (racketblock #:escape id a)]
|
||||
[(_ #:escape id (eval:alts a b)) (racketblock* #:escape id a)]
|
||||
[(_ #:escape id (eval:result a . _)) (racketinputblock #:escape id a)]
|
||||
[(_ #:escape id (eval:results a . _)) (racketinputblock #:escape id a)]
|
||||
[(_ #:escape id (eval:check a b)) (racketblock #:escape id a)]
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
(provide examples
|
||||
|
||||
;; Re-exports:
|
||||
|
||||
make-base-eval
|
||||
make-base-eval-factory
|
||||
make-eval-factory
|
||||
close-eval
|
||||
|
||||
make-log-based-eval
|
||||
scribble-exn->string
|
||||
scribble-eval-handler
|
||||
make-log-based-eval)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
[body-id ([value string?])]
|
||||
[document-source ([module-path module-path?])]
|
||||
|
||||
[xexpr-property ([before xexpr/c] [after xexpr/c])]
|
||||
[hover-property ([text string?])]
|
||||
[script-property ([type string?]
|
||||
[script (or/c path-string? (listof string?))])]
|
||||
|
@ -29,4 +30,5 @@
|
|||
[link-resource ([path path-string?])]
|
||||
|
||||
[head-extra ([xexpr xexpr/c])]
|
||||
[render-convertible-as ([types (listof (or/c 'png-bytes 'svg-bytes))])])
|
||||
[head-addition ([xexpr xexpr/c])]
|
||||
[render-convertible-as ([types (listof (or/c 'png-bytes 'svg-bytes 'gif-bytes))])])
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
(provide render-mixin
|
||||
render-multi-mixin)
|
||||
|
||||
(define (number->decimal-string s)
|
||||
(number->string (if (integer? s) s (exact->inexact s))))
|
||||
|
||||
(define as-literal
|
||||
(let ([loc (xml:make-location 0 0 0)])
|
||||
(lambda strings (xml:make-cdata loc loc (string-append* strings)))))
|
||||
|
@ -107,7 +110,7 @@
|
|||
(define extra-breaking? (make-parameter #f))
|
||||
(define current-version (make-parameter (version)))
|
||||
(define current-part-files (make-parameter #f))
|
||||
(define current-render-convertible-requests (make-parameter '(png@2x-bytes png-bytes svg-bytes)))
|
||||
(define current-render-convertible-requests (make-parameter '(png@2x-bytes png-bytes svg-bytes gif-bytes)))
|
||||
|
||||
(define (url->string* u)
|
||||
(parameterize ([current-url-encode-mode 'unreserved])
|
||||
|
@ -218,25 +221,17 @@
|
|||
(string->symbol (alt-tag-name s)))))
|
||||
|
||||
(define (make-search-box top-path) ; appears on every page
|
||||
(let ([sa string-append]
|
||||
[emptylabel "...search manuals..."]
|
||||
[dimcolor "#888"])
|
||||
(let ([emptylabel "...search manuals..."])
|
||||
`(form ([class "searchform"])
|
||||
(input
|
||||
([class "searchbox"]
|
||||
[style ,(sa "color: "dimcolor";")]
|
||||
[id "searchbox"]
|
||||
[type "text"]
|
||||
[value ,emptylabel]
|
||||
[tabindex "1"]
|
||||
[placeholder ,emptylabel]
|
||||
[title "Enter a search string to search the manuals"]
|
||||
[onkeypress ,(format "return DoSearchKey(event, this, ~s, ~s);"
|
||||
(version) top-path)]
|
||||
[onfocus ,(sa "this.style.color=\"black\"; "
|
||||
"this.style.textAlign=\"left\"; "
|
||||
"if (this.value == \""emptylabel"\") this.value=\"\";")]
|
||||
[onblur ,(sa "if (this.value.match(/^ *$/)) {"
|
||||
" this.style.color=\""dimcolor"\";"
|
||||
" this.style.textAlign=\"center\";"
|
||||
" this.value=\""emptylabel"\"; }")])))))
|
||||
(version) top-path)])))))
|
||||
(define search-box (make-search-box "../"))
|
||||
(define top-search-box (make-search-box ""))
|
||||
|
||||
|
@ -277,7 +272,8 @@
|
|||
extract-part-style-files
|
||||
extract-version
|
||||
extract-authors
|
||||
extract-pretitle)
|
||||
extract-pretitle
|
||||
link-render-style-at-element)
|
||||
(inherit-field prefix-file style-file style-extra-files image-preferences)
|
||||
|
||||
(init-field [alt-paths null]
|
||||
|
@ -373,7 +369,7 @@
|
|||
(collect-put! ci key
|
||||
(let ([v (vector (or (part-title-content d) '("???"))
|
||||
(add-current-tag-prefix key)
|
||||
number ; for consistency with base
|
||||
number
|
||||
(and (current-output-file)
|
||||
(path->relative (current-output-file)))
|
||||
(current-part-whole-page? d))])
|
||||
|
@ -407,6 +403,8 @@
|
|||
(vector-ref dest 3))
|
||||
(define (dest-title dest)
|
||||
(vector-ref dest 0))
|
||||
(define (dest-number dest)
|
||||
(vector-ref dest 2))
|
||||
(define (dest-page? dest)
|
||||
(vector-ref dest 4))
|
||||
(define (dest-anchor dest)
|
||||
|
@ -731,24 +729,25 @@
|
|||
(if (or (nearly-top? d)
|
||||
(part-style? d 'toc-hidden))
|
||||
null
|
||||
(list (cons d prefixes)))
|
||||
(list (vector d prefixes d)))
|
||||
;; get internal targets:
|
||||
(map (lambda (v) (cons v prefixes)) (append-map block-targets (part-blocks d)))
|
||||
(map (lambda (v) (vector v prefixes d)) (append-map block-targets (part-blocks d)))
|
||||
(map (lambda (p) (if (or (part-whole-page? p ri)
|
||||
(and (part-style? p 'toc-hidden)
|
||||
(all-toc-hidden? p)))
|
||||
null
|
||||
(flatten p prefixes #f)))
|
||||
(part-parts d)))))))
|
||||
(define any-parts? (ormap (compose part? car) ps))
|
||||
(define any-parts? (ormap (compose part? (lambda (p) (vector-ref p 0))) ps))
|
||||
(if (null? ps)
|
||||
null
|
||||
`((div ([class ,box-class])
|
||||
,@(get-onthispage-label)
|
||||
(table ([class "tocsublist"] [cellspacing "0"])
|
||||
,@(map (lambda (p)
|
||||
(let ([p (car p)]
|
||||
[prefixes (cdr p)]
|
||||
(let ([p (vector-ref p 0)]
|
||||
[prefixes (vector-ref p 1)]
|
||||
[from-d (vector-ref p 2)]
|
||||
[add-tag-prefixes
|
||||
(lambda (t prefixes)
|
||||
(if (null? prefixes)
|
||||
|
@ -765,7 +764,7 @@
|
|||
'(""))
|
||||
,@(if (toc-element? p)
|
||||
(render-content (toc-element-toc-content p)
|
||||
d ri)
|
||||
from-d ri)
|
||||
(parameterize ([current-no-links #t]
|
||||
[extra-breaking? #t])
|
||||
`((a ([href
|
||||
|
@ -793,7 +792,7 @@
|
|||
(if (toc-target2-element? p)
|
||||
(toc-target2-element-toc-content p)
|
||||
(element-content p)))
|
||||
d ri)))))))))
|
||||
from-d ri)))))))))
|
||||
ps)))))))
|
||||
|
||||
(define/private (extract-inherited d ri pred extract)
|
||||
|
@ -866,6 +865,8 @@
|
|||
(head ()
|
||||
(meta ([http-equiv "content-type"]
|
||||
[content "text/html; charset=utf-8"]))
|
||||
(meta ([name "viewport"]
|
||||
[content "width=device-width, initial-scale=0.8"]))
|
||||
,title
|
||||
,(scribble-css-contents scribble-css
|
||||
(lookup-path scribble-css alt-paths)
|
||||
|
@ -894,12 +895,15 @@
|
|||
(extract js-style-addition? js-style-addition-path)
|
||||
(reverse extra-script-files)))
|
||||
,(xml:comment "[if IE 6]><style type=\"text/css\">.SIEHidden { overflow: hidden; }</style><![endif]")
|
||||
,@(extract head-addition? head-addition-xexpr)
|
||||
,@(for/list ([p (style-properties (part-style d))]
|
||||
#:when (head-extra? p))
|
||||
(head-extra-xexpr p)))
|
||||
(body ([id ,(or (extract-part-body-id d ri)
|
||||
"scribble-racket-lang-org")])
|
||||
,@(render-toc-view d ri)
|
||||
,@(if (part-style? d 'no-toc+aux)
|
||||
null
|
||||
(render-toc-view d ri))
|
||||
(div ([class "maincolumn"])
|
||||
(div ([class "main"])
|
||||
,@(parameterize ([current-version (extract-version d)])
|
||||
|
@ -1225,6 +1229,14 @@
|
|||
(element-style->attribs (style-name s) s extras)
|
||||
(element-style->attribs s #f extras))))
|
||||
|
||||
(define (element-style-property-matching e pred)
|
||||
(and (or (element? e) (multiarg-element? e))
|
||||
(ormap (lambda (v) (and (pred v) v))
|
||||
(let ([s (if (element? e)
|
||||
(element-style e)
|
||||
(multiarg-element-style e))])
|
||||
(if (style? s) (style-properties s) null)))))
|
||||
|
||||
(define/override (render-content e part ri)
|
||||
(define (attribs [extras null]) (content-attribs e extras))
|
||||
(cond
|
||||
|
@ -1303,24 +1315,13 @@
|
|||
(if (path? p)
|
||||
(url->string* (path->url (path->complete-path p)))
|
||||
p))])
|
||||
`((,(if svg? 'object 'img)
|
||||
([,(if svg? 'data 'src) ,srcref]
|
||||
`((img
|
||||
([src ,srcref]
|
||||
[alt ,(content->string (element-content e))]
|
||||
,@(if svg?
|
||||
`([type "image/svg+xml"])
|
||||
null)
|
||||
,@sz
|
||||
,@(attribs))
|
||||
,@(if svg?
|
||||
`((param ([name "src"] [value ,srcref])))
|
||||
null)))))]
|
||||
[(and (or (element? e) (multiarg-element? e))
|
||||
(ormap (lambda (v) (and (script-property? v) v))
|
||||
(let ([s (if (element? e)
|
||||
(element-style e)
|
||||
(multiarg-element-style e))])
|
||||
(if (style? s) (style-properties s) null))))
|
||||
=>
|
||||
,@(attribs))))))]
|
||||
[(element-style-property-matching e script-property?)
|
||||
=>
|
||||
(lambda (v)
|
||||
(let* ([t `[type ,(script-property-type v)]]
|
||||
[s (script-property-script v)]
|
||||
|
@ -1329,6 +1330,12 @@
|
|||
`(script (,t ,@(attribs) [src ,s])))])
|
||||
(list s
|
||||
`(noscript ,@(render-plain-content e part ri)))))]
|
||||
[(element-style-property-matching e xexpr-property?)
|
||||
=>
|
||||
(lambda (v)
|
||||
(cons (xexpr-property-before v)
|
||||
(append (render-plain-content e part ri)
|
||||
(list (xexpr-property-after v)))))]
|
||||
[(target-element? e)
|
||||
`((a ([name ,(format "~a" (anchor-name (add-current-tag-prefix
|
||||
(tag-key (target-element-tag e)
|
||||
|
@ -1338,13 +1345,31 @@
|
|||
[(and (link-element? e) (not (current-no-links)))
|
||||
(parameterize ([current-no-links #t])
|
||||
(define indirect-link? (link-element-indirect? e))
|
||||
(let-values ([(dest ext-id)
|
||||
(if (and indirect-link?
|
||||
external-tag-path)
|
||||
(values #f #f)
|
||||
(resolve-get/ext-id part ri (link-element-tag e)))])
|
||||
(let*-values ([(dest ext-id)
|
||||
(if (and indirect-link?
|
||||
external-tag-path)
|
||||
(values #f #f)
|
||||
(resolve-get/ext-id part ri (link-element-tag e)))]
|
||||
[(number-link?)
|
||||
(and dest
|
||||
(not ext-id)
|
||||
(let ([n (dest-number dest)])
|
||||
;; If the section number is empty, don't generate an
|
||||
;; empty link:
|
||||
(not (or (not n)
|
||||
(string=? "" (apply string-append (format-number n '("")))))))
|
||||
(eq? 'number (link-render-style-at-element e))
|
||||
(empty-content? (element-content e)))])
|
||||
|
||||
(if (or indirect-link? dest)
|
||||
`((a ([href
|
||||
`(,@(cond
|
||||
[number-link?
|
||||
`(,(if (let ([s (element-style e)])
|
||||
(and (style? s) (memq 'uppercase (style-properties s))))
|
||||
"Section "
|
||||
"section "))]
|
||||
[else '()])
|
||||
(a ([href
|
||||
,(cond
|
||||
[(and ext-id external-root-url dest
|
||||
(let* ([ref-path (relative->path (dest-path dest))]
|
||||
|
@ -1398,7 +1423,10 @@
|
|||
null))
|
||||
[data-pltdoc "x"])
|
||||
,@(if (empty-content? (element-content e))
|
||||
(render-content (strip-aux (dest-title dest)) part ri)
|
||||
(cond
|
||||
[number-link? (format-number (dest-number dest) '(""))]
|
||||
[else
|
||||
(render-content (strip-aux (dest-title dest)) part ri)])
|
||||
(render-content (element-content e) part ri))))
|
||||
(begin
|
||||
(when #f
|
||||
|
@ -1437,12 +1465,7 @@
|
|||
(if (and (not (list? cvt))
|
||||
(equal? request 'png@2x-bytes))
|
||||
(/ v 2.0)
|
||||
v))]
|
||||
[number->decimal-string (lambda (s)
|
||||
(number->string
|
||||
(if (integer? s)
|
||||
s
|
||||
(exact->inexact s))))])
|
||||
v))])
|
||||
(list
|
||||
(add-padding
|
||||
cvt
|
||||
|
@ -1460,9 +1483,26 @@
|
|||
(list
|
||||
(add-padding
|
||||
cvt
|
||||
`(object
|
||||
([data ,(install-file "pict.svg" bstr)]
|
||||
`(img
|
||||
([src ,(install-file "pict.svg" bstr)]
|
||||
[type "image/svg+xml"]))))))]
|
||||
[(and (equal? request 'gif-bytes) (convert e 'gif-bytes))
|
||||
=>
|
||||
(lambda (gif-bytes)
|
||||
(define gif-src (install-file "pict.gif" gif-bytes))
|
||||
|
||||
;; GIFs store their width and height in the first 4 bytes of the logical screen
|
||||
;; descriptor, which comes after the 6-byte long header block. The width and height are
|
||||
;; each represented by 2-byte wide little-endian unsigned fields.
|
||||
(define width (+ (bytes-ref gif-bytes 6) (* (bytes-ref gif-bytes 7) 256)))
|
||||
(define height (+ (bytes-ref gif-bytes 8) (* (bytes-ref gif-bytes 9) 256)))
|
||||
|
||||
(define image-tag
|
||||
`(img ([src ,gif-src]
|
||||
[type "image/gif"]
|
||||
[width ,(number->decimal-string width)]
|
||||
[height ,(number->decimal-string height)])))
|
||||
(list image-tag))]
|
||||
[else #f])))
|
||||
|
||||
;; Add padding for a bounding-box conversion reply:
|
||||
|
@ -1577,6 +1617,7 @@
|
|||
(cond
|
||||
[(symbol? name)
|
||||
(case name
|
||||
[(emph) '([class "emph"])]
|
||||
[(italic) '([style "font-style: italic"])]
|
||||
[(bold) '([style "font-weight: bold"])]
|
||||
[(tt) '([class "stt"])]
|
||||
|
@ -1907,6 +1948,7 @@
|
|||
(define/override (start-collect ds fns ci)
|
||||
(parameterize ([current-part-files (make-hash)])
|
||||
(for-each (lambda (d fn)
|
||||
(check-duplicate-filename fn)
|
||||
(parameterize ([collecting-sub
|
||||
(if (part-style? d 'non-toc)
|
||||
1
|
||||
|
@ -2010,11 +2052,12 @@
|
|||
(loop (cdr path) (cdr root)))))))))
|
||||
|
||||
(define (from-root p d)
|
||||
(define c-p (path->complete-path p))
|
||||
(define c-p (simplify-path (path->complete-path p)))
|
||||
(define e-p (explode c-p))
|
||||
(define e-d (and d (explode (path->complete-path d))))
|
||||
(define e-d (and d (explode (simplify-path (path->complete-path d)))))
|
||||
(define p-in? (in-plt? e-p))
|
||||
(define d-in? (and d (in-plt? e-d)))
|
||||
(define (normalize p) (normal-case-path p))
|
||||
;; use an absolute link if the link is from outside the plt tree
|
||||
;; going in (or if d is #f)
|
||||
(if (not (and d (cond
|
||||
|
@ -2022,7 +2065,10 @@
|
|||
[d-in? (error 'from-root
|
||||
"got a link from the PLT tree going out; ~e"
|
||||
p)]
|
||||
[else #f])))
|
||||
[else #f])
|
||||
;; On Windows, need to be on the same drive, at least:
|
||||
(equal? (normalize (car e-d))
|
||||
(normalize (car e-p)))))
|
||||
(path->url-string c-p)
|
||||
(let loop ([e-d e-d] [e-p e-p])
|
||||
(cond
|
||||
|
@ -2030,11 +2076,11 @@
|
|||
(string-append*
|
||||
(let loop ([e-p e-p])
|
||||
(cond [(null? e-p) '("/")]
|
||||
[(null? (cdr e-p)) (list (path->string (car e-p)))]
|
||||
[(null? (cdr e-p)) (list (path-element->string (car e-p)))]
|
||||
[(eq? 'same (car e-p)) (loop (cdr e-p))]
|
||||
[(eq? 'up (car e-p)) (cons "../" (loop (cdr e-p)))]
|
||||
[else (cons (path->string (car e-p)) (cons "/" (loop (cdr e-p))))])))]
|
||||
[(equal? (car e-d) (car e-p)) (loop (cdr e-d) (cdr e-p))]
|
||||
[else (cons (path-element->string (car e-p)) (cons "/" (loop (cdr e-p))))])))]
|
||||
[(equal? (normalize (car e-d)) (normalize (car e-p))) (loop (cdr e-d) (cdr e-p))]
|
||||
[(eq? 'same (car e-d)) (loop (cdr e-d) e-p)]
|
||||
[(eq? 'same (car e-p)) (loop e-d (cdr e-p))]
|
||||
[else (string-append (string-append* (map (lambda (x) "../") e-d))
|
||||
|
|
|
@ -1 +1 @@
|
|||
\renewcommand{\packageRelsize}{}
|
||||
\renewcommand\Large{\@setfontsize\@xvpt{18}}
|
||||
|
|
|
@ -10,4 +10,7 @@
|
|||
[extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])]
|
||||
[(latex-defaults+replacements latex-defaults)
|
||||
([replacements (hash/c string? (or/c bytes? path-string? (cons/c 'collects (listof bytes?))))])]
|
||||
[command-extras ([arguments (listof string?)])])
|
||||
[command-extras ([arguments (listof string?)])]
|
||||
[command-optional ([arguments (listof string?)])]
|
||||
[short-title ([text (or/c string? #f)])]
|
||||
[table-row-skip ([amount string?])])
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
(require "core.rkt"
|
||||
"latex-properties.rkt"
|
||||
"private/render-utils.rkt"
|
||||
"private/latex-index.rkt"
|
||||
racket/class
|
||||
racket/runtime-path
|
||||
racket/port
|
||||
|
@ -11,15 +12,18 @@
|
|||
setup/collects
|
||||
file/convertible)
|
||||
(provide render-mixin
|
||||
make-render-part-mixin)
|
||||
make-render-part-mixin
|
||||
extra-character-conversions)
|
||||
|
||||
(define current-table-mode (make-parameter #f))
|
||||
(define rendering-tt (make-parameter #f))
|
||||
(define show-link-page-numbers (make-parameter #f))
|
||||
(define done-link-page-numbers (make-parameter #f))
|
||||
(define multiple-page-references (make-parameter #f))
|
||||
(define disable-images (make-parameter #f))
|
||||
(define escape-brackets (make-parameter #f))
|
||||
(define suppress-newline-content (make-parameter #f))
|
||||
(define disable-hyperref (make-parameter #f))
|
||||
|
||||
(define-struct (toc-paragraph paragraph) ())
|
||||
|
||||
|
@ -47,6 +51,8 @@
|
|||
(define-runtime-path skull-tex "scribble-skull.tex")
|
||||
(define skull-style (make-style #f (list (tex-addition skull-tex))))
|
||||
|
||||
(define extra-character-conversions (make-parameter (λ (c) #f)))
|
||||
|
||||
(define (render-mixin % #:image-mode [image-mode #f])
|
||||
(class %
|
||||
(super-new)
|
||||
|
@ -78,7 +84,14 @@
|
|||
extract-version
|
||||
extract-date
|
||||
extract-authors
|
||||
extract-pretitle)
|
||||
extract-pretitle-content
|
||||
link-render-style-at-element)
|
||||
|
||||
(define/public (extract-short-title d)
|
||||
(ormap (lambda (v)
|
||||
(and (short-title? v)
|
||||
(short-title-text v)))
|
||||
(style-properties (part-style d))))
|
||||
|
||||
(define/override (auto-extra-files? v) (latex-defaults? v))
|
||||
(define/override (auto-extra-files-paths v) (latex-defaults-extra-files v))
|
||||
|
@ -138,18 +151,26 @@
|
|||
(install-file style-file))))
|
||||
(when whole-doc?
|
||||
(printf "\\begin{document}\n\\preDoc\n")
|
||||
(when (part-title-content d)
|
||||
(when (and (part-title-content d)
|
||||
(not (and (part-style? d 'hidden)
|
||||
(equal? "" (content->string (part-title-content d))))))
|
||||
(let ([vers (extract-version d)]
|
||||
[date (extract-date d)]
|
||||
[pres (extract-pretitle d)]
|
||||
[auths (extract-authors d)])
|
||||
[pres (extract-pretitle-content d)]
|
||||
[auths (extract-authors d)]
|
||||
[short (extract-short-title d)])
|
||||
(for ([pre (in-list pres)])
|
||||
(printf "\n\n")
|
||||
(do-render-paragraph pre d ri #t #f))
|
||||
(cond
|
||||
[(paragraph? pre)
|
||||
(do-render-paragraph pre d ri #t #f)]
|
||||
[(nested-flow? pre)
|
||||
(do-render-nested-flow pre d ri #t #f #t)]))
|
||||
(when date (printf "\\date{~a}\n" date))
|
||||
(printf "\\titleAnd~aVersionAnd~aAuthors{"
|
||||
(printf "\\titleAnd~aVersionAnd~aAuthors~a{"
|
||||
(if (equal? vers "") "Empty" "")
|
||||
(if (null? auths) "Empty" ""))
|
||||
(if (null? auths) "Empty" "")
|
||||
(if short "AndShort" ""))
|
||||
(render-content (part-title-content d) d ri)
|
||||
(printf "}{~a}{" vers)
|
||||
(unless (null? auths)
|
||||
|
@ -158,7 +179,9 @@
|
|||
(unless first? (printf "\\SAuthorSep{}"))
|
||||
(do-render-paragraph auth d ri #t #f)
|
||||
#f)
|
||||
(printf "}\n"))))
|
||||
(if short
|
||||
(printf "}{~a}\n" short)
|
||||
(printf "}\n")))))
|
||||
(render-part d ri)
|
||||
(when whole-doc?
|
||||
(printf "\n\n\\postDoc\n\\end{document}\n"))))
|
||||
|
@ -174,7 +197,7 @@
|
|||
(and d (positive? d)))))
|
||||
(when (eq? (style-name (part-style d)) 'index)
|
||||
(printf "\\twocolumn\n\\parskip=0pt\n\\addcontentsline{toc}{section}{Index}\n"))
|
||||
(let ([pres (extract-pretitle d)])
|
||||
(let ([pres (extract-pretitle-content d)])
|
||||
(for ([pre (in-list pres)])
|
||||
(printf "\n\n")
|
||||
(do-render-paragraph pre d ri #t #f)))
|
||||
|
@ -225,12 +248,14 @@
|
|||
(printf "{")
|
||||
(show-number)
|
||||
(parameterize ([disable-images #t]
|
||||
[escape-brackets #t])
|
||||
[escape-brackets #t]
|
||||
[disable-hyperref #t])
|
||||
(render-content (part-title-content d) d ri))
|
||||
(printf "}"))
|
||||
(printf "{")
|
||||
(show-number)
|
||||
(render-content (part-title-content d) d ri)
|
||||
(parameterize ([disable-hyperref #t])
|
||||
(render-content (part-title-content d) d ri))
|
||||
(printf "}")
|
||||
(when (and (part-style? d 'hidden-number)
|
||||
(not (part-style? d 'unnumbered)))
|
||||
|
@ -326,13 +351,15 @@
|
|||
(format-number number null))]
|
||||
[lbl? (and dest
|
||||
(not ext?)
|
||||
(not (show-link-page-numbers)))])
|
||||
(not (show-link-page-numbers)))]
|
||||
[link-number? (and lbl?
|
||||
(eq? 'number (link-render-style-at-element e)))])
|
||||
(printf "\\~aRef~a~a~a{"
|
||||
(case (and dest (number-depth number))
|
||||
[(0) "Book"]
|
||||
[(1) (if (string? (car number)) "Part" "Chap")]
|
||||
[else "Sec"])
|
||||
(if lbl?
|
||||
(if (and lbl? (not link-number?))
|
||||
"Local"
|
||||
"")
|
||||
(if (let ([s (element-style e)])
|
||||
|
@ -342,9 +369,10 @@
|
|||
(if (null? formatted-number)
|
||||
"UN"
|
||||
""))
|
||||
(when lbl?
|
||||
(when (and lbl? (not link-number?))
|
||||
(printf "t:~a}{" (t-encode (vector-ref dest 1))))
|
||||
(unless (null? formatted-number)
|
||||
(when link-number? (printf "\\SectionNumberLink{t:~a}{" (t-encode (vector-ref dest 1))))
|
||||
(render-content
|
||||
(if dest
|
||||
(if (list? number)
|
||||
|
@ -355,6 +383,7 @@
|
|||
'("!!!")))
|
||||
(list "???"))
|
||||
part ri)
|
||||
(when link-number? (printf "}"))
|
||||
(printf "}{"))))
|
||||
(let* ([es (cond
|
||||
[(element? e) (element-style e)]
|
||||
|
@ -364,6 +393,11 @@
|
|||
(style-name es)
|
||||
es)]
|
||||
[style (and (style? es) es)]
|
||||
[hyperref? (and (not part-label?)
|
||||
(link-element? e)
|
||||
(not (disable-hyperref))
|
||||
(let-values ([(dest ext?) (resolve-get/ext? part ri (link-element-tag e))])
|
||||
(and dest (not ext?))))]
|
||||
[check-render
|
||||
(lambda ()
|
||||
(when (render-element? e)
|
||||
|
@ -438,6 +472,7 @@
|
|||
(cond
|
||||
[(symbol? style-name)
|
||||
(case style-name
|
||||
[(emph) (wrap e "emph" tt?)]
|
||||
[(italic) (wrap e "textit" tt?)]
|
||||
[(bold) (wrap e "textbf" tt?)]
|
||||
[(tt) (wrap e "Scribtexttt" #t)]
|
||||
|
@ -473,6 +508,11 @@
|
|||
[(multiarg-element? e)
|
||||
(check-render)
|
||||
(printf "\\~a" style-name)
|
||||
(define maybe-optional-args
|
||||
(findf command-optional? (if style (style-properties style) '())))
|
||||
(when maybe-optional-args
|
||||
(for ([i (in-list (command-optional-arguments maybe-optional-args))])
|
||||
(printf "[~a]" i)))
|
||||
(if (null? (multiarg-element-contents e))
|
||||
(printf "{}")
|
||||
(for ([i (in-list (multiarg-element-contents e))])
|
||||
|
@ -481,16 +521,31 @@
|
|||
(render-content i part ri))
|
||||
(printf "}")))]
|
||||
[else
|
||||
(wrap e style-name tt?)]))]
|
||||
(define maybe-optional
|
||||
(findf command-optional? (if style (style-properties style) '())))
|
||||
(if maybe-optional
|
||||
(wrap e
|
||||
(string-join #:before-first (format "~a[" style-name)
|
||||
#:after-last "]"
|
||||
(command-optional-arguments maybe-optional)
|
||||
"][")
|
||||
tt?)
|
||||
(wrap e style-name tt?))]))]
|
||||
[(and (not style-name)
|
||||
style
|
||||
(memq 'exact-chars (style-properties style)))
|
||||
(wrap e style-name 'exact)]
|
||||
[else
|
||||
(core-render e tt?)]))
|
||||
(when hyperref?
|
||||
(printf "\\hyperref[t:~a]{"
|
||||
(t-encode (link-element-tag e))))
|
||||
(let loop ([l (if style (style-properties style) null)] [tt? #f])
|
||||
(if (null? l)
|
||||
(finish tt?)
|
||||
(if hyperref?
|
||||
(parameterize ([disable-hyperref #t])
|
||||
(finish tt?))
|
||||
(finish tt?))
|
||||
(let ([v (car l)])
|
||||
(cond
|
||||
[(target-url? v)
|
||||
|
@ -528,16 +583,27 @@
|
|||
(loop (cdr l) tt?)
|
||||
(for ([l (in-list (command-extras-arguments (car l)))])
|
||||
(printf "{~a}" l))]
|
||||
[else (loop (cdr l) tt?)]))))))
|
||||
[else (loop (cdr l) tt?)]))))
|
||||
(when hyperref?
|
||||
(printf "}"))))
|
||||
(when part-label?
|
||||
(printf "}"))
|
||||
(when (and (link-element? e)
|
||||
(show-link-page-numbers)
|
||||
(not (done-link-page-numbers)))
|
||||
(printf ", \\pageref{t:~a}"
|
||||
(t-encode
|
||||
(let ([v (resolve-get part ri (link-element-tag e))])
|
||||
(and v (vector-ref v 1))))))
|
||||
(define (make-ref e)
|
||||
(string-append
|
||||
"t:"
|
||||
(t-encode
|
||||
(let ([v (resolve-get part ri (link-element-tag e))])
|
||||
(and v (vector-ref v 1))))))
|
||||
(cond
|
||||
[(multiple-page-references) ; for index
|
||||
=> (lambda (l)
|
||||
(printf ", \\Smanypageref{~a}" ; using cleveref
|
||||
(string-join (map make-ref l) ",")))]
|
||||
[else
|
||||
(printf ", \\pageref{~a}" (make-ref e))]))
|
||||
null))
|
||||
|
||||
(define/private (t-encode s)
|
||||
|
@ -573,6 +639,11 @@
|
|||
(let* ([s-name (style-name (table-style t))]
|
||||
[boxed? (eq? 'boxed s-name)]
|
||||
[index? (eq? 'index s-name)]
|
||||
[merge-index? (let loop ([part part])
|
||||
(or (memq 'enable-index-merge (style-properties (part-style part)))
|
||||
(let* ([ci (part-collected-info part ri)]
|
||||
[p (and ci (collected-info-parent ci))])
|
||||
(and p (loop p)))))]
|
||||
[tableform
|
||||
(cond [index? "list"]
|
||||
[(eq? 'block s-name) "tabular"]
|
||||
|
@ -618,6 +689,7 @@
|
|||
part
|
||||
ri
|
||||
#t
|
||||
#f
|
||||
#f)
|
||||
(when (string? s-name)
|
||||
(printf "\\end{~a}" s-name)))
|
||||
|
@ -704,6 +776,17 @@
|
|||
(let ([flows (car blockss)]
|
||||
[cell-styles (car cell-styless)])
|
||||
(unless index? (add-clines prev-styles cell-styles))
|
||||
(define group-size
|
||||
(cond
|
||||
[merge-index?
|
||||
;; Merge entries that have the same text & style
|
||||
(let loop ([blockss (cdr blockss)] [group-size 1])
|
||||
(cond
|
||||
[(null? blockss) group-size]
|
||||
[(same-index-entry? flows (car blockss))
|
||||
(loop (cdr blockss) (add1 group-size))]
|
||||
[else group-size]))]
|
||||
[else 1]))
|
||||
(let loop ([flows flows]
|
||||
[cell-styles cell-styles]
|
||||
[all-left-line?s all-left-line?s]
|
||||
|
@ -715,7 +798,10 @@
|
|||
(cond
|
||||
[index?
|
||||
(printf "\n\\item ")
|
||||
(render-cell 1)
|
||||
(parameterize ([multiple-page-references
|
||||
(and (group-size . > . 1)
|
||||
(extract-index-link-targets (take blockss group-size)))])
|
||||
(render-cell 1))
|
||||
#f]
|
||||
[(eq? 'cont (car flows))
|
||||
#f]
|
||||
|
@ -744,17 +830,23 @@
|
|||
(cdr cell-styles)
|
||||
(cdr all-left-line?s)
|
||||
right-line?))))
|
||||
(define rest-blockss (list-tail blockss group-size))
|
||||
(unless (or index?
|
||||
(and (null? (cdr blockss))
|
||||
(and (null? rest-blockss)
|
||||
(not (for/or ([cell-style (in-list cell-styles)])
|
||||
(or (memq 'bottom-border (style-properties cell-style))
|
||||
(memq 'border (style-properties cell-style)))))))
|
||||
(printf " \\\\\n"))
|
||||
(let ([row-skip (for/or ([cell-style (in-list cell-styles)])
|
||||
(for/or ([prop (style-properties cell-style)])
|
||||
(and (table-row-skip? prop) prop)))])
|
||||
(printf " \\\\~a\n" (if row-skip
|
||||
(format "[~a]" (table-row-skip-amount row-skip))
|
||||
""))))
|
||||
(cond
|
||||
[(null? (cdr blockss))
|
||||
[(null? rest-blockss)
|
||||
(unless index? (add-clines cell-styles #f))]
|
||||
[else
|
||||
(loop (cdr blockss) (cdr cell-styless) cell-styles)])))
|
||||
(loop rest-blockss (list-tail cell-styless group-size) cell-styles)])))
|
||||
(unless inline?
|
||||
(printf "\\end{~a}~a"
|
||||
tableform
|
||||
|
@ -821,7 +913,7 @@
|
|||
[(table? p)
|
||||
(render-table* p part ri #f (format "[~a]" mode))]
|
||||
[(nested-flow? p)
|
||||
(do-render-nested-flow p part ri #f mode)]
|
||||
(do-render-nested-flow p part ri #f mode #f)]
|
||||
[(paragraph? p)
|
||||
(do-render-paragraph p part ri #f mode)]))
|
||||
|
||||
|
@ -852,7 +944,7 @@
|
|||
(printf "\\end{~a}" mode)
|
||||
null))
|
||||
|
||||
(define/private (do-render-nested-flow t part ri single-column? as-box-mode)
|
||||
(define/private (do-render-nested-flow t part ri single-column? as-box-mode show-pre?)
|
||||
(let* ([props (style-properties (nested-flow-style t))]
|
||||
[kind (or (and as-box-mode
|
||||
(or
|
||||
|
@ -873,29 +965,31 @@
|
|||
[multicommand? (memq 'multicommand props)]
|
||||
[command? (or (and as-box-mode (not multicommand?))
|
||||
(memq 'command props))])
|
||||
(cond
|
||||
[command? (printf "\\~a{" kind)]
|
||||
[multicommand? (printf "\\~a" kind)]
|
||||
[else (printf "\\begin{~a}" kind)])
|
||||
(parameterize ([current-table-mode (if (or single-column?
|
||||
(not (current-table-mode)))
|
||||
(current-table-mode)
|
||||
(list "nested-flow" t))])
|
||||
(if as-box-mode
|
||||
(for-each (lambda (p)
|
||||
(when multicommand? (printf "{"))
|
||||
(render-boxable-block p part ri as-box-mode)
|
||||
(when multicommand? (printf "}")))
|
||||
(nested-flow-blocks t))
|
||||
(render-flow (nested-flow-blocks t) part ri #f multicommand?)))
|
||||
(cond
|
||||
[command? (printf "}")]
|
||||
[multicommand? (void)]
|
||||
[else (printf "\\end{~a}" kind)])
|
||||
null))
|
||||
(unless (and (not show-pre?)
|
||||
(member 'pretitle props))
|
||||
(cond
|
||||
[command? (printf "\\~a{" kind)]
|
||||
[multicommand? (printf "\\~a" kind)]
|
||||
[else (printf "\\begin{~a}" kind)])
|
||||
(parameterize ([current-table-mode (if (or single-column?
|
||||
(not (current-table-mode)))
|
||||
(current-table-mode)
|
||||
(list "nested-flow" t))])
|
||||
(if as-box-mode
|
||||
(for-each (lambda (p)
|
||||
(when multicommand? (printf "{"))
|
||||
(render-boxable-block p part ri as-box-mode)
|
||||
(when multicommand? (printf "}")))
|
||||
(nested-flow-blocks t))
|
||||
(render-flow (nested-flow-blocks t) part ri #f multicommand?)))
|
||||
(cond
|
||||
[command? (printf "}")]
|
||||
[multicommand? (void)]
|
||||
[else (printf "\\end{~a}" kind)])
|
||||
null)))
|
||||
|
||||
(define/override (render-nested-flow t part ri starting-item?)
|
||||
(do-render-nested-flow t part ri #f #f))
|
||||
(do-render-nested-flow t part ri #f #f #f))
|
||||
|
||||
(define/override (render-compound-paragraph t part ri starting-item?)
|
||||
(let ([kind (style-name (compound-paragraph-style t))]
|
||||
|
@ -941,7 +1035,8 @@
|
|||
[else ses])))
|
||||
|
||||
(define/private (display-protected s)
|
||||
(define rtt (rendering-tt))
|
||||
(define rtt (rendering-tt))
|
||||
(define convs (extra-character-conversions))
|
||||
(cond
|
||||
[(eq? rtt 'exact)
|
||||
(display s)]
|
||||
|
@ -995,242 +1090,269 @@
|
|||
[(#\uDF) "{\\ss}"]
|
||||
[else
|
||||
(if ((char->integer c) . > . 127)
|
||||
;; latex-prefix.rkt enables utf8 input, but this does not work for
|
||||
;; all the characters below (e.g. ∞). Some parts of the table
|
||||
;; below are therefore necessary, but some parts probably are not.
|
||||
;; Which parts are necessary may depend on the latex version,
|
||||
;; though, so we keep this table around to avoid regressions.
|
||||
(case c
|
||||
[(#\╔ #\═ #\╗ #\║ #\╚ #\╝ #\╦ #\╠ #\╣ #\╬ #\╩) (box-character c)]
|
||||
[(#\┌ #\─ #\┐ #\│ #\└ #\┘ #\┬ #\├ #\┤ #\┼ #\┴) (box-character c)]
|
||||
[(#\┏ #\━ #\┓ #\┃ #\┗ #\┛ #\┳ #\┣ #\┫ #\╋ #\┻) (box-character c 2)]
|
||||
[(#\u2011) "\\mbox{-}"] ; non-breaking hyphen
|
||||
[(#\uB0) "$^{\\circ}$"] ; degree
|
||||
[(#\uB2) "$^2$"]
|
||||
[(#\u039A) "K"] ; kappa
|
||||
[(#\u0391) "A"] ; alpha
|
||||
[(#\u039F) "O"] ; omicron
|
||||
[(#\u03A3) "$\\Sigma$"]
|
||||
[(#\u03BA) "$\\kappa$"]
|
||||
[(#\u03B1) "$\\alpha$"]
|
||||
[(#\u03B2) "$\\beta$"]
|
||||
[(#\u03B3) "$\\gamma$"]
|
||||
[(#\u03BF) "o"] ; omicron
|
||||
[(#\u03C3) "$\\sigma$"]
|
||||
[(#\u03C2) "$\\varsigma$"]
|
||||
[(#\u03BB) "$\\lambda$"]
|
||||
[(#\u039B) "$\\Lambda$"]
|
||||
[(#\u03BC) "$\\mu$"]
|
||||
[(#\u03C0) "$\\pi$"]
|
||||
[(#\ϖ) "$\\varpi$"]
|
||||
[(#\‘) "{`}"]
|
||||
[(#\’) "{'}"]
|
||||
[(#\“) "{``}"]
|
||||
[(#\”) "{''}"]
|
||||
[(#\u2013) "{--}"]
|
||||
[(#\u2014) "{---}"]
|
||||
[(#\⟨ #\〈) "$\\langle$"] ; [MATHEMATICAL] LEFT ANGLE BRACKET
|
||||
[(#\⟩ #\〉) "$\\rangle$"] ; [MATHEMATICAL] RIGHT ANGLE BRACKET
|
||||
[(#\∞) "$\\infty$"]
|
||||
[(#\⇓) "$\\Downarrow$"]
|
||||
[(#\↖) "$\\nwarrow$"]
|
||||
[(#\↓) "$\\downarrow$"]
|
||||
[(#\⇒) "$\\Rightarrow$"]
|
||||
[(#\→) "$\\rightarrow$"]
|
||||
[(#\↘) "$\\searrow$"]
|
||||
[(#\↙) "$\\swarrow$"]
|
||||
[(#\←) "$\\leftarrow$"]
|
||||
[(#\↑) "$\\uparrow$"]
|
||||
[(#\⇐) "$\\Leftarrow$"]
|
||||
[(#\−) "$\\longrightarrow$"]
|
||||
[(#\⇑) "$\\Uparrow$"]
|
||||
[(#\⇔) "$\\Leftrightarrow$"]
|
||||
[(#\↕) "$\\updownarrow$"]
|
||||
[(#\↔) "$\\leftrightarrow$"]
|
||||
[(#\↗) "$\\nearrow$"]
|
||||
[(#\⇕) "$\\Updownarrow$"]
|
||||
[(#\א) "$\\aleph$"]
|
||||
[(#\′) "$\\prime$"]
|
||||
[(#\∅) "$\\emptyset$"]
|
||||
[(#\∇) "$\\nabla$"]
|
||||
[(#\♦) "$\\diamondsuit$"]
|
||||
[(#\♠) "$\\spadesuit$"]
|
||||
[(#\♣) "$\\clubsuit$"]
|
||||
[(#\♥) "$\\heartsuit$"]
|
||||
[(#\♯) "$\\sharp$"]
|
||||
[(#\♭) "$\\flat$"]
|
||||
[(#\♮) "$\\natural$"]
|
||||
[(#\√) "$\\surd$"]
|
||||
[(#\∆) "$\\Delta$"] ; no better mapping for than \Delta for "increment"
|
||||
[(#\u2211) "$\\sum$"] ; better than \Sigma, right?
|
||||
[(#\u220F) "$\\prod$"] ; better than \Pi, right?
|
||||
[(#\u2210) "$\\coprod$"]
|
||||
[(#\u222B) "$\\int$"]
|
||||
[(#\u222E) "$\\oint$"]
|
||||
[(#\¬) "$\\neg$"]
|
||||
[(#\△) "$\\triangle$"]
|
||||
[(#\∀) "$\\forall$"]
|
||||
[(#\∃) "$\\exists$"]
|
||||
[(#\∘) "$\\circ$"]
|
||||
[(#\θ) "$\\theta$"]
|
||||
[(#\ϑ) "$\\vartheta$"]
|
||||
[(#\τ) "$\\tau$"]
|
||||
[(#\υ) "$\\upsilon$"]
|
||||
[(#\φ) "$\\phi$"]
|
||||
[(#\ϕ) "$\\varphi$"]
|
||||
[(#\δ) "$\\delta$"]
|
||||
[(#\ρ) "$\\rho$"]
|
||||
[(#\ϱ) "$\\varrho$"]
|
||||
[(#\ϵ) "$\\epsilon$"]
|
||||
[(#\ε) "$\\varepsilon$"]
|
||||
[(#\χ) "$\\chi$"]
|
||||
[(#\ψ) "$\\psi$"]
|
||||
[(#\ζ) "$\\zeta$"]
|
||||
[(#\ν) "$\\nu$"]
|
||||
[(#\ω) "$\\omega$"]
|
||||
[(#\η) "$\\eta$"]
|
||||
[(#\ι) "$\\iota$"]
|
||||
[(#\ξ) "$\\xi$"]
|
||||
[(#\Γ) "$\\Gamma$"]
|
||||
[(#\Ψ) "$\\Psi$"]
|
||||
[(#\Δ) "$\\Delta$"]
|
||||
[(#\Ξ) "$\\Xi$"]
|
||||
[(#\Υ) "$\\Upsilon$"]
|
||||
[(#\Ω) "$\\Omega$"]
|
||||
[(#\Θ) "$\\Theta$"]
|
||||
[(#\Π) "$\\Pi$"]
|
||||
[(#\Φ) "$\\Phi$"]
|
||||
[(#\±) "$\\pm$"]
|
||||
[(#\∩) "$\\cap$"]
|
||||
[(#\◇) "$\\diamond$"]
|
||||
[(#\⊕) "$\\oplus$"]
|
||||
[(#\∓) "$\\mp$"]
|
||||
[(#\∪) "$\\cup$"]
|
||||
[(#\△) "$\\bigtriangleup$"]
|
||||
[(#\⊖) "$\\ominus$"]
|
||||
[(#\×) "$\\times$"]
|
||||
[(#\⊎) "$\\uplus$"]
|
||||
[(#\▽) "$\\bigtriangledown$"]
|
||||
[(#\⊗) "$\\otimes$"]
|
||||
[(#\÷) "$\\div$"]
|
||||
[(#\⊓) "$\\sqcap$"]
|
||||
[(#\▹) "$\\triangleleft$"]
|
||||
[(#\⊘) "$\\oslash$"]
|
||||
[(#\∗) "$\\ast$"]
|
||||
[(#\⊔) "$\\sqcup$"]
|
||||
[(#\∨) "$\\vee$"]
|
||||
[(#\∧) "$\\wedge$"]
|
||||
[(#\◃) "$\\triangleright$"]
|
||||
[(#\⊙) "$\\odot$"]
|
||||
[(#\★) "$\\star$"]
|
||||
[(#\†) "$\\dagger$"]
|
||||
[(#\•) "$\\bullet$"]
|
||||
[(#\‡) "$\\ddagger$"]
|
||||
[(#\≀) "$\\wr$"]
|
||||
[(#\⨿) "$\\amalg$"]
|
||||
[(#\≤) "$\\leq$"]
|
||||
[(#\≥) "$\\geq$"]
|
||||
[(#\≡) "$\\equiv$"]
|
||||
[(#\⊨) "$\\models$"]
|
||||
[(#\≺) "$\\prec$"]
|
||||
[(#\≻) "$\\succ$"]
|
||||
[(#\∼) "$\\sim$"]
|
||||
[(#\⊥) "$\\perp$"]
|
||||
[(#\≼) "$\\preceq$"]
|
||||
[(#\≽) "$\\succeq$"]
|
||||
[(#\≃) "$\\simeq$"]
|
||||
[(#\≪) "$\\ll$"]
|
||||
[(#\≫) "$\\gg$"]
|
||||
[(#\≍) "$\\asymp$"]
|
||||
[(#\∥) "$\\parallel$"]
|
||||
[(#\⊂) "$\\subset$"]
|
||||
[(#\⊃) "$\\supset$"]
|
||||
[(#\≈) "$\\approx$"]
|
||||
[(#\⋈) "$\\bowtie$"]
|
||||
[(#\⊆) "$\\subseteq$"]
|
||||
[(#\⊇) "$\\supseteq$"]
|
||||
[(#\≌) "$\\cong$"]
|
||||
[(#\⊏) "$\\sqsubset$"]
|
||||
[(#\⊐) "$\\sqsupset$"]
|
||||
[(#\≠) "$\\neq$"]
|
||||
[(#\⌣) "$\\smile$"]
|
||||
[(#\⊑) "$\\sqsubseteq$"]
|
||||
[(#\⊒) "$\\sqsupseteq$"]
|
||||
[(#\≐) "$\\doteq$"]
|
||||
[(#\⌢) "$\\frown$"]
|
||||
[(#\∈) "$\\in$"]
|
||||
[(#\∉) "$\\not\\in$"]
|
||||
[(#\∋) "$\\ni$"]
|
||||
[(#\∝) "$\\propto$"]
|
||||
[(#\⊢) "$\\vdash$"]
|
||||
[(#\⊣) "$\\dashv$"]
|
||||
[(#\☠) "$\\skull$"]
|
||||
[(#\☺) "$\\smiley$"]
|
||||
[(#\☻) "$\\blacksmiley$"]
|
||||
[(#\☹) "$\\frownie$"]
|
||||
[(#\ø) "{\\o}"]
|
||||
[(#\Ø) "{\\O}"]
|
||||
[(#\ł) "{\\l}"]
|
||||
[(#\Ł) "{\\L}"]
|
||||
[(#\uA7) "{\\S}"]
|
||||
[(#\⟦ #\〚) "$[\\![$"]
|
||||
[(#\⟧ #\〛) "$]\\!]$"]
|
||||
[(#\↦) "$\\mapsto$"]
|
||||
[(#\⊤) "$\\top$"]
|
||||
[(#\¥) "{\\textyen}"]
|
||||
[(#\™) "{\\texttrademark}"]
|
||||
[(#\®) "{\\textregistered}"]
|
||||
[(#\©) "{\\textcopyright}"]
|
||||
[(#\u2070) "$^0$"]
|
||||
[(#\u00b9) "$^1$"]
|
||||
[(#\u00b2) "$^2$"]
|
||||
[(#\u00b3) "$^3$"]
|
||||
[(#\u2074) "$^4$"]
|
||||
[(#\u2075) "$^5$"]
|
||||
[(#\u2076) "$^6$"]
|
||||
[(#\u2077) "$^7$"]
|
||||
[(#\u2078) "$^8$"]
|
||||
[(#\u2079) "$^9$"]
|
||||
[(#\u207a) "$^+$"]
|
||||
[(#\u207b) "$^-$"]
|
||||
[(#\⋖) "$\\precdot$"]
|
||||
[(#\⋗) "$\\succdot$"]
|
||||
[(#\⋮) "\\vdots"]
|
||||
[(#\⋱) "$\\ddots$"]
|
||||
[(#\⋯) "$\\cdots$"]
|
||||
[(#\⋯) "\\hdots"]
|
||||
[else
|
||||
(cond
|
||||
[(char<=? #\uAC00 c #\uD7AF) ; Korean Hangul
|
||||
(format "\\begin{CJK}{UTF8}{mj}~a\\end{CJK}" c)]
|
||||
[else
|
||||
;; Detect characters that can be formed with combining characters
|
||||
;; and translate them to Latex combinations:
|
||||
(define s (string-normalize-nfd (string c)))
|
||||
(define len (string-length s))
|
||||
(cond
|
||||
[(len . > . 1)
|
||||
(define combiner (case (string-ref s (sub1 len))
|
||||
[(#\u300) "\\`{~a}"]
|
||||
[(#\u301) "\\'{~a}"]
|
||||
[(#\u302) "\\^{~a}"]
|
||||
[(#\u303) "\\~~{~a}"]
|
||||
[(#\u304) "\\={~a}"]
|
||||
[(#\u306) "\\u{~a}"]
|
||||
[(#\u307) "\\.{~a}"]
|
||||
[(#\u308) "\\\"{~a}"]
|
||||
[(#\u30a) "\\r{~a}"]
|
||||
[(#\u30b) "\\H{~a}"]
|
||||
[(#\u30c) "\\v{~a}"]
|
||||
[(#\u327) "\\c{~a}"]
|
||||
[(#\u328) "\\k{~a}"]
|
||||
[else #f]))
|
||||
(define base (string-normalize-nfc (substring s 0 (sub1 len))))
|
||||
(if (and combiner
|
||||
(= 1 (string-length base)))
|
||||
(format combiner (char-loop (string-ref base 0)))
|
||||
c)]
|
||||
[else c])])])
|
||||
;; first, try user-defined conversions
|
||||
(or (convs c)
|
||||
;; latex-prefix.rkt enables utf8 input, but this does not work for
|
||||
;; all the characters below (e.g. ∞). Some parts of the table
|
||||
;; below are therefore necessary, but some parts probably are not.
|
||||
;; Which parts are necessary may depend on the latex version,
|
||||
;; though, so we keep this table around to avoid regressions.
|
||||
(case c
|
||||
[(#\╔ #\═ #\╗ #\║ #\╚ #\╝ #\╦ #\╠ #\╣ #\╬ #\╩) (box-character c)]
|
||||
[(#\┌ #\─ #\┐ #\│ #\└ #\┘ #\┬ #\├ #\┤ #\┼ #\┴) (box-character c)]
|
||||
[(#\┏ #\━ #\┓ #\┃ #\┗ #\┛ #\┳ #\┣ #\┫ #\╋ #\┻) (box-character c 2)]
|
||||
[(#\u2011) "\\mbox{-}"] ; non-breaking hyphen
|
||||
[(#\uB0) "$^{\\circ}$"] ; degree
|
||||
[(#\uB2) "$^2$"]
|
||||
[(#\u039A) "K"] ; kappa
|
||||
[(#\u0391) "A"] ; alpha
|
||||
[(#\u039F) "O"] ; omicron
|
||||
[(#\u03A3) "$\\Sigma$"]
|
||||
[(#\u03BA) "$\\kappa$"]
|
||||
[(#\u03B1) "$\\alpha$"]
|
||||
[(#\u03B2) "$\\beta$"]
|
||||
[(#\u03B3) "$\\gamma$"]
|
||||
[(#\u03BF) "o"] ; omicron
|
||||
[(#\u03C3) "$\\sigma$"]
|
||||
[(#\u03C2) "$\\varsigma$"]
|
||||
[(#\u03BB) "$\\lambda$"]
|
||||
[(#\u039B) "$\\Lambda$"]
|
||||
[(#\u03BC) "$\\mu$"]
|
||||
[(#\u03C0) "$\\pi$"]
|
||||
[(#\₀) "$_0$"]
|
||||
[(#\₁) "$_1$"]
|
||||
[(#\₂) "$_2$"]
|
||||
[(#\₃) "$_3$"]
|
||||
[(#\₄) "$_4$"]
|
||||
[(#\₅) "$_5$"]
|
||||
[(#\₆) "$_6$"]
|
||||
[(#\₇) "$_7$"]
|
||||
[(#\₈) "$_8$"]
|
||||
[(#\₉) "$_9$"]
|
||||
[(#\‘) "{`}"]
|
||||
[(#\’) "{'}"]
|
||||
[(#\“) "{``}"]
|
||||
[(#\”) "{''}"]
|
||||
[(#\u2013) "{--}"]
|
||||
[(#\u2014) "{---}"]
|
||||
[(#\⟨ #\〈) "$\\langle$"] ; [MATHEMATICAL] LEFT ANGLE BRACKET
|
||||
[(#\⟩ #\〉) "$\\rangle$"] ; [MATHEMATICAL] RIGHT ANGLE BRACKET
|
||||
[(#\∞) "$\\infty$"]
|
||||
[(#\⇓) "$\\Downarrow$"]
|
||||
[(#\↖) "$\\nwarrow$"]
|
||||
[(#\↓) "$\\downarrow$"]
|
||||
[(#\⇒) "$\\Rightarrow$"]
|
||||
[(#\→) "$\\rightarrow$"]
|
||||
[(#\⟶) "$\\longrightarrow$"]
|
||||
[(#\↘) "$\\searrow$"]
|
||||
[(#\↙) "$\\swarrow$"]
|
||||
[(#\←) "$\\leftarrow$"]
|
||||
[(#\↑) "$\\uparrow$"]
|
||||
[(#\⇐) "$\\Leftarrow$"]
|
||||
[(#\−) "$\\longrightarrow$"]
|
||||
[(#\⇑) "$\\Uparrow$"]
|
||||
[(#\⇔) "$\\Leftrightarrow$"]
|
||||
[(#\↕) "$\\updownarrow$"]
|
||||
[(#\↔) "$\\leftrightarrow$"]
|
||||
[(#\↗) "$\\nearrow$"]
|
||||
[(#\↝) "$\\leadsto$"]
|
||||
[(#\↱) "$\\Lsh$"]
|
||||
[(#\↰) "$\\Rsh$"]
|
||||
[(#\⇀) "$\\rightharpoonup$"]
|
||||
[(#\↼) "$\\leftharpoonup$"]
|
||||
[(#\⇁) "$\\rightharpoondown$"]
|
||||
[(#\↽) "$\\leftharpoondown$"]
|
||||
[(#\⇌) "$\\rightleftharpoons$"]
|
||||
[(#\⇕) "$\\Updownarrow$"]
|
||||
[(#\א) "$\\aleph$"]
|
||||
[(#\′) "$\\prime$"]
|
||||
[(#\∅) "$\\emptyset$"]
|
||||
[(#\∇) "$\\nabla$"]
|
||||
[(#\♦) "$\\diamondsuit$"]
|
||||
[(#\♠) "$\\spadesuit$"]
|
||||
[(#\♣) "$\\clubsuit$"]
|
||||
[(#\♥) "$\\heartsuit$"]
|
||||
[(#\♯) "$\\sharp$"]
|
||||
[(#\♭) "$\\flat$"]
|
||||
[(#\♮) "$\\natural$"]
|
||||
[(#\√) "$\\surd$"]
|
||||
[(#\∆) "$\\Delta$"] ; no better mapping for than \Delta for "increment"
|
||||
[(#\u2211) "$\\sum$"] ; better than \Sigma, right?
|
||||
[(#\u220F) "$\\prod$"] ; better than \Pi, right?
|
||||
[(#\u2210) "$\\coprod$"]
|
||||
[(#\u222B) "$\\int$"]
|
||||
[(#\u222E) "$\\oint$"]
|
||||
[(#\¬) "$\\neg$"]
|
||||
[(#\△) "$\\triangle$"]
|
||||
[(#\∀) "$\\forall$"]
|
||||
[(#\∃) "$\\exists$"]
|
||||
[(#\∘) "$\\circ$"]
|
||||
[(#\∂) "$\\partial$"]
|
||||
[(#\θ) "$\\theta$"]
|
||||
[(#\ϑ) "$\\vartheta$"]
|
||||
[(#\τ) "$\\tau$"]
|
||||
[(#\υ) "$\\upsilon$"]
|
||||
[(#\φ) "$\\varphi$"]
|
||||
[(#\ϕ) "$\\phi$"]
|
||||
[(#\δ) "$\\delta$"]
|
||||
[(#\ρ) "$\\rho$"]
|
||||
[(#\ϱ) "$\\varrho$"]
|
||||
[(#\ϵ) "$\\epsilon$"]
|
||||
[(#\ε) "$\\varepsilon$"]
|
||||
[(#\ϖ) "$\\varpi$"]
|
||||
[(#\χ) "$\\chi$"]
|
||||
[(#\ψ) "$\\psi$"]
|
||||
[(#\ζ) "$\\zeta$"]
|
||||
[(#\ν) "$\\nu$"]
|
||||
[(#\ω) "$\\omega$"]
|
||||
[(#\η) "$\\eta$"]
|
||||
[(#\ι) "$\\iota$"]
|
||||
[(#\ξ) "$\\xi$"]
|
||||
[(#\Γ) "$\\Gamma$"]
|
||||
[(#\Ψ) "$\\Psi$"]
|
||||
[(#\Δ) "$\\Delta$"]
|
||||
[(#\Ξ) "$\\Xi$"]
|
||||
[(#\Υ) "$\\Upsilon$"]
|
||||
[(#\Ω) "$\\Omega$"]
|
||||
[(#\Θ) "$\\Theta$"]
|
||||
[(#\Π) "$\\Pi$"]
|
||||
[(#\Φ) "$\\Phi$"]
|
||||
[(#\±) "$\\pm$"]
|
||||
[(#\∩) "$\\cap$"]
|
||||
[(#\◇) "$\\diamond$"]
|
||||
[(#\⊕) "$\\oplus$"]
|
||||
[(#\∓) "$\\mp$"]
|
||||
[(#\∪) "$\\cup$"]
|
||||
[(#\△) "$\\bigtriangleup$"]
|
||||
[(#\⊖) "$\\ominus$"]
|
||||
[(#\×) "$\\times$"]
|
||||
[(#\⊎) "$\\uplus$"]
|
||||
[(#\▽) "$\\bigtriangledown$"]
|
||||
[(#\⊗) "$\\otimes$"]
|
||||
[(#\÷) "$\\div$"]
|
||||
[(#\⊓) "$\\sqcap$"]
|
||||
[(#\▹) "$\\triangleleft$"]
|
||||
[(#\⊘) "$\\oslash$"]
|
||||
[(#\∗) "$\\ast$"]
|
||||
[(#\⊔) "$\\sqcup$"]
|
||||
[(#\∨) "$\\vee$"]
|
||||
[(#\∧) "$\\wedge$"]
|
||||
[(#\◃) "$\\triangleright$"]
|
||||
[(#\◊) "$\\Diamond$"]
|
||||
[(#\⊙) "$\\odot$"]
|
||||
[(#\★) "$\\star$"]
|
||||
[(#\†) "$\\dagger$"]
|
||||
[(#\•) "$\\bullet$"]
|
||||
[(#\‡) "$\\ddagger$"]
|
||||
[(#\≀) "$\\wr$"]
|
||||
[(#\⨿) "$\\amalg$"]
|
||||
[(#\≤) "$\\leq$"]
|
||||
[(#\≥) "$\\geq$"]
|
||||
[(#\≡) "$\\equiv$"]
|
||||
[(#\⊨) "$\\models$"]
|
||||
[(#\≺) "$\\prec$"]
|
||||
[(#\≻) "$\\succ$"]
|
||||
[(#\∼) "$\\sim$"]
|
||||
[(#\⊥) "$\\perp$"]
|
||||
[(#\≼) "$\\preceq$"]
|
||||
[(#\≽) "$\\succeq$"]
|
||||
[(#\≃) "$\\simeq$"]
|
||||
[(#\≪) "$\\ll$"]
|
||||
[(#\≫) "$\\gg$"]
|
||||
[(#\≍) "$\\asymp$"]
|
||||
[(#\∥) "$\\parallel$"]
|
||||
[(#\⊂) "$\\subset$"]
|
||||
[(#\⊃) "$\\supset$"]
|
||||
[(#\≈) "$\\approx$"]
|
||||
[(#\⋈) "$\\bowtie$"]
|
||||
[(#\⊆) "$\\subseteq$"]
|
||||
[(#\⊇) "$\\supseteq$"]
|
||||
[(#\≌) "$\\cong$"]
|
||||
[(#\⊏) "$\\sqsubset$"]
|
||||
[(#\⊐) "$\\sqsupset$"]
|
||||
[(#\≠) "$\\neq$"]
|
||||
[(#\⌣) "$\\smile$"]
|
||||
[(#\⊑) "$\\sqsubseteq$"]
|
||||
[(#\⊒) "$\\sqsupseteq$"]
|
||||
[(#\≐) "$\\doteq$"]
|
||||
[(#\⌢) "$\\frown$"]
|
||||
[(#\∈) "$\\in$"]
|
||||
[(#\∉) "$\\not\\in$"]
|
||||
[(#\∋) "$\\ni$"]
|
||||
[(#\∝) "$\\propto$"]
|
||||
[(#\⊢) "$\\vdash$"]
|
||||
[(#\⊣) "$\\dashv$"]
|
||||
[(#\☠) "$\\skull$"]
|
||||
[(#\☺) "$\\smiley$"]
|
||||
[(#\☻) "$\\blacksmiley$"]
|
||||
[(#\☹) "$\\frownie$"]
|
||||
[(#\ø) "{\\o}"]
|
||||
[(#\Ø) "{\\O}"]
|
||||
[(#\ł) "{\\l}"]
|
||||
[(#\Ł) "{\\L}"]
|
||||
[(#\uA7) "{\\S}"]
|
||||
[(#\⟦ #\〚) "$[\\![$"]
|
||||
[(#\⟧ #\〛) "$]\\!]$"]
|
||||
[(#\↦) "$\\mapsto$"]
|
||||
[(#\⊤) "$\\top$"]
|
||||
[(#\¥) "{\\textyen}"]
|
||||
[(#\™) "{\\texttrademark}"]
|
||||
[(#\®) "{\\textregistered}"]
|
||||
[(#\©) "{\\textcopyright}"]
|
||||
[(#\u2070) "$^0$"]
|
||||
[(#\u00b9) "$^1$"]
|
||||
[(#\u00b2) "$^2$"]
|
||||
[(#\u00b3) "$^3$"]
|
||||
[(#\u2074) "$^4$"]
|
||||
[(#\u2075) "$^5$"]
|
||||
[(#\u2076) "$^6$"]
|
||||
[(#\u2077) "$^7$"]
|
||||
[(#\u2078) "$^8$"]
|
||||
[(#\u2079) "$^9$"]
|
||||
[(#\u207a) "$^+$"]
|
||||
[(#\u207b) "$^-$"]
|
||||
[(#\⋖) "$\\precdot$"]
|
||||
[(#\⋗) "$\\succdot$"]
|
||||
[(#\⋮) "\\vdots"]
|
||||
[(#\⋱) "$\\ddots$"]
|
||||
[(#\⋯) "$\\cdots$"]
|
||||
[(#\⋯) "\\hdots"]
|
||||
[(#\⊸) "$\\multimap$"]
|
||||
[(#\⟜) "$\\multimapinv$"]
|
||||
[(#\⅋) "$\\invamp$"]
|
||||
[(#\□) "$\\square$"]
|
||||
[else
|
||||
(cond
|
||||
[(char<=? #\uAC00 c #\uD7AF) ; Korean Hangul
|
||||
(format "\\begin{CJK}{UTF8}{mj}~a\\end{CJK}" c)]
|
||||
[else
|
||||
;; Detect characters that can be formed with combining characters
|
||||
;; and translate them to Latex combinations:
|
||||
(define s (string-normalize-nfd (string c)))
|
||||
(define len (string-length s))
|
||||
(cond
|
||||
[(len . > . 1)
|
||||
(define combiner (case (string-ref s (sub1 len))
|
||||
[(#\u300) "\\`{~a}"]
|
||||
[(#\u301) "\\'{~a}"]
|
||||
[(#\u302) "\\^{~a}"]
|
||||
[(#\u303) "\\~~{~a}"]
|
||||
[(#\u304) "\\={~a}"]
|
||||
[(#\u306) "\\u{~a}"]
|
||||
[(#\u307) "\\.{~a}"]
|
||||
[(#\u308) "\\\"{~a}"]
|
||||
[(#\u30a) "\\r{~a}"]
|
||||
[(#\u30b) "\\H{~a}"]
|
||||
[(#\u30c) "\\v{~a}"]
|
||||
[(#\u327) "\\c{~a}"]
|
||||
[(#\u328) "\\k{~a}"]
|
||||
[else #f]))
|
||||
(define base (string-normalize-nfc (substring s 0 (sub1 len))))
|
||||
(if (and combiner
|
||||
(= 1 (string-length base)))
|
||||
(format combiner (char-loop (string-ref base 0)))
|
||||
c)]
|
||||
[else c])])]))
|
||||
c)])))
|
||||
(loop (add1 i))))))]))
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@
|
|||
unicode-encoding-packages))
|
||||
(scribble-file "lncs/style.tex")
|
||||
(list cls-file)
|
||||
#f))
|
||||
#f
|
||||
#:replacements (hash "scribble-load-replace.tex" (scribble-file "lncs/lncs-load.tex"))))
|
||||
|
||||
(define lncs-extras
|
||||
(let ([abs (lambda (s)
|
||||
|
@ -63,8 +64,8 @@
|
|||
(unless (or (not (path? cls-file))
|
||||
(file-exists? cls-file))
|
||||
(log-error (format "File not found: ~a" cls-file))
|
||||
(define site "ftp.springer.de")
|
||||
(define path "pub/tex/latex/llncs/latex2e")
|
||||
(define site "ftp.springernature.com")
|
||||
(define path "cs-proceeding/llncs")
|
||||
(define file "llncs2e.zip")
|
||||
(unless (directory-exists? (find-system-path 'addon-dir))
|
||||
(make-directory (find-system-path 'addon-dir)))
|
||||
|
|
14
scribble-lib/scribble/lncs/lncs-load.tex
Normal file
14
scribble-lib/scribble/lncs/lncs-load.tex
Normal file
|
@ -0,0 +1,14 @@
|
|||
% Scribble should not change the default font from CMR
|
||||
% to ptm for LNCS. See Guidelines for Authors of Papers
|
||||
% to be Published in Springer Computer Science Proceedings,
|
||||
% section 2.3, Fonts.
|
||||
%
|
||||
% IMPORTANT: the default package newtxmath *still*
|
||||
% changes the math font. If you want to disable it,
|
||||
% uncomment the next line
|
||||
% \renewcommand\packageTxfonts\relax
|
||||
% However, scribble would still generate LaTeX commands
|
||||
% that depend on newtxmath upon rendering symbols
|
||||
% \multimap, \multimapinv, \invamp and \square in
|
||||
% scribble-lib/scribble/latex-render.rkt.
|
||||
\renewcommand\renewrmdefault\relax
|
13
scribble-lib/scribble/lncs/lncs.css
Normal file
13
scribble-lib/scribble/lncs/lncs.css
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* Support for styles in scribble/lncs */
|
||||
|
||||
.SAuthorPlace, .SAuthorEmail,
|
||||
.SConferenceInfo, .SCopyrightYear, .SCopyrightData,
|
||||
.Sdoi, .SPexclusivelicense,
|
||||
.SCategory, .SCategoryPlus, .STerms, .SKeywords {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.SSubtitle {
|
||||
display: block;
|
||||
font-size: smaller;
|
||||
}
|
|
@ -30,7 +30,7 @@
|
|||
(define-syntax (tangle stx)
|
||||
(define chunk-mentions '())
|
||||
(unless first-id
|
||||
(raise-syntax-error 'scribble/lp "no chunks"))
|
||||
(raise-no-chunks-error))
|
||||
(define orig-stx (syntax-case stx () [(_ orig) #'orig]))
|
||||
(define (restore nstx d) (datum->syntax orig-stx d nstx nstx))
|
||||
(define (shift nstx) (replace-context orig-stx nstx))
|
||||
|
@ -121,6 +121,7 @@
|
|||
|
||||
(define-for-syntax ((make-module-begin submod?) stx)
|
||||
(syntax-case stx ()
|
||||
[(_) (raise-no-chunks-error)]
|
||||
[(_ body0 . body)
|
||||
(let ([expanded
|
||||
(expand `(,#'module scribble-lp-tmp-name scribble/private/lp
|
||||
|
@ -147,3 +148,6 @@
|
|||
|
||||
(define-syntax module-begin/plain (make-module-begin #f))
|
||||
(define-syntax module-begin/doc (make-module-begin #t))
|
||||
|
||||
(define-for-syntax (raise-no-chunks-error)
|
||||
(raise-syntax-error 'scribble/lp "no chunks"))
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -6,9 +6,11 @@
|
|||
.RktMod, .RktKw, .RktVar, .RktSym,
|
||||
.RktRes, .RktOut, .RktCmt, .RktVal,
|
||||
.RktBlk, .RktErr {
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
white-space: inherit;
|
||||
font-size: 1rem;
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
|
||||
}
|
||||
|
||||
/* this selctor grabs the first linked Racket symbol
|
||||
|
@ -16,14 +18,14 @@ in a definition box (i.e., the symbol being defined) */
|
|||
a.RktValDef, a.RktStxDef, a.RktSymDef,
|
||||
span.RktValDef, span.RktStxDef, span.RktSymDef
|
||||
{
|
||||
font-size: 1.15rem;
|
||||
font-size: 1.1rem;
|
||||
color: black;
|
||||
font-weight: 600;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
.inheritedlbl {
|
||||
font-family: 'Fira', sans;
|
||||
font-family: 'Fira', sans-serif;
|
||||
}
|
||||
|
||||
.RBackgroundLabelInner {
|
||||
|
@ -86,6 +88,7 @@ span.RktValDef, span.RktStxDef, span.RktSymDef
|
|||
|
||||
.RktOpt {
|
||||
color: black;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.RktKw {
|
||||
|
@ -119,7 +122,6 @@ span.RktValDef, span.RktStxDef, span.RktSymDef
|
|||
.RktValLink, .RktStxLink, .RktModLink {
|
||||
text-decoration: none;
|
||||
color: #07A;
|
||||
font-weight: 500;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
|
@ -131,7 +133,7 @@ h2 .RktMod, h3 .RktMod, h4 .RktMod, h5 .RktMod,
|
|||
h2 .RktVal, h3 .RktVal, h4 .RktVal, h5 .RktVal,
|
||||
h2 .RktPn, h3 .RktPn, h4 .RktPn, h5 .RktPn {
|
||||
color: #333;
|
||||
font-size: 1.65rem;
|
||||
font-size: 1.50rem;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
|
@ -141,9 +143,9 @@ h2 .RktPn, h3 .RktPn, h4 .RktPn, h5 .RktPn {
|
|||
color: inherit;
|
||||
}
|
||||
|
||||
.tocset .RktValLink, .tocset .RktStxLink, .tocset .RktModLink {
|
||||
.tocset .RktValLink, .tocset .RktStxLink, .tocset .RktModLink, .tocset .RktSym {
|
||||
color: black;
|
||||
font-weight: 400;
|
||||
font-weight: 400;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
|
@ -195,11 +197,11 @@ tbody > tr:first-child > td > .together {
|
|||
}
|
||||
|
||||
.defmodule {
|
||||
font-family: 'Source Code Pro';
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
padding: 0.25rem 0.75rem 0.25rem 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
width: 100%;
|
||||
background-color: hsl(60, 29%, 94%);
|
||||
background-color: #ebf0f4;
|
||||
}
|
||||
|
||||
.defmodule a {
|
||||
|
@ -218,6 +220,10 @@ tbody > tr:first-child > td > .together {
|
|||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* make parens ordinary color in defmodule */
|
||||
.defmodule .RktPn {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.specgrammar {
|
||||
float: none;
|
||||
|
@ -288,7 +294,7 @@ tbody > tr:first-child > td > .together {
|
|||
text-align: right;
|
||||
z-index: 0;
|
||||
font-weight: 300;
|
||||
font-family: 'Source Code Pro';
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
font-size: 0.9rem;
|
||||
color: gray;
|
||||
}
|
||||
|
@ -296,7 +302,7 @@ tbody > tr:first-child > td > .together {
|
|||
|
||||
.RpackageSpec .Smaller {
|
||||
font-weight: 300;
|
||||
font-family: 'Source Code Pro';
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,14 +15,170 @@ AddOnLoad(function() {
|
|||
}
|
||||
})
|
||||
|
||||
// cache of source urls
|
||||
var cache = {};
|
||||
|
||||
function ParseSource(source, mod_path, single_collection) {
|
||||
|
||||
var source_url = new URL(source);
|
||||
|
||||
if (source_url.protocol == "github:") {
|
||||
// browser URL parser only works with http(s) URLs
|
||||
source_url = new URL("https" + source.substring(6));
|
||||
var host = source_url.host;
|
||||
var url_path = source_url.pathname.substring(1).split("/");
|
||||
if (!(url_path.length >= 2)) return null;
|
||||
var user = url_path.shift();
|
||||
var repo = url_path.shift();
|
||||
var branch = url_path.shift();
|
||||
var source_path = url_path.join("/");
|
||||
}
|
||||
else if (("https:" == source_url.protocol) || ("git:" == source_url.protocol)) {
|
||||
// browser URL parser only works with http(s) URLs
|
||||
if ("git:" == source_url.protocol)
|
||||
source_url = new URL("https" + source.substring(3));
|
||||
|
||||
var host = source_url.host;
|
||||
var source_path = source_url.searchParams.get("path");
|
||||
var branch = (source_url.hash || "#master").substring(1);
|
||||
var url_path = source_url.pathname.substring(1).split("/");
|
||||
if (url_path.length < 2) throw [source_url.pathname, url_path];
|
||||
var user = url_path.shift();
|
||||
var repo = url_path.shift();
|
||||
var mtch = repo.match(/(.*)\.git$/);
|
||||
if (mtch) repo = mtch[1];
|
||||
|
||||
}
|
||||
else return null;
|
||||
|
||||
var mod_path_re = /^\(lib "(.+)"\)$/;
|
||||
|
||||
var mod_path_elems = mod_path && mod_path.match(mod_path_re)[1].split("/");
|
||||
|
||||
if (!user || !repo || !mod_path_elems)
|
||||
return null;
|
||||
if (single_collection)
|
||||
mod_path_elems.shift();
|
||||
|
||||
var file_path = mod_path_elems.join("/");
|
||||
|
||||
|
||||
if (source_path) {
|
||||
file_path = source_path + "/" + file_path;
|
||||
}
|
||||
|
||||
return { user: user,
|
||||
repo: repo,
|
||||
file_path: file_path,
|
||||
branch: branch,
|
||||
host: host };
|
||||
}
|
||||
|
||||
function AddSourceElement(pkg_url, info) {
|
||||
info.appendChild(document.createTextNode("Document source "));
|
||||
var url_line = document.createElement("div");
|
||||
var a = document.createElement("a");
|
||||
a.href = pkg_url;
|
||||
a.style.whiteSpace = "nowrap";
|
||||
a.appendChild(document.createTextNode(pkg_url));
|
||||
addSpan(url_line, "\xA0", "RktRdr");
|
||||
url_line.appendChild(a);
|
||||
info.appendChild(url_line);
|
||||
}
|
||||
|
||||
var prefixes = { "github.com": "tree",
|
||||
"gitlab.com": "-/blob" };
|
||||
|
||||
|
||||
function AddSourceUrl(source, mod_path, collection, info) {
|
||||
// multi is encoded as an array, empty as false
|
||||
single_collection = (typeof collection === "string");
|
||||
|
||||
var parsed = source && mod_path && ParseSource(source, mod_path, single_collection);
|
||||
|
||||
if (!parsed) return;
|
||||
|
||||
prefix = prefixes.hasOwnProperty(parsed.host) && prefixes[parsed.host];
|
||||
if (!prefix) return;
|
||||
|
||||
var correct_url = "https://" + [parsed.host, parsed.user, parsed.repo, prefix, parsed.branch, parsed.file_path].join("/");
|
||||
|
||||
if (info) AddSourceElement(correct_url, info);
|
||||
}
|
||||
|
||||
function addSpan(dest, str, cn) {
|
||||
var s = document.createElement("span");
|
||||
s.className = cn;
|
||||
s.style.whiteSpace = "nowrap";
|
||||
s.appendChild(document.createTextNode(str));
|
||||
dest.appendChild(s);
|
||||
}
|
||||
|
||||
|
||||
// test cases
|
||||
if (false) {
|
||||
console.log(ParseSource("git://gitlab.com/benn/foo?path=xxx",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
false))
|
||||
console.log(ParseSource("github://github.com/carl-eastlund/mischief/master",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
false))
|
||||
console.log(ParseSource("github://github.com/carl-eastlund/mischief/stable/dir",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
false))
|
||||
|
||||
console.log(ParseSource("git://github.com/racket/racket/?path=pkgs/racket-doc",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
false));
|
||||
|
||||
console.log(ParseSource("git://github.com/rmculpepper/asn1.git?path=asn1-doc",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
true));
|
||||
console.log(ParseSource("git://github.com/rmculpepper/asn1",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
true));
|
||||
console.log(ParseSource("git://github.com/rmculpepper/asn1",
|
||||
'(lib "asn1/scribblings/asn1.scrbl")',
|
||||
false));
|
||||
}
|
||||
|
||||
function AddPartTitleOnClick(elem) {
|
||||
var mod_path = elem.getAttribute("x-source-module");
|
||||
var tag = elem.getAttribute("x-part-tag");
|
||||
var source_pkg = elem.getAttribute("x-source-pkg");
|
||||
|
||||
// create here to share
|
||||
var info = document.createElement("div");
|
||||
|
||||
|
||||
// tag is not needed, but this way we can add the element in only one place
|
||||
// avoid failing on browser that don't have `fetch`
|
||||
if (mod_path && source_pkg && tag && window.fetch) {
|
||||
|
||||
var cached = cache[mod_path]
|
||||
if (cached) {
|
||||
AddSourceElement(cached[0], mod_path, cached[1], info);
|
||||
}
|
||||
else {
|
||||
fetch("https://pkgs.racket-lang.org/pkg/" + source_pkg + ".json")
|
||||
.then(function (response) { return response.json(); })
|
||||
.then(function (data) {
|
||||
var vers = data["versions"] || {};
|
||||
var def = vers["default"] || {};
|
||||
var source = def["source"] || undefined;
|
||||
var collection = data["collection"];
|
||||
if (source) {
|
||||
cache[mod_path] = [source, collection];
|
||||
AddSourceUrl(source, mod_path, collection, info);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (mod_path && tag) {
|
||||
// Might not be present:
|
||||
var prefixes = elem.getAttribute("x-part-prefixes");
|
||||
|
||||
var info = document.createElement("div");
|
||||
info.className = "RPartExplain";
|
||||
|
||||
/* The "top" tag refers to a whole document: */
|
||||
|
@ -42,35 +198,28 @@ function AddPartTitleOnClick(elem) {
|
|||
var line1x = ((is_long && prefixes) ? document.createElement("div") : line1);
|
||||
var line2 = (is_long ? document.createElement("div") : line1);
|
||||
|
||||
function add(dest, str, cn) {
|
||||
var s = document.createElement("span");
|
||||
s.className = cn;
|
||||
s.style.whiteSpace = "nowrap";
|
||||
s.appendChild(document.createTextNode(str));
|
||||
dest.appendChild(s);
|
||||
}
|
||||
/* Construct a `secref` call with suitable syntax coloring: */
|
||||
add(line1, "\xA0@", "RktRdr");
|
||||
add(line1, (is_top ? "other-doc" : "secref"), "RktSym");
|
||||
add(line1, "[", "RktPn");
|
||||
addSpan(line1, "\xA0@", "RktRdr");
|
||||
addSpan(line1, (is_top ? "other-doc" : "secref"), "RktSym");
|
||||
addSpan(line1, "[", "RktPn");
|
||||
if (!is_top)
|
||||
add(line1, tag, "RktVal");
|
||||
addSpan(line1, tag, "RktVal");
|
||||
if (is_long) {
|
||||
/* indent additional lines: */
|
||||
if (prefixes)
|
||||
add(line1x, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn");
|
||||
add(line2, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn");
|
||||
addSpan(line1x, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn");
|
||||
addSpan(line2, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0", "RktPn");
|
||||
}
|
||||
if (prefixes) {
|
||||
add(line1x, " #:tag-prefixes ", "RktPn");
|
||||
add(line1x, "'", "RktVal");
|
||||
add(line1x, prefixes, "RktVal");
|
||||
addSpan(line1x, " #:tag-prefixes ", "RktPn");
|
||||
addSpan(line1x, "'", "RktVal");
|
||||
addSpan(line1x, prefixes, "RktVal");
|
||||
}
|
||||
if (!is_top)
|
||||
add(line2, " #:doc ", "RktPn");
|
||||
add(line2, "'", "RktVal");
|
||||
add(line2, mod_path, "RktVal");
|
||||
add(line2, "]", "RktPn");
|
||||
addSpan(line2, " #:doc ", "RktPn");
|
||||
addSpan(line2, "'", "RktVal");
|
||||
addSpan(line2, mod_path, "RktVal");
|
||||
addSpan(line2, "]", "RktPn");
|
||||
|
||||
info.appendChild(line1);
|
||||
if (is_long)
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
(provide-structs
|
||||
[module-path-index-desc ()]
|
||||
[(language-index-desc module-path-index-desc) ()]
|
||||
[(reader-index-desc module-path-index-desc) ()]
|
||||
[exported-index-desc ([name symbol?]
|
||||
[from-libs (listof module-path?)])]
|
||||
[(method-index-desc exported-index-desc) ([method-name symbol?]
|
||||
|
|
|
@ -26,17 +26,25 @@
|
|||
|
||||
/* Monospace: */
|
||||
.maincolumn, .refpara, .refelem, .tocset, .stt, .hspace, .refparaleft, .refelemleft {
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
white-space: inherit;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.stt {
|
||||
font-weight: 500;
|
||||
/* embolden the "Racket Guide" and "Racket Reference" links on the TOC */
|
||||
/* there isn't an obvious tag in the markup that designates the top TOC page, which is called "start.scrbl" */
|
||||
/* nor a tag that designates these two links as special */
|
||||
/* so we'll use this slightly tortured sibling selector that hooks onto the h2 tag */
|
||||
h2[x-source-module='(lib "scribblings/main/start.scrbl")'] ~ table a[href="guide/index.html"],
|
||||
h2[x-source-module='(lib "scribblings/main/start.scrbl")'] ~ table a[href="reference/index.html"] {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
h2 .stt {
|
||||
font-size: 2.7rem;
|
||||
font-size: 2.3rem;
|
||||
/* prevent automatic bolding from h2 */
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.toptoclink .stt {
|
||||
|
@ -48,7 +56,7 @@ h2 .stt {
|
|||
|
||||
.RpackageSpec .stt {
|
||||
font-weight: 300;
|
||||
font-family: 'Source Code Pro';
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
|
@ -61,8 +69,11 @@ h3 .stt, h4 .stt, h5 .stt {
|
|||
|
||||
/* Serif: */
|
||||
.main, .refcontent, .tocview, .tocsub, .sroman, i {
|
||||
font-family: 'Charter', serif;
|
||||
font-family: 'Charter-Racket', serif;
|
||||
font-size: 1.18rem;
|
||||
/* Don't use font-feature-settings with Charter,
|
||||
it fouls up loading for reasons mysterious */
|
||||
/* font-feature-settings: 'tnum' 1, 'liga' 0; */
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,9 +81,10 @@ h3 .stt, h4 .stt, h5 .stt {
|
|||
.version, .versionNoNav, .ssansserif {
|
||||
font-family: 'Fira', sans-serif;
|
||||
}
|
||||
|
||||
/* used mostly for DrRacket menu commands */
|
||||
.ssansserif {
|
||||
font-family: 'Fira';
|
||||
font-weight: 500;
|
||||
font-family: 'Fira', sans-serif;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
|
@ -98,19 +110,13 @@ li {
|
|||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, h7, h8 {
|
||||
font-family: 'Fira';
|
||||
font-family: 'Fira', sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 1.6rem;
|
||||
color: #333;
|
||||
margin-top: inherit;
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.25;
|
||||
-moz-font-feature-settings: 'tnum=1';
|
||||
-moz-font-feature-settings: 'tnum' 1;
|
||||
-webkit-font-feature-settings: 'tnum' 1;
|
||||
-o-font-feature-settings: 'tnum' 1;
|
||||
-ms-font-feature-settings: 'tnum' 1;
|
||||
font-feature-settings: 'tnum' 1;
|
||||
|
||||
}
|
||||
|
||||
|
@ -121,12 +127,15 @@ h3, h4, h5, h6, h7, h8 {
|
|||
|
||||
|
||||
h2 { /* per-page main title */
|
||||
font-family: 'Miso';
|
||||
font-weight: bold;
|
||||
font-family: 'Cooper-Hewitt';
|
||||
margin-top: 4rem;
|
||||
font-size: 3rem;
|
||||
line-height: 1.1;
|
||||
font-size: 2.3rem;
|
||||
font-weight: bold;
|
||||
line-height: 1.2;
|
||||
width: 90%;
|
||||
/* a little nudge to make text visually lower than 4rem rule in left margin */
|
||||
position: relative;
|
||||
top: 6px;
|
||||
}
|
||||
|
||||
h3, h4, h5, h6, h7, h8 {
|
||||
|
@ -174,7 +183,7 @@ a:hover {
|
|||
left: 0;
|
||||
width: 15rem;
|
||||
height: 6rem;
|
||||
font-family: 'Fira';
|
||||
font-family: 'Fira', sans-serif;
|
||||
font-size: 0.9rem;
|
||||
border-bottom: 0px solid hsl(216, 15%, 70%);
|
||||
background-color: inherit;
|
||||
|
@ -251,18 +260,26 @@ a:hover {
|
|||
}
|
||||
|
||||
.searchbox {
|
||||
font-size: 1rem;
|
||||
font-size: 0.9rem;
|
||||
width: 12rem;
|
||||
margin: 1rem;
|
||||
padding: 0.25rem;
|
||||
padding: 0.25rem 0.4rem ;
|
||||
vertical-align: middle;
|
||||
background-color: white;
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
}
|
||||
|
||||
|
||||
#search_box {
|
||||
font-size: 0.8rem;
|
||||
font-family: 'Fira-Mono', monospace;
|
||||
font-size: 1rem;
|
||||
padding: 0.25rem 0.3rem ;
|
||||
}
|
||||
|
||||
/* Default to local view. Global will specialize */
|
||||
.plt_global_only { display: none; }
|
||||
.plt_local_only { display: block; }
|
||||
|
||||
/* ---------------------------------------- */
|
||||
/* Version */
|
||||
|
||||
|
@ -315,7 +332,7 @@ a:hover {
|
|||
|
||||
|
||||
/* slightly different handling for margin-note* on narrow screens */
|
||||
@media all and (max-width:1260px) {
|
||||
@media all and (max-width:1340px) {
|
||||
span.refcolumn {
|
||||
float: right;
|
||||
width: 50%;
|
||||
|
@ -352,18 +369,17 @@ a:hover {
|
|||
}
|
||||
|
||||
|
||||
@media all and (min-width:1260px) {
|
||||
@media all and (min-width:1340px) {
|
||||
.refcolumn {
|
||||
position: absolute;
|
||||
left: 66rem; right: 3em;
|
||||
margin: 0;
|
||||
margin: 0 -22.5rem 1rem 0;
|
||||
float: right;
|
||||
max-width: 18rem;
|
||||
clear: right;
|
||||
width: 18rem;
|
||||
}
|
||||
}
|
||||
|
||||
.refcontent {
|
||||
font-family: 'Fira';
|
||||
font-family: 'Fira', sans-serif;
|
||||
font-size: 1rem;
|
||||
line-height: 1.6;
|
||||
margin: 0 0 0 0;
|
||||
|
@ -379,6 +395,14 @@ a:hover {
|
|||
margin: 0em 0em 0em -13em;
|
||||
}
|
||||
|
||||
@media all and (max-width:1340px) {
|
||||
/* avoid disappearing left note if display area is narrow */
|
||||
.refparaleft, .refelemleft {
|
||||
margin: 0em 0em 0em 0em;
|
||||
right: 0em;
|
||||
}
|
||||
}
|
||||
|
||||
.refcolumnleft {
|
||||
background-color: hsl(60, 29%, 94%);
|
||||
display: block;
|
||||
|
@ -410,14 +434,7 @@ a:hover {
|
|||
padding-bottom: 0.4rem;
|
||||
padding-left: 0.2rem;
|
||||
line-height: 1.1;
|
||||
font-family: 'Fira';
|
||||
-moz-font-feature-settings: 'tnum=1';
|
||||
-moz-font-feature-settings: 'tnum' 1;
|
||||
-webkit-font-feature-settings: 'tnum' 1;
|
||||
-o-font-feature-settings: 'tnum' 1;
|
||||
-ms-font-feature-settings: 'tnum' 1;
|
||||
font-feature-settings: 'tnum' 1;
|
||||
|
||||
font-family: 'Fira', sans-serif;
|
||||
}
|
||||
|
||||
.tocset td a {
|
||||
|
@ -487,11 +504,23 @@ table.tocsublist {
|
|||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.tocviewsublist td, .tocviewsublistbottom td, .tocviewsublisttop td, .tocsub td,
|
||||
.tocviewsublist td,
|
||||
.tocviewsublistbottom td,
|
||||
.tocviewsublisttop td,
|
||||
.tocsub td,
|
||||
.tocviewsublistonly td {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
/* shrink the monospaced text (`stt`) within nav */
|
||||
.tocviewsublist td .stt,
|
||||
.tocviewsublistbottom td .stt,
|
||||
.tocviewsublisttop td .stt,
|
||||
.tocsub td .stt,
|
||||
.tocviewsublistonly td .stt {
|
||||
font-size: 95%;
|
||||
}
|
||||
|
||||
|
||||
.tocviewtoggle {
|
||||
font-size: 75%; /* looks better, and avoids bounce when toggling sub-sections due to font alignments */
|
||||
|
@ -529,7 +558,7 @@ table.tocsublist {
|
|||
.tocsubtitle {
|
||||
display: block;
|
||||
font-size: 62%;
|
||||
font-family: 'Fira';
|
||||
font-family: 'Fira', sans-serif;
|
||||
font-weight: bolder;
|
||||
font-style: normal;
|
||||
letter-spacing: 2px;
|
||||
|
@ -583,20 +612,27 @@ blockquote {
|
|||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
/* put a little air between lines of code sample */
|
||||
/* Fira Mono appears taller than Source Code Pro */
|
||||
.SCodeFlow td {
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
.boxed {
|
||||
margin: 0;
|
||||
margin-top: 2em;
|
||||
padding: 0.25em;
|
||||
padding-bottom: 0.5em;
|
||||
padding-top: 0.3em;
|
||||
padding-bottom: 0.4em;
|
||||
background: #f3f3f3;
|
||||
box-sizing:border-box;
|
||||
border-top: 1px solid #99b;
|
||||
background: hsl(216, 78%, 95%);
|
||||
background: -moz-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 78%, 95%) 100%);
|
||||
background: -webkit-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 78%, 95%) 100%);
|
||||
background: -o-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 78%, 95%) 100%);
|
||||
background: -ms-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 78%, 95%) 100%);
|
||||
background: linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 78%, 95%) 100%);
|
||||
background: -moz-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%);
|
||||
background: -webkit-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%);
|
||||
background: -o-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%);
|
||||
background: -ms-linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%);
|
||||
background: linear-gradient(to bottom left, hsl(0, 0%, 99%) 0%, hsl(216, 62%, 95%) 100%);
|
||||
}
|
||||
|
||||
blockquote > blockquote.SVInsetFlow {
|
||||
|
@ -611,7 +647,6 @@ blockquote > blockquote.SVInsetFlow {
|
|||
|
||||
.SVInsetFlow a, .SCodeFlow a {
|
||||
color: #07A;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.SubFlow {
|
||||
|
@ -629,11 +664,11 @@ blockquote > blockquote.SVInsetFlow {
|
|||
.SAuthorListBox {
|
||||
position: static;
|
||||
float: none;
|
||||
font-family: 'Fira';
|
||||
font-family: 'Fira', sans-serif;
|
||||
font-weight: 300;
|
||||
font-size: 110%;
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 3rem;
|
||||
margin-bottom: 2rem;
|
||||
width: 30rem;
|
||||
height: auto;
|
||||
}
|
||||
|
@ -740,4 +775,4 @@ blockquote > blockquote.SVInsetFlow {
|
|||
margin-right: 13em;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
"private/render-utils.rkt"
|
||||
racket/class racket/port racket/list racket/string racket/match
|
||||
scribble/text/wrap)
|
||||
(provide render-mixin)
|
||||
(provide render-mixin
|
||||
current-markdown-link-sections)
|
||||
|
||||
(define current-markdown-link-sections (make-parameter #f))
|
||||
|
||||
(define current-indent (make-parameter 0))
|
||||
(define (make-indent amt)
|
||||
|
@ -17,6 +20,9 @@
|
|||
(indent))
|
||||
|
||||
(define note-depth (make-parameter 0))
|
||||
(define in-toc (make-parameter #f))
|
||||
|
||||
(define markdown-part-tag 'markdown-section)
|
||||
|
||||
(define (render-mixin %)
|
||||
(class %
|
||||
|
@ -37,6 +43,16 @@
|
|||
format-number
|
||||
number-depth)
|
||||
|
||||
(define/override (collect-part-tags d ci number)
|
||||
(for ([t (part-tags d)])
|
||||
(let ([t (generate-tag t ci)])
|
||||
(collect-put! ci
|
||||
t
|
||||
(vector (or (part-title-content d) '("???"))
|
||||
(add-current-tag-prefix t)
|
||||
number
|
||||
markdown-part-tag)))))
|
||||
|
||||
(define/override (render-part d ht)
|
||||
(let ([number (collected-info-number (part-collected-info d ht))])
|
||||
(unless (part-style? d 'hidden)
|
||||
|
@ -153,25 +169,32 @@
|
|||
(write-string (make-string (note-depth) #\>))
|
||||
(unless (zero? (note-depth))
|
||||
(write-string " ")))
|
||||
(define o (open-output-string))
|
||||
(parameterize ([current-output-port o])
|
||||
(super render-paragraph p part ri))
|
||||
;; 1. Remove newlines so we can re-wrap the text.
|
||||
;;
|
||||
;; 2. Combine adjacent code spans into one. These result from
|
||||
;; something like @racket[(x y)] being treated as multiple
|
||||
;; RktXXX items rather than one. (Although it would be
|
||||
;; more-correct to handle them at that level, I don't easily see
|
||||
;; how. As a result I'm handling it after-the-fact, at the
|
||||
;; text/Markdown stage.)
|
||||
(define to-wrap (regexp-replaces (get-output-string o)
|
||||
'([#rx"\n" " "] ;1
|
||||
[#rx"``" ""]))) ;2
|
||||
(define lines (wrap-line (string-trim to-wrap) (- 72 (current-indent))))
|
||||
(write-note)
|
||||
(write-string (car lines))
|
||||
(for ([line (in-list (cdr lines))])
|
||||
(newline) (indent) (write-note) (write-string line))
|
||||
(cond
|
||||
[(in-toc)
|
||||
(write-note)
|
||||
(super render-paragraph p part ri)
|
||||
;; two spaces at a line end creates a line break:
|
||||
(write-string " ")]
|
||||
[else
|
||||
(define o (open-output-string))
|
||||
(parameterize ([current-output-port o])
|
||||
(super render-paragraph p part ri))
|
||||
;; 1. Remove newlines so we can re-wrap the text.
|
||||
;;
|
||||
;; 2. Combine adjacent code spans into one. These result from
|
||||
;; something like @racket[(x y)] being treated as multiple
|
||||
;; RktXXX items rather than one. (Although it would be
|
||||
;; more-correct to handle them at that level, I don't easily see
|
||||
;; how. As a result I'm handling it after-the-fact, at the
|
||||
;; text/Markdown stage.)
|
||||
(define to-wrap (regexp-replaces (get-output-string o)
|
||||
'([#rx"\n" " "] ;1
|
||||
[#rx"``" ""]))) ;2
|
||||
(define lines (wrap-line (string-trim to-wrap) (- 72 (current-indent))))
|
||||
(write-note)
|
||||
(write-string (car lines))
|
||||
(for ([line (in-list (cdr lines))])
|
||||
(newline) (indent) (write-note) (write-string line))])
|
||||
(newline)
|
||||
null)
|
||||
|
||||
|
@ -193,6 +216,9 @@
|
|||
(define (italic? i)
|
||||
(and (element? i) (eq? (element-style i) 'italic)))
|
||||
|
||||
(define (emph? i)
|
||||
(and (element? i) (eq? (element-style i) 'emph)))
|
||||
|
||||
(define (code? i)
|
||||
(and (element? i)
|
||||
(let ([s (element-style i)])
|
||||
|
@ -230,12 +256,18 @@
|
|||
[(and (code? i) (not (in-code?)))
|
||||
(recurse-wrapped "`" in-code?)]
|
||||
|
||||
[(and (bold? i) (not (in-bold?)))
|
||||
[(and (bold? i) (not (in-bold?)) (not (in-code?)))
|
||||
(recurse-wrapped "**" in-bold?)]
|
||||
|
||||
[(and (italic? i) (not (in-italic?)))
|
||||
[(and (italic? i) (not (in-italic?)) (not (in-code?)))
|
||||
(recurse-wrapped "_" in-italic?)]
|
||||
|
||||
[(and (emph? i) (not (in-code?)))
|
||||
(display "_") ;; zero-width space, underscore
|
||||
(begin0
|
||||
(super render-content i part ri)
|
||||
(display "_"))] ;; underscore, zero-width space
|
||||
|
||||
[(and (preserve-spaces? i) (not (preserving-spaces?)))
|
||||
(parameterize ([preserving-spaces? #t])
|
||||
(render-content i part ri))]
|
||||
|
@ -248,15 +280,45 @@
|
|||
(render-content i part ri))
|
||||
(printf "](~a)" (sanitize-parens link))))]
|
||||
|
||||
[(and (link-element? i)
|
||||
(current-markdown-link-sections)
|
||||
(not (in-link?))
|
||||
;; Link to a part within this document?
|
||||
(let ([vec (resolve-get part ri (link-element-tag i))])
|
||||
(and (vector? vec)
|
||||
(= 4 (vector-length vec))
|
||||
(eq? markdown-part-tag (vector-ref vec 3))
|
||||
vec)))
|
||||
=> (lambda (vec)
|
||||
(define s (string-append
|
||||
(let ([s (if (vector-ref vec 2)
|
||||
(format-number (vector-ref vec 2) '() #t)
|
||||
'())])
|
||||
(if (null? s)
|
||||
""
|
||||
(string-append (car s) " ")))
|
||||
(content->string (vector-ref vec 0))))
|
||||
(display "[")
|
||||
(begin0
|
||||
(parameterize ([in-link? #t])
|
||||
(super render-content i part ri))
|
||||
(display "](#")
|
||||
(display (regexp-replace* #" "
|
||||
(regexp-replace* #rx"[^a-zA-Z0-9_ -]" (string-downcase s) "")
|
||||
#"-"))
|
||||
(display ")")))]
|
||||
|
||||
[else (super render-content i part ri)]))
|
||||
|
||||
(define/override (render-nested-flow i part ri starting-item?)
|
||||
(define s (nested-flow-style i))
|
||||
(unless (memq 'decorative (style-properties s))
|
||||
(define note? (equal? (style-name s) "refcontent"))
|
||||
(define toc? (equal? (style-name s) 'table-of-contents))
|
||||
(when note?
|
||||
(note-depth (add1 (note-depth))))
|
||||
(begin0 (super render-nested-flow i part ri starting-item?)
|
||||
(begin0 (parameterize ([in-toc (or toc? (in-toc))])
|
||||
(super render-nested-flow i part ri starting-item?))
|
||||
(when note?
|
||||
(note-depth (sub1 (note-depth)))))))
|
||||
|
||||
|
@ -270,8 +332,8 @@
|
|||
[(rdquo) "\U201D"]
|
||||
[(lsquo) "\U2018"]
|
||||
[(rsquo) "\U2019"]
|
||||
[(lang) ">"]
|
||||
[(rang) "<"]
|
||||
[(lang) "<"]
|
||||
[(rang) ">"]
|
||||
[(rarr) "->"]
|
||||
[(nbsp) "\uA0"]
|
||||
[(prime) "'"]
|
||||
|
@ -280,10 +342,17 @@
|
|||
[else (error 'markdown-render "unknown element symbol: ~e"
|
||||
i)]))]
|
||||
[(string? i)
|
||||
(let* ([i (if (in-code?)
|
||||
(regexp-replace** i '([#rx"``" . "\U201C"]
|
||||
[#rx"''" . "\U201D"]))
|
||||
(regexp-replace* #px"([#_*`\\[\\(\\]\\)]{1})" i "\\\\\\1"))]
|
||||
(let* ([i (cond
|
||||
[(in-code?)
|
||||
(regexp-replace** i '([#rx"``" . "\U201C"]
|
||||
[#rx"''" . "\U201D"]))]
|
||||
[(or (in-link?)
|
||||
(regexp-match? #rx"^[(]" i)
|
||||
(regexp-match? #rx"[]][(]" i))
|
||||
(regexp-replace* #px"([#_*`\\[\\(\\]\\)]{1})" i "\\\\\\1")]
|
||||
[else
|
||||
;; Avoid escaping parentheses
|
||||
(regexp-replace* #px"([#_*`\\[\\]]{1})" i "\\\\\\1")])]
|
||||
[i (if (preserving-spaces?)
|
||||
(regexp-replace* #rx" " i "\uA0")
|
||||
i)])
|
||||
|
@ -291,6 +360,26 @@
|
|||
[else (write i)])
|
||||
null)
|
||||
|
||||
(define/override (table-of-contents part ri)
|
||||
(define t (super table-of-contents part ri))
|
||||
(cond
|
||||
[(current-markdown-link-sections)
|
||||
;; Table generated by `table-of-contents` always has one
|
||||
;; column, and each row has one paragraph that starts
|
||||
;; with a 'hspace element to indent
|
||||
(nested-flow
|
||||
(style 'table-of-contents null)
|
||||
(for/list ([p (map car (table-blockss t))])
|
||||
(define c (paragraph-content p))
|
||||
(define keep-c (cdr c))
|
||||
(define (spaces->depth n)
|
||||
(add1 (quotient (- n 4) 2)))
|
||||
(for/fold ([p (paragraph plain keep-c)]) ([s (in-range
|
||||
(spaces->depth
|
||||
(string-length (car (element-content (car c))))))])
|
||||
(nested-flow (style "refcontent" null) (list p)))))]
|
||||
[else t]))
|
||||
|
||||
(super-new)))
|
||||
|
||||
(define (regexp-replace** str ptns&reps)
|
||||
|
@ -298,4 +387,3 @@
|
|||
([ptn (map car ptns&reps)]
|
||||
[rep (map cdr ptns&reps)])
|
||||
(regexp-replace* ptn str rep)))
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
(prefix-in latex: "latex-render.rkt"))
|
||||
|
||||
(provide render-mixin
|
||||
dvi-render-mixin)
|
||||
dvi-render-mixin
|
||||
xelatex-render-mixin)
|
||||
|
||||
(define render-mixin
|
||||
(make-indirect-renderer-mixin
|
||||
|
@ -15,3 +16,8 @@
|
|||
(make-indirect-renderer-mixin
|
||||
(λ (%) (latex:render-mixin % #:image-mode 'ps)) #".tex" #".pdf"
|
||||
run-dvipdf-latex))
|
||||
|
||||
(define xelatex-render-mixin
|
||||
(make-indirect-renderer-mixin
|
||||
(λ (%) (latex:render-mixin % #:image-mode 'pdf)) #".tex" #".pdf"
|
||||
run-xelatex))
|
||||
|
|
19
scribble-lib/scribble/private/lang-parameters.rkt
Normal file
19
scribble-lib/scribble/private/lang-parameters.rkt
Normal file
|
@ -0,0 +1,19 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide (all-defined-out))
|
||||
|
||||
;; Some latex formats have different requirements on how
|
||||
;; figures, citations, etc. are displayed. This allows different
|
||||
;; scribble langs to handle them.
|
||||
|
||||
;; `Figure` string that appears in front of a figure caption
|
||||
(define default-figure-label-text (make-parameter "Figure"))
|
||||
|
||||
;; Seperator string between figure counter and caption
|
||||
(define default-figure-label-sep (make-parameter ": "))
|
||||
|
||||
;; Style for the figure caption
|
||||
(define default-figure-caption-style (make-parameter #f))
|
||||
|
||||
;; Style for the number in the figure counter
|
||||
(define default-figure-counter-style (make-parameter #f))
|
62
scribble-lib/scribble/private/latex-index.rkt
Normal file
62
scribble-lib/scribble/private/latex-index.rkt
Normal file
|
@ -0,0 +1,62 @@
|
|||
#lang racket/base
|
||||
(require "../core.rkt"
|
||||
"../html-properties.rkt")
|
||||
|
||||
(provide same-index-entry?
|
||||
extract-index-link-targets)
|
||||
|
||||
(define (same-index-entry? a-blocks b-blocks)
|
||||
(and (= (length a-blocks) (length b-blocks))
|
||||
;; We expect an index entry to have a single paragraph, but
|
||||
;; allow a list:
|
||||
(for/and ([a (in-list a-blocks)]
|
||||
[b (in-list b-blocks)])
|
||||
(and (paragraph? a)
|
||||
(paragraph? b)
|
||||
;; Compare paragraph content, paying attention to style,
|
||||
;; but not paying attention to link targets:
|
||||
(let loop ([a (paragraph-content a)]
|
||||
[b (paragraph-content b)])
|
||||
(cond
|
||||
[(equal? a b) #t]
|
||||
[(alpha-anchor-content a) => (lambda (a) (loop a b))]
|
||||
[(alpha-anchor-content b) => (lambda (b) (loop a b))]
|
||||
[(and (pair? a) (pair? b))
|
||||
(and (loop (car a) (car b))
|
||||
(loop (cdr a) (cdr b)))]
|
||||
[(and (element? a)
|
||||
(element? b))
|
||||
(and (equal? (element-content a)
|
||||
(element-content b))
|
||||
(equal? (element-style a)
|
||||
(element-style b)))]
|
||||
[else #f]))))))
|
||||
|
||||
(define (alpha-anchor-content e)
|
||||
(and (element? e)
|
||||
(let ([s (element-style e)])
|
||||
(and s
|
||||
(style? s)
|
||||
(not (style-name s))
|
||||
(= 1 (length (style-properties s)))
|
||||
(url-anchor? (car (style-properties s)))))
|
||||
(let ([c (element-content e)])
|
||||
(cond
|
||||
[(and (pair? c) (null? (cdr c))) (car c)]
|
||||
[else c]))))
|
||||
|
||||
(define (extract-index-link-targets blockss)
|
||||
(apply
|
||||
append
|
||||
(for*/list ([blocks (in-list blockss)]
|
||||
[b (in-list blocks)])
|
||||
(cond
|
||||
[(paragraph? b)
|
||||
(let content-loop ([c (paragraph-content b)])
|
||||
(cond
|
||||
[(null? c) null]
|
||||
[(pair? c) (append (content-loop (car c))
|
||||
(content-loop (cdr c)))]
|
||||
[(link-element? c) (list c)]
|
||||
[else null]))]
|
||||
[else null]))))
|
|
@ -17,7 +17,8 @@
|
|||
(#:is-book? boolean? #:author (or/c false/c pre-content?)
|
||||
#:location (or/c false/c pre-content?)
|
||||
#:date (or/c false/c pre-content?)
|
||||
#:url (or/c false/c pre-content?))
|
||||
#:url (or/c false/c pre-content?)
|
||||
#:note (or/c false/c pre-content?))
|
||||
. ->* .
|
||||
a-bib-entry?)]
|
||||
[rename a-bib-entry? bib-entry? (any/c . -> . boolean?)]
|
||||
|
@ -46,7 +47,8 @@
|
|||
#:author [author #f]
|
||||
#:location [location #f]
|
||||
#:date [date #f]
|
||||
#:url [url #f])
|
||||
#:url [url #f]
|
||||
#:note [note #f])
|
||||
(make-a-bib-entry
|
||||
key
|
||||
(make-element
|
||||
|
@ -63,7 +65,8 @@
|
|||
`(" " ,@(decode-content (list location)) ,(if date "," "."))
|
||||
null)
|
||||
(if date `(" " ,@(decode-content (list date)) ".") null)
|
||||
(if url `(" " ,(link url (tt url))) null)))))
|
||||
(if url `(" " ,(link url (tt url))) null)
|
||||
(if note (decode-content (list note)) null)))))
|
||||
|
||||
(define-on-demand bib-style (make-style "RBibliography" scheme-properties))
|
||||
|
||||
|
|
|
@ -114,7 +114,15 @@
|
|||
(let ([ns-id
|
||||
(let ([ns (make-base-empty-namespace)])
|
||||
(parameterize ([current-namespace ns])
|
||||
(namespace-require `(for-label ,lib))
|
||||
;; A `(namespace-require `(for-label ,lib))` can
|
||||
;; fail if `lib` provides different bindings of the
|
||||
;; same name at different phases. We can require phases
|
||||
;; 1 and 0 separately, in which case the phase-0
|
||||
;; binding shadows the phase-1 one in that case.
|
||||
;; This strategy only works for documenting bindings
|
||||
;; at phases 0 and 1, though.
|
||||
(namespace-require `(just-meta 1 (for-label ,lib)))
|
||||
(namespace-require `(just-meta 0 (for-label ,lib)))
|
||||
(namespace-syntax-introduce (datum->syntax #f 'x))))])
|
||||
(let ([checker
|
||||
(lambda (id)
|
||||
|
|
|
@ -425,26 +425,32 @@
|
|||
[name1 (car (syntax->list #'(name ...)))])
|
||||
(with-syntax ([(extra ...)
|
||||
(let ([finality
|
||||
(lambda ()
|
||||
(lambda (prefix)
|
||||
(case (syntax-e #'mode)
|
||||
[(override-final public-final extend-final)
|
||||
#'(" This method is final, so it cannot be overiddden.")]
|
||||
#`(#,prefix "This method is final, so it cannot be overridden.")]
|
||||
[(augment-final)
|
||||
#'(" This method is final, so it cannot be augmented.")]
|
||||
#`(#,prefix "This method is final, so it cannot be augmented.")]
|
||||
[else null]))])
|
||||
(case (syntax-e #'mode)
|
||||
[(pubment)
|
||||
#'((t "Refine this method with "
|
||||
(racket augment) "."))]
|
||||
[(override override-final extend augment)
|
||||
#`((t (case (syntax-e #'mode)
|
||||
[(override override-final) "Overrides "]
|
||||
[(extend extend-final) "Extends "]
|
||||
[(augment augment-final) "Augments "])
|
||||
[(override
|
||||
override-final
|
||||
extend
|
||||
extend-final
|
||||
augment
|
||||
augment-final)
|
||||
#`((t #,(case (syntax-e #'mode)
|
||||
[(override override-final) "Overrides "]
|
||||
[(extend extend-final) "Extends "]
|
||||
[(augment augment-final) "Augments "])
|
||||
(*xmethod/super (quote-syntax/loc cname) 'name1)
|
||||
"."
|
||||
#,@(finality)))]
|
||||
[else null]))])
|
||||
#,@(finality " ")))]
|
||||
[(public public-final) #`((t #,@(finality "")))]
|
||||
[else (raise-syntax-error #f "unrecognized mode" #'mode)]))])
|
||||
#'(make-meth '(name ...)
|
||||
'mode
|
||||
(lambda ()
|
||||
|
|
|
@ -124,7 +124,9 @@
|
|||
(loop (if (dont-stop? mode)
|
||||
(dont-stop-val mode)
|
||||
mode))))))]
|
||||
[program-source 'prog]
|
||||
;; use a source that both identifies the original code
|
||||
;; and is unique wrt eq? as used below
|
||||
[program-source (or context bstr)]
|
||||
[e (parameterize ([read-accept-reader #t])
|
||||
((or expand
|
||||
(lambda (stx)
|
||||
|
|
|
@ -95,13 +95,14 @@
|
|||
(if (and (identifier? spec)
|
||||
(free-identifier=? spec #'defined-id))
|
||||
(datum->syntax #'here '(unsyntax x) spec spec)
|
||||
(syntax-case spec ()
|
||||
[(a . b)
|
||||
(datum->syntax spec
|
||||
(cons (loop #'a) (loop #'b))
|
||||
spec
|
||||
spec)]
|
||||
[_ spec]))))])
|
||||
(cond
|
||||
[(syntax? spec) (datum->syntax spec
|
||||
(loop (syntax-e spec))
|
||||
spec
|
||||
spec)]
|
||||
[(pair? spec) (cons (loop (car spec))
|
||||
(loop (cdr spec)))]
|
||||
[else spec]))))])
|
||||
#'(with-togetherable-racket-variables
|
||||
(l.lit ...)
|
||||
([form [defined-id spec]] [form [defined-id spec1]] ...
|
||||
|
|
|
@ -49,8 +49,7 @@
|
|||
(define vers (history-entry-vers e))
|
||||
(list (if (zero? i)
|
||||
null
|
||||
(list null ; needed to avoid " " dropped as whitespace
|
||||
" "))
|
||||
(list (linebreak)))
|
||||
(history-entry-what e)
|
||||
" in version "
|
||||
vers
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
setup/main-collects
|
||||
pkg/path
|
||||
racket/list
|
||||
scribble/html-properties
|
||||
(for-syntax scheme/base
|
||||
syntax/parse)
|
||||
(for-label scheme/base))
|
||||
|
@ -201,6 +202,21 @@
|
|||
(list pkg)
|
||||
null)))
|
||||
|
||||
;; mflatt thinks this should not be exposed
|
||||
(define (racketpkgname pkg)
|
||||
(link
|
||||
;; XXX Look at (pkg-info-orig-pkg (hash-ref (read-pkgs-db scope)
|
||||
;; pkg)) and only show link if catalog? Or did mflatt have
|
||||
;; something else in mind? But I'd have to know the scope and pass
|
||||
;; that down from compute-packages
|
||||
(format "https://pkgs.racket-lang.org/package/~a" pkg)
|
||||
(tt pkg)
|
||||
#:style (make-style #f
|
||||
(list "plainlink"
|
||||
(hover-property
|
||||
(format "Install this package using `raco pkg install ~a`"
|
||||
pkg))))))
|
||||
|
||||
(define (*defmodule names modpaths module-path packages link-target? lang content req)
|
||||
(let ([modpaths (or modpaths names)])
|
||||
(define pkg-spec
|
||||
|
@ -218,33 +234,40 @@
|
|||
""
|
||||
"s")))
|
||||
" "
|
||||
(add-between (map tt pkgs) ", "))))))))))
|
||||
(add-between (map racketpkgname pkgs)
|
||||
", "))))))))))
|
||||
(define (flow-width f) (apply max (map block-width f)))
|
||||
(define libs-specs
|
||||
;; make-desc : element -> flow
|
||||
;; index-desc : module-path-index-desc
|
||||
(let-values ([(make-desc index-desc)
|
||||
(case lang
|
||||
[(#f)
|
||||
(values (lambda (modname) (list (racket (#,req #,modname))))
|
||||
the-module-path-index-desc)]
|
||||
[(#t)
|
||||
(values (lambda (modname) (list (hash-lang) spacer modname))
|
||||
the-language-index-desc)]
|
||||
[(reader)
|
||||
(values (lambda (modname) (list (racketmetafont "#reader") spacer modname))
|
||||
the-reader-index-desc)]
|
||||
[(just-lang)
|
||||
(values (lambda (modname) (list (hash-lang) spacer modname))
|
||||
the-language-index-desc)]
|
||||
[else (error 'defmodule "unknown mode: ~e" lang)])])
|
||||
(map
|
||||
(lambda (name modpath)
|
||||
(define modname (if link-target?
|
||||
(make-defracketmodname name modpath)
|
||||
(make-defracketmodname name modpath index-desc)
|
||||
name))
|
||||
(list
|
||||
(make-flow
|
||||
(list
|
||||
(make-omitable-paragraph
|
||||
(cons
|
||||
spacer
|
||||
(case lang
|
||||
[(#f)
|
||||
(list (racket (#,req #,modname)))]
|
||||
[(#t)
|
||||
(list (hash-lang) spacer modname)]
|
||||
[(reader)
|
||||
(list (racketmetafont "#reader") spacer modname)]
|
||||
[(just-lang)
|
||||
(list (hash-lang) spacer modname)]
|
||||
[else (error 'defmodule "unknown mode: ~e" lang)])))))
|
||||
(cons spacer (make-desc modname)))))
|
||||
'cont))
|
||||
names
|
||||
modpaths))
|
||||
modpaths)))
|
||||
|
||||
(make-splice
|
||||
(cons
|
||||
|
@ -278,8 +301,10 @@
|
|||
(flow-paragraphs (decode-flow content)))))))
|
||||
|
||||
(define the-module-path-index-desc (make-module-path-index-desc))
|
||||
(define the-language-index-desc (make-language-index-desc))
|
||||
(define the-reader-index-desc (make-reader-index-desc))
|
||||
|
||||
(define (make-defracketmodname mn mp)
|
||||
(define (make-defracketmodname mn mp index-desc)
|
||||
(let ([name-str (datum-intern-literal (element->string mn))]
|
||||
[path-str (datum-intern-literal (element->string mp))])
|
||||
(make-index-element #f
|
||||
|
@ -287,7 +312,7 @@
|
|||
(intern-taglet `(mod-path ,path-str))
|
||||
(list name-str)
|
||||
(list mn)
|
||||
the-module-path-index-desc)))
|
||||
index-desc)))
|
||||
|
||||
(define-syntax (declare-exporting stx)
|
||||
(syntax-parse stx
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
"../basic.rkt"
|
||||
"../manual-struct.rkt"
|
||||
(only-in "../core.rkt"
|
||||
make-style make-table-columns)
|
||||
make-style
|
||||
make-table-columns
|
||||
content?)
|
||||
"../html-properties.rkt"
|
||||
"qsloc.rkt"
|
||||
"manual-utils.rkt"
|
||||
|
@ -17,6 +19,7 @@
|
|||
"on-demand.rkt"
|
||||
scheme/string
|
||||
scheme/list
|
||||
racket/contract
|
||||
(for-syntax racket/base
|
||||
syntax/parse)
|
||||
(for-label racket/base
|
||||
|
@ -40,7 +43,7 @@
|
|||
(case n [(1) "("] [(0) ""] [(2) "(("] [else (make-string n #\()])))
|
||||
(define (make-closers n)
|
||||
(racketparenfont
|
||||
(case n [(1) ")"] [(0) ""] [(2) "))"] [else (make-string n #\()])))
|
||||
(case n [(1) ")"] [(0) ""] [(2) "))"] [else (make-string n #\))])))
|
||||
|
||||
(define-syntax (arg-contract stx)
|
||||
(syntax-case stx (... ...+ _...superclass-args...)
|
||||
|
@ -126,10 +129,12 @@
|
|||
[(_ v) #'(racketblock0 v)]))
|
||||
|
||||
(begin-for-syntax
|
||||
(define-splicing-syntax-class kind-kw
|
||||
#:description "#:kind keyword"
|
||||
(pattern (~optional (~seq #:kind kind)
|
||||
#:defaults ([kind #'#f]))))
|
||||
(define-splicing-syntax-class kind-kw
|
||||
#:attributes (kind) ;; Expr[String/#f]
|
||||
#:description "#:kind keyword"
|
||||
(pattern (~optional (~seq #:kind k))
|
||||
#:declare k (expr/c #'(or/c content? #f) #:name "#:kind argument")
|
||||
#:with kind #'(~? k.c #f)))
|
||||
|
||||
(define-splicing-syntax-class value-kw
|
||||
#:description "#:value keyword"
|
||||
|
@ -207,13 +212,13 @@
|
|||
(list (result-value value.value) ...)))))]))
|
||||
|
||||
(define-struct arg
|
||||
(special? kw id optional? starts-optional? ends-optional? num-closers))
|
||||
(special? kw id optional? starts-optional? ends-optional? depth))
|
||||
|
||||
(define (*defproc kind link? mode within-id
|
||||
stx-ids sym prototypes arg-contractss arg-valss result-contracts content-thunk
|
||||
[result-values (map (lambda (x) #f) result-contracts)])
|
||||
(define max-proto-width (current-display-width))
|
||||
(define ((arg->elem show-opt-start?) arg)
|
||||
(define ((arg->elem show-opt-start?) arg next-depth)
|
||||
(let* ([e (cond [(not (arg-special? arg))
|
||||
(if (arg-kw arg)
|
||||
(if (eq? mode 'new)
|
||||
|
@ -233,14 +238,15 @@
|
|||
[(eq? (arg-id arg) '_...superclass-args...) (to-element (arg-id arg))]
|
||||
[else (to-element (make-var-id (arg-id arg)))])]
|
||||
[e (if (arg-ends-optional? arg)
|
||||
(make-element #f (list e "]"))
|
||||
(make-element #f (list e (racketoptionalfont "]")))
|
||||
e)]
|
||||
[e (if (zero? (arg-num-closers arg))
|
||||
[num-closers (- (arg-depth arg) next-depth)]
|
||||
[e (if (zero? num-closers)
|
||||
e
|
||||
(make-element
|
||||
#f (list e (make-closers (arg-num-closers arg)))))])
|
||||
#f (list e (make-closers num-closers))))])
|
||||
(if (and show-opt-start? (arg-starts-optional? arg))
|
||||
(make-element #f (list "[" e))
|
||||
(make-element #f (list (racketoptionalfont "[") e))
|
||||
e)))
|
||||
(define (prototype-depth p)
|
||||
(let loop ([p (car p)])
|
||||
|
@ -258,21 +264,23 @@
|
|||
(not next-optional?)
|
||||
(not next-special-dots?)))
|
||||
depth)))
|
||||
(let loop ([p p] [last-depth 0])
|
||||
(let loop ([p p] [depth 0])
|
||||
(define head
|
||||
(if (symbol? (car p))
|
||||
null
|
||||
(loop (car p) (add1 depth))))
|
||||
(append
|
||||
(if (symbol? (car p))
|
||||
null
|
||||
(loop (car p) (add1 last-depth)))
|
||||
(let loop ([p (cdr p)][in-optional? #f])
|
||||
head
|
||||
(let loop ([p (cdr p)] [in-optional? #f])
|
||||
(cond
|
||||
[(null? p) null]
|
||||
[(null? (cdr p))
|
||||
(list (parse-arg (car p) in-optional? last-depth #f #f))]
|
||||
(list (parse-arg (car p) in-optional? depth #f #f))]
|
||||
[else
|
||||
(let ([a (parse-arg
|
||||
(car p)
|
||||
in-optional?
|
||||
0
|
||||
depth
|
||||
(let ([v (cadr p)])
|
||||
(and (pair? v)
|
||||
(not
|
||||
|
@ -282,6 +290,10 @@
|
|||
(cons a (loop (cdr p)
|
||||
(and (arg-optional? a)
|
||||
(not (arg-ends-optional? a))))))])))))
|
||||
(define (next-args-depth args)
|
||||
(if (null? args)
|
||||
0
|
||||
(arg-depth (car args))))
|
||||
(define (prototype-size args first-combine next-combine special-combine?)
|
||||
(let loop ([s args] [combine first-combine])
|
||||
(if (null? s)
|
||||
|
@ -289,7 +301,7 @@
|
|||
(combine
|
||||
(loop (cdr s) next-combine)
|
||||
(let ([a (car s)])
|
||||
(+ (arg-num-closers a)
|
||||
(+ (- (arg-depth a) (next-args-depth (cdr s)))
|
||||
(if (arg-special? a)
|
||||
(string-length (symbol->string (arg-id a)))
|
||||
(+ (if (arg-kw a)
|
||||
|
@ -468,11 +480,19 @@
|
|||
#f
|
||||
`(,(make-openers (add1 p-depth))
|
||||
,tagged
|
||||
,(let ([num-closers (- p-depth (next-args-depth args))])
|
||||
(if (zero? num-closers)
|
||||
'()
|
||||
(make-closers num-closers)))
|
||||
,@(if (null? args)
|
||||
(list (make-closers p-depth))
|
||||
(append-map (lambda (arg)
|
||||
(list spacer ((arg->elem #t) arg)))
|
||||
args))
|
||||
(let loop ([args args])
|
||||
(cond
|
||||
[(null? args) null]
|
||||
[else
|
||||
(append
|
||||
(list spacer ((arg->elem #t) (car args) (next-args-depth (cdr args))))
|
||||
(loop (cdr args)))])))
|
||||
,(racketparenfont ")"))))
|
||||
(if result-next-line? null end))))
|
||||
;; The multi-line case:
|
||||
|
@ -496,9 +516,9 @@
|
|||
(if one-ok?
|
||||
(list*
|
||||
(if (arg-starts-optional? (car args))
|
||||
(to-flow (make-element #f (list spacer "[")))
|
||||
(to-flow (make-element #f (list spacer (racketoptionalfont "["))))
|
||||
flow-spacer)
|
||||
(to-flow ((arg->elem #f) (car args)))
|
||||
(to-flow ((arg->elem #f) (car args) (next-args-depth (cdr args))))
|
||||
not-end)
|
||||
(list* 'cont 'cont not-end)))
|
||||
(let loop ([args (if one-ok? (cdr args) args)])
|
||||
|
@ -515,14 +535,15 @@
|
|||
(flow-spacer/n 3)
|
||||
flow-spacer)
|
||||
(if (arg-starts-optional? (car args))
|
||||
(to-flow (make-element #f (list spacer "[")))
|
||||
(to-flow (make-element #f (list spacer (racketoptionalfont "["))))
|
||||
flow-spacer)
|
||||
(let ([a ((arg->elem #f) (car args))]
|
||||
(let ([a ((arg->elem #f) (car args) (next-args-depth (cdr args)))]
|
||||
[next (if dots-next?
|
||||
(make-element
|
||||
#f (list spacer
|
||||
((arg->elem #f)
|
||||
(cadr args))))
|
||||
(cadr args)
|
||||
(next-args-depth (cddr args)))))
|
||||
"")])
|
||||
(to-flow
|
||||
(cond
|
||||
|
@ -857,17 +878,16 @@
|
|||
(short-width . < . max-proto-width))]
|
||||
[split-field-line?
|
||||
;; start fields on the line after "struct"?
|
||||
(max-proto-width . < . (+ 8
|
||||
(if (pair? name)
|
||||
(+ (sym-length (car name))
|
||||
1
|
||||
(sym-length (cadr name)))
|
||||
(sym-length name))
|
||||
1
|
||||
(if (pair? fields)
|
||||
(sym-length (field-name (car fields)))
|
||||
0)
|
||||
1))])
|
||||
(and (pair? fields)
|
||||
(max-proto-width . < . (+ 8
|
||||
(if (pair? name)
|
||||
(+ (sym-length (car name))
|
||||
1
|
||||
(sym-length (cadr name)))
|
||||
(sym-length name))
|
||||
1
|
||||
(sym-length (field-name (car fields)))
|
||||
1)))])
|
||||
(make-table
|
||||
#f
|
||||
;; First four columns: "(struct" <space> <name><space> (
|
||||
|
@ -1040,12 +1060,13 @@
|
|||
#'(with-togetherable-racket-variables
|
||||
()
|
||||
()
|
||||
(*defthing kind.kind
|
||||
lt.expr
|
||||
(list (or id-expr (quote-syntax/loc id))) (list 'id) #f
|
||||
(list (racketblock0 result))
|
||||
(lambda () (list desc ...))
|
||||
(list (result-value value.value))))]))
|
||||
(let ([id-val id-expr])
|
||||
(*defthing kind.kind
|
||||
lt.expr
|
||||
(list (or id-val (quote-syntax/loc id))) (list (if (identifier? id-val) (syntax-e id-val) 'id)) #f
|
||||
(list (racketblock0 result))
|
||||
(lambda () (list desc ...))
|
||||
(list (result-value value.value)))))]))
|
||||
|
||||
(define-syntax (defthing* stx)
|
||||
(syntax-parse stx
|
||||
|
|
|
@ -92,16 +92,17 @@
|
|||
[(_ #:file filename #:escape unsyntax-id lang rest ...)
|
||||
(with-syntax ([modtag (datum->syntax
|
||||
#'here
|
||||
`(unsyntax (make-element
|
||||
#f
|
||||
(list (hash-lang)
|
||||
spacer
|
||||
,(if (identifier? #'lang)
|
||||
`(as-modname-link
|
||||
',#'lang
|
||||
(to-element ',#'lang)
|
||||
#f)
|
||||
#'(racket lang)))))
|
||||
(list #'unsyntax-id
|
||||
`(make-element
|
||||
#f
|
||||
(list (hash-lang)
|
||||
spacer
|
||||
,(if (identifier? #'lang)
|
||||
`(as-modname-link
|
||||
',#'lang
|
||||
(to-element ',#'lang)
|
||||
#f)
|
||||
#'(racket lang)))))
|
||||
#'lang)])
|
||||
(if (syntax-e #'filename)
|
||||
(quasisyntax/loc stx
|
||||
|
@ -121,6 +122,8 @@
|
|||
(make-element result-color (list (to-element/no-color s))))
|
||||
(define (to-element/id s)
|
||||
(make-element symbol-color (list (to-element/no-color s))))
|
||||
(define (to-element/no-escapes s)
|
||||
(to-element s #:escapes? #f))
|
||||
|
||||
(define-syntax (keep-s-expr stx)
|
||||
(syntax-case stx (quote)
|
||||
|
@ -159,7 +162,7 @@
|
|||
(define-code RACKET to-element UNSYNTAX keep-s-expr add-sq-prop)
|
||||
(define-code racketresult to-element/result unsyntax keep-s-expr add-sq-prop)
|
||||
(define-code racketid to-element/id unsyntax keep-s-expr add-sq-prop)
|
||||
(define-code *racketmodname to-element unsyntax keep-s-expr add-sq-prop)
|
||||
(define-code *racketmodname to-element/no-escapes unsyntax keep-s-expr add-sq-prop)
|
||||
|
||||
(define-syntax (**racketmodname stx)
|
||||
(syntax-case stx ()
|
||||
|
@ -244,12 +247,16 @@
|
|||
|
||||
(define-for-syntax (strip-ellipsis-context a)
|
||||
(define a-ellipsis (datum->syntax a '...))
|
||||
(define a-ellipsis+ (datum->syntax a '...+))
|
||||
(let loop ([a a])
|
||||
(cond
|
||||
[(identifier? a)
|
||||
(if (free-identifier=? a a-ellipsis #f)
|
||||
(datum->syntax #f '... a a)
|
||||
a)]
|
||||
(cond
|
||||
[(free-identifier=? a a-ellipsis #f)
|
||||
(datum->syntax #f '... a a)]
|
||||
[(free-identifier=? a a-ellipsis+ #f)
|
||||
(datum->syntax #f '...+ a a)]
|
||||
[else a])]
|
||||
[(syntax? a)
|
||||
(datum->syntax a (loop (syntax-e a)) a a)]
|
||||
[(pair? a)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"../base.rkt"
|
||||
(only-in "../basic.rkt" aux-elem itemize)
|
||||
"../scheme.rkt"
|
||||
(only-in "../core.rkt" make-style plain
|
||||
(only-in "../core.rkt" content? make-style plain
|
||||
make-nested-flow nested-flow? box-mode box-mode*
|
||||
[element? core:element?])
|
||||
"manual-utils.rkt"
|
||||
|
@ -30,8 +30,8 @@
|
|||
(provide/contract [id styling-f/c] ...))
|
||||
(provide-styling racketmodfont racketoutput
|
||||
racketerror racketfont racketplainfont racketvalfont racketidfont racketvarfont
|
||||
racketcommentfont racketparenfont racketkeywordfont racketmetafont
|
||||
onscreen defterm filepath exec envvar Flag DFlag PFlag DPFlag math
|
||||
racketcommentfont racketparenfont racketoptionalfont racketkeywordfont racketmetafont
|
||||
onscreen defterm filepath envvar Flag DFlag PFlag DPFlag math
|
||||
procedure
|
||||
indexed-file indexed-envvar idefterm pidefterm)
|
||||
(provide
|
||||
|
@ -47,6 +47,7 @@
|
|||
[racketidfont schemeidfont]
|
||||
[racketvarfont schemevarfont]
|
||||
[racketparenfont schemeparenfont]
|
||||
[racketoptionalfont schemeoptionalfont]
|
||||
[racketkeywordfont schemekeywordfont]
|
||||
[racketmetafont schememetafont])
|
||||
|
||||
|
@ -59,7 +60,8 @@
|
|||
[inset-flow (() () #:rest (listof pre-content?) . ->* . nested-flow?)]
|
||||
[litchar (() () #:rest (listof string?) . ->* . element?)]
|
||||
[t (() () #:rest (listof pre-content?) . ->* . paragraph?)]
|
||||
[commandline (() () #:rest (listof pre-content?) . ->* . paragraph?)]
|
||||
[exec (() () #:rest (listof content?) . ->* . element?)]
|
||||
[commandline (() () #:rest (listof content?) . ->* . paragraph?)]
|
||||
[menuitem (string? string? . -> . element?)])
|
||||
|
||||
(define PLaneT (make-element "planetName" '("PLaneT")))
|
||||
|
@ -103,6 +105,8 @@
|
|||
(make-element variable-color (decode-content str)))
|
||||
(define (racketparenfont . str)
|
||||
(make-element paren-color (decode-content str)))
|
||||
(define (racketoptionalfont . str)
|
||||
(make-element opt-color (decode-content str)))
|
||||
(define (racketmetafont . str)
|
||||
(make-element meta-color (decode-content str)))
|
||||
(define (racketcommentfont . str)
|
||||
|
|
|
@ -2,16 +2,22 @@
|
|||
|
||||
(require scheme/system scheme/port)
|
||||
|
||||
(provide run-pdflatex run-dvipdf-latex)
|
||||
(provide run-pdflatex run-dvipdf-latex run-xelatex)
|
||||
|
||||
(define (run-pdflatex file [notify void]) (run file notify #f))
|
||||
(define (run-pdflatex file [notify void]) (run file notify 'pdflatex))
|
||||
(define (run-dvipdf-latex file [notify void])
|
||||
(parameterize ([function-name 'run-dvipdf-latex])
|
||||
(run file notify #t)))
|
||||
(run file notify 'dvipdf)))
|
||||
(define (run-xelatex file [notify void])
|
||||
(parameterize ([function-name 'run-xelatex])
|
||||
(run file notify 'xelatex)))
|
||||
|
||||
(define max-runs 5)
|
||||
(define (run file notify via-dvipdf?)
|
||||
(define latex-cmd-name (if via-dvipdf? "latex" "pdflatex"))
|
||||
(define (run file notify type)
|
||||
(define latex-cmd-name (cond [(equal? type 'pdflatex) "pdflatex"]
|
||||
[(equal? type 'dvipdf) "latex"]
|
||||
[(equal? type 'xelatex) "xelatex"]
|
||||
[else (err "unknown run type ~a" type)]))
|
||||
(define cmd
|
||||
(list (get-latex-binary latex-cmd-name)
|
||||
"-interaction=batchmode"
|
||||
|
@ -43,7 +49,7 @@
|
|||
[(zero? n)
|
||||
(notify "WARNING: no \"Rerun\" found in first run of pdflatex for ~a"
|
||||
file)]))
|
||||
(when via-dvipdf?
|
||||
(when (equal? type 'dvipdf)
|
||||
(define dvi-file (path-replace-suffix file #".dvi"))
|
||||
(define ps-file (path-replace-suffix file #".ps"))
|
||||
(unless (file-exists? dvi-file) (err "didn't find .dvi file"))
|
||||
|
|
40
scribble-lib/scribble/private/tag.rkt
Normal file
40
scribble-lib/scribble/private/tag.rkt
Normal file
|
@ -0,0 +1,40 @@
|
|||
#lang scheme/base
|
||||
|
||||
;; It might make sense to make these functions public, but since they weren't originally,
|
||||
;; I am going to keep them in the private folder for now.
|
||||
;; -- With Love, Leif
|
||||
|
||||
(provide (all-defined-out))
|
||||
|
||||
(require racket/list
|
||||
scribble/core
|
||||
"../tag.rkt")
|
||||
|
||||
(define (gen-tag content)
|
||||
(datum-intern-literal
|
||||
;; Generate tag from ASCII plus CJK characters. Constraining to
|
||||
;; ASCII for most purposes helps avoid encoding issues for
|
||||
;; uncooperative environments, but constraining to ASCII is too
|
||||
;; uncooperative in another direction for CJK text (i.e., creates
|
||||
;; too many conflicting tags).
|
||||
(regexp-replace* #px"[^-a-zA-Z0-9_=\u4e00-\u9fff\u3040-\u309F\u30A0-\u30FF]"
|
||||
(content->string content) "_")))
|
||||
|
||||
(define (convert-tag tag content)
|
||||
(if (list? tag)
|
||||
(append-map (lambda (t) (convert-tag t content)) tag)
|
||||
`((part ,(or tag (gen-tag content))))))
|
||||
|
||||
(define (convert-part-style who s)
|
||||
(cond
|
||||
[(style? s) s]
|
||||
[(not s) plain]
|
||||
[(string? s) (make-style s null)]
|
||||
[(symbol? s) (make-style #f (list s))]
|
||||
[(and (list? s) (andmap symbol? s)) (make-style #f s)]
|
||||
[else (raise-argument-error who "(or/c style? string? symbol? (listof symbol?) #f)" s)]))
|
||||
|
||||
(define (prefix->string p)
|
||||
(and p (if (string? p)
|
||||
(datum-intern-literal p)
|
||||
(module-path-prefix->string p))))
|
|
@ -70,6 +70,7 @@
|
|||
|
||||
.RktOpt {
|
||||
color: black;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.RktKw {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,10 @@
|
|||
% Redefine \SColorize to produce B&W Scheme text
|
||||
\newcommand{\SColorize}[2]{\color{#1}{#2}}
|
||||
|
||||
\newcommand{\inColor}[2]{{\Scribtexttt{\SColorize{#1}{#2}}}}
|
||||
% Redefine SHyphen to allow identifiers to be hyphenated
|
||||
\newcommand{\SHyphen}[1]{#1}
|
||||
|
||||
\newcommand{\inColor}[2]{{\SHyphen{\Scribtexttt{\SColorize{#1}{#2}}}}}
|
||||
\definecolor{PaleBlue}{rgb}{0.90,0.90,1.0}
|
||||
\definecolor{LightGray}{rgb}{0.90,0.90,0.90}
|
||||
\definecolor{CommentColor}{rgb}{0.76,0.45,0.12}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
(and (eof-object? (read i)) v)))))
|
||||
|
||||
(define (run)
|
||||
(define doc-binding 'doc)
|
||||
(command-line
|
||||
#:program (short-program+command-name)
|
||||
#:once-any
|
||||
|
@ -66,6 +67,9 @@
|
|||
[("--pdf") "generate PDF-format output (via PDFLaTeX)"
|
||||
(current-html #f)
|
||||
(current-render-mixin pdf:render-mixin)]
|
||||
[("--xelatex") "generate PDF-format output (via XeLaTeX)"
|
||||
(current-html #f)
|
||||
(current-render-mixin pdf:xelatex-render-mixin)]
|
||||
[("--dvipdf") "generate PDF-format output (via LaTeX, dvips, and pstopdf)"
|
||||
(current-html #f)
|
||||
(current-render-mixin pdf:dvi-render-mixin)]
|
||||
|
@ -102,6 +106,8 @@
|
|||
(current-style-file file)]
|
||||
[("--prefix") file "use given .html/.tex prefix (for doctype/documentclass)"
|
||||
(current-prefix-file file)]
|
||||
[("--link-section") "support section links for markdown"
|
||||
(markdown:current-markdown-link-sections #t)]
|
||||
#:multi
|
||||
[("++extra") file "add given file"
|
||||
(current-extra-files (cons file (current-extra-files)))]
|
||||
|
@ -136,15 +142,19 @@
|
|||
#:once-each
|
||||
[("--quiet") "suppress output-file and undefined-tag reporting"
|
||||
(current-quiet #t)]
|
||||
[("--doc-binding") id
|
||||
"render document provided as <id> instead of `doc`"
|
||||
(set! doc-binding (string->symbol id))]
|
||||
#:args (file . another-file)
|
||||
(let ([files (cons file another-file)])
|
||||
(parameterize ([current-command-line-arguments
|
||||
(list->vector (reverse (doc-command-line-arguments)))])
|
||||
(build-docs (map (lambda (file)
|
||||
;; Try `doc' submodule, first:
|
||||
(if (module-declared? `(submod (file ,file) doc) #t)
|
||||
(dynamic-require `(submod (file ,file) doc) 'doc)
|
||||
(dynamic-require `(file ,file) 'doc)))
|
||||
(if (module-declared? `(submod (file ,file) ,doc-binding) #t)
|
||||
(dynamic-require `(submod (file ,file) ,doc-binding)
|
||||
doc-binding)
|
||||
(dynamic-require `(file ,file) doc-binding)))
|
||||
files)
|
||||
files)))))
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ function NormalizePath(path) {
|
|||
|
||||
function DoSearchKey(event, field, ver, top_path) {
|
||||
var val = field.value;
|
||||
if (event && event.keyCode == 13) {
|
||||
if (event && event.key === 'Enter') {
|
||||
var u = GetCookie("PLT_Root."+ver, null);
|
||||
if (u == null) u = top_path; // default: go to the top path
|
||||
u += "search/index.html?q=" + encodeURIComponent(val);
|
||||
|
@ -168,3 +168,15 @@ AddOnLoad(function(){
|
|||
indicator.innerHTML = label;
|
||||
indicator.style.display = "block";
|
||||
});
|
||||
|
||||
// Pressing "S" or "s" focuses on the "...search manuals..." text field
|
||||
AddOnLoad(function(){
|
||||
window.addEventListener("keyup", function(e) {
|
||||
if ((e.key === 's' || e.key === 'S') && e.target === document.body) {
|
||||
var searchBox = document.getElementById('searchbox');
|
||||
if (searchBox) {
|
||||
searchBox.focus();
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
});
|
||||
|
|
|
@ -3,11 +3,23 @@
|
|||
\newcommand{\packageHyperref}{\usepackage{hyperref}}
|
||||
\newcommand{\renewrmdefault}{\renewcommand{\rmdefault}{ptm}}
|
||||
\newcommand{\packageRelsize}{\usepackage{relsize}}
|
||||
% amsmath is required for the combination of {mathabx,
|
||||
% wasysym, newtxmath} to work. Otherwise, newtxmath
|
||||
% would load amsmath *after* mathabx and wasysym,
|
||||
% causing command redefinition issues.
|
||||
\newcommand{\packageAmsmath}{\usepackage{amsmath}}
|
||||
\newcommand{\packageMathabx}{\usepackage{mathabx}}
|
||||
% Avoid conflicts between "mathabx" and "wasysym":
|
||||
% Avoid conflicts between "mathabx" and "wasysym",
|
||||
% and between "wasysym" integrals and "amsmath" integrals (iint).
|
||||
\newcommand{\packageWasysym}{
|
||||
\let\leftmoon\relax \let\rightmoon\relax \let\fullmoon\relax \let\newmoon\relax \let\diameter\relax
|
||||
\usepackage{wasysym}}
|
||||
\usepackage[nointegrals]{wasysym}}
|
||||
% Both newtxmath and mathabx define the \widering command.
|
||||
% The only reason we choose the newtxmath version is that
|
||||
% acmart.cls is also using the one from newtxmath.
|
||||
\newcommand{\packageTxfonts}{
|
||||
\let\widering\relax
|
||||
\usepackage{newtxmath}}
|
||||
\newcommand{\packageTextcomp}{\usepackage{textcomp}}
|
||||
\newcommand{\packageFramed}{\usepackage{framed}}
|
||||
\newcommand{\packageHyphenat}{\usepackage[htt]{hyphenat}}
|
||||
|
@ -15,4 +27,3 @@
|
|||
\newcommand{\doHypersetup}{\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}}
|
||||
\newcommand{\packageTocstyle}{\IfFileExists{tocstyle.sty}{\usepackage{tocstyle}\usetocstyle{standard}}{}}
|
||||
\newcommand{\packageCJK}{\IfFileExists{CJK.sty}{\usepackage{CJK}}{}}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user