scribble/*-properties: allow literal bytes in *-additions
For example, a `tex-addition' structure can have literal bytes to include in the generated Latex, instead of a path to a file that holds the content. original commit: 2b9f57b01d55a39a70f0d0df22bc97b1874727ea
This commit is contained in:
parent
e48b814b17
commit
9650c4767b
|
@ -76,7 +76,7 @@
|
||||||
(unless (stop-at-part? p)
|
(unless (stop-at-part? p)
|
||||||
(loop p #f #f)))
|
(loop p #f #f)))
|
||||||
(part-parts p)))))
|
(part-parts p)))))
|
||||||
(for/list ([k (in-hash-keys ht)]) (main-collects-relative->path k))))
|
(for/list ([k (in-hash-keys ht)]) (if (bytes? k) k (main-collects-relative->path k)))))
|
||||||
|
|
||||||
(define/private (extract-style-style-files s ht pred extract)
|
(define/private (extract-style-style-files s ht pred extract)
|
||||||
(for ([v (in-list (style-properties s))])
|
(for ([v (in-list (style-properties s))])
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[hover-property ([text string?])]
|
[hover-property ([text string?])]
|
||||||
[script-property ([type string?]
|
[script-property ([type string?]
|
||||||
[script (or/c path-string? (listof string?))])]
|
[script (or/c path-string? (listof string?))])]
|
||||||
[css-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)))])]
|
[css-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])]
|
||||||
[html-defaults ([prefix-path (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
[html-defaults ([prefix-path (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
||||||
[style-path (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
[style-path (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
||||||
[extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])]
|
[extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
racket/contract/base)
|
racket/contract/base)
|
||||||
|
|
||||||
(provide-structs
|
(provide-structs
|
||||||
[tex-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)))])]
|
[tex-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])]
|
||||||
[latex-defaults ([prefix (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
[latex-defaults ([prefix (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
||||||
[style (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
[style (or/c bytes? path-string? (cons/c 'collects (listof bytes?)))]
|
||||||
[extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])])
|
[extra-files (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])])
|
||||||
|
|
|
@ -103,7 +103,9 @@
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(copy-port (current-input-port) (current-output-port))))))
|
(copy-port (current-input-port) (current-output-port))))))
|
||||||
(for ([style-file (in-list all-style-files)])
|
(for ([style-file (in-list all-style-files)])
|
||||||
(install-file style-file)))
|
(if (bytes? style-file)
|
||||||
|
(display style-file)
|
||||||
|
(install-file style-file))))
|
||||||
(when whole-doc?
|
(when whole-doc?
|
||||||
(printf "\\begin{document}\n\\preDoc\n")
|
(printf "\\begin{document}\n\\preDoc\n")
|
||||||
(when (part-title-content d)
|
(when (part-title-content d)
|
||||||
|
|
|
@ -1383,11 +1383,14 @@ script alternative to the element content.}
|
||||||
|
|
||||||
|
|
||||||
@defstruct[css-addition ([path (or/c path-string?
|
@defstruct[css-addition ([path (or/c path-string?
|
||||||
(cons/c 'collects (listof bytes?)))])]{
|
(cons/c 'collects (listof bytes?))
|
||||||
|
bytes?)])]{
|
||||||
|
|
||||||
Used as a @tech{style property} to supply a CSS file to be referenced
|
Used as a @tech{style property} to supply a CSS file (if @racket[path]
|
||||||
in the generated HTML. This property can be attached to any style, and
|
is a path, string, or list) or content (if @racket[path] is a byte
|
||||||
all additions are collected to the top of the generated HTML page.
|
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.
|
||||||
|
|
||||||
The @racket[path] field can be a result of
|
The @racket[path] field can be a result of
|
||||||
@racket[path->main-collects-relative].}
|
@racket[path->main-collects-relative].}
|
||||||
|
@ -1421,12 +1424,14 @@ Like @racket[latex-defaults], but use for the
|
||||||
|
|
||||||
|
|
||||||
@defstruct[tex-addition ([path (or/c path-string?
|
@defstruct[tex-addition ([path (or/c path-string?
|
||||||
(cons/c 'collects (listof bytes?)))])]{
|
(cons/c 'collects (listof bytes?))
|
||||||
|
bytes?)])]{
|
||||||
|
|
||||||
Used as a @tech{style property} to supply a @filepath{.tex} file to be
|
Used as a @tech{style property} to supply a @filepath{.tex} file (if
|
||||||
included in the generated Latex. This property can be attached to any
|
@racket[path] is a path, string, or list) or content (if @racket[path]
|
||||||
style, and all additions are collected to the top of the generated
|
is a byte string) to be included in the generated Latex. This property
|
||||||
Latex file.
|
can be attached to any style, and all additions are collected to the
|
||||||
|
top of the generated Latex file.
|
||||||
|
|
||||||
The @racket[path] field can be a result of
|
The @racket[path] field can be a result of
|
||||||
@racket[path->main-collects-relative].}
|
@racket[path->main-collects-relative].}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user