#lang scribble/doc @(require scribble/manual "utils.rkt" "struct-hierarchy.rkt" (for-label scribble/manual-struct file/convertible setup/main-collects scriblib/render-cond)) @title[#:tag "core"]{Structures And Processing} @defmodule[scribble/core] A document is represented as a @techlink{part}, as described in @secref["parts"]. This representation is intended to be independent of its eventual rendering, and it is intended to be immutable; rendering extensions and specific data in a document can collude arbitrarily, however. A document is processed in four passes: @itemlist[ @item{The @deftech{traverse pass} traverses the document content in document order so that information from one part of a document can be communicated to other parts of the same document. The information is transmitted through a symbol-keyed mapping that can be inspected and extended by @racket[traverse-element]s and @racket[traverse-block]s in the document. The @tech{traverse pass} iterates the traversal until it obtains a fixed point (i.e., the mapping from one iteration is unchanged from the previous iteration).} @item{The @deftech{collect pass} globally collects information in the document that can span documents that are built at separate times, such as targets for hyperlinking.} @item{The @deftech{resolve pass} matches hyperlink references with targets and expands delayed elements (where the expansion should not contribute new hyperlink targets).} @item{The @deftech{render pass} generates the result document.} ] None of the passes mutate the document representation. Instead, the @tech{traverse pass}, @tech{collect pass}, and @tech{resolve pass} accumulate information in a side hash table, @racket[collect-info] table, and @racket[resolve-info] table. The @tech{collect pass} and @tech{resolve pass} are effectively specialized version of @tech{traverse pass} that work across separately built documents. @; ------------------------------------------------------------------------ @section[#:tag "parts"]{Parts, Flows, Blocks, and Paragraphs} This diagram shows the large-scale structure of the type hierarchy for Scribble documents. A box represents a struct or a built-in Racket type; for example @racket[part] is a struct. The bottom portion of a box shows the fields; for example @racket[part] has three fields, @racket[title], @racket[blocks], and @racket[subparts]. The substruct relationship is shown vertically with navy blue lines connected by a triangle; for example, a @racket[compound-paragraph] is a @racket[block]. The types of values on fields are shown via dark red lines in the diagram. Doubled lines represent lists and tripled lines represent lists of lists; for example, the @racket[blocks] field of @racket[compound-paragraph] is a list of @racket[blocks]. Dotted lists represent functions that compute elements of a given field; for example, the @racket[block] field of a @racket[traverse-block] struct is a function that computes a @racket[block]. The diagram is not completely accurate: a @racket[table] may have @racket['cont] in place of a block in its @racket[cells] field, and the types of fields are only shown if they are other structs in the diagram. A prose description with more detail follows the diagram. @(mk-diagram) A @deftech{part} is an instance of @racket[part]; among other things, it has a title @techlink{content}, an initial @techlink{flow}, and a list of subsection @techlink{parts}. There is no difference between a part and a full document; a particular source module just as easily defines a subsection (incorporated via @racket[include-section]) as a document. A @deftech{flow} is a list of @techlink{blocks}. A @deftech{block} is either a @techlink{table}, an @techlink{itemization}, a @techlink{nested flow}, a @techlink{paragraph}, a @techlink{compound paragraph}, a @techlink{traverse block}, or a @techlink{delayed block}. @itemize[ @item{A @deftech{table} is an instance of @racket[table]; it has a list of list of @techlink{blocks} corresponding to table cells.} @item{A @deftech{itemization} is an instance of @racket[itemization]; it has a list of @techlink{flows}.} @item{A @deftech{nested flow} is an instance of @racket[nested-flow]; it has a @tech{flow} that is typeset as sub-flow.} @item{A @deftech{paragraph} is an instance of @racket[paragraph]; it has a @tech{content}: @itemize[ @item{An @deftech{content} can be a string, one of a few symbols, 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{delayed element}, or a list of content. @itemize[ @item{A string is included in the result document verbatim, except for space, and unless the content's enclosing @tech{style} is @racket['hspace]. In a style other than @racket['hspace], consecutive spaces in the 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 across lines.} @item{A symbol content is either @racket['mdash], @racket['ndash], @racket['ldquo], @racket['lsquo], @racket['rsquo], @racket['larr], @racket['rarr], or @racket['prime]; it is rendered as the corresponding HTML entity (even for Latex output).} @item{An instance of @racket[element] has a @techlink{content} plus a @tech{style}. The style's interpretation depends on the renderer, but it can be one of a few special symbols (such as @racket['bold]) that are recognized by all renderers.} @item{An instance of @racket[link-element] has a @techlink{tag} for the target of the link.} @item{An instance of @racket[target-element] has a @techlink{tag} to be referenced by @racket[link-element]s. An instance of the subtype @racket[toc-target-element] is treated like a kind of section label, to be shown in the ``on this page'' table for HTML output.} @item{An instance of @racket[index-element] has a @techlink{tag} (as a target), a list of strings for the keywords (for sorting and search), and a list of @techlink{contents} to appear in the end-of-document index.} @item{An instance of @racket[image-element] incorporates an image from a file into the rendered document.} @item{An instance of @racket[multiarg-element] combines a style with a list of content, where the style corresponds to a rendered command that takes multiple arguments.} @item{An instance of @racket[collect-element] has a procedure that is called in the @techlink{collect pass} of document processing to record information used by later passes.} @item{A @deftech{traverse element} is an instance of @racket[traverse-element], which ultimately produces content, but can accumulate and inspect information in the @tech{traverse pass}.} @item{A @deftech{part-relative element} is an instance of @racket[part-relative-element], which has a procedure that is called in the @techlink{collect pass} of document processing to obtain @defterm{content}. When the part-relative element's procedure is called, collected information is not yet available, but information about the enclosing parts is available.} @item{A @deftech{delayed element} is an instance of @racket[delayed-element], which has a procedure that is called in the @techlink{resolve pass} of document processing to obtain @defterm{content}.} @item{An instance of @racket[render-element] has a procedure that is called in the @techlink{render pass} of document processing.} ]}]} @item{A @deftech{compound paragraph} is an instance of @racket[compound-paragraph]; like @racket[blockquote], it has list of @tech{blocks}, but the blocks are typeset as a single paragraph (e.g., no indentation after the first block) instead of inset.} @item{A @deftech{traverse block} is an instance of @racket[traverse-block], which ultimately produces another block, but can accumulate and inspect information during the @tech{traverse pass}.} @item{A @deftech{delayed block} is an instance of @racket[delayed-block], which has a procedure that is called in the @techlink{resolve pass} of document processing to obtain a @defterm{block}.} ] @; ------------------------------------------------------------------------ @section[#:tag "tags"]{Tags} A @deftech{tag} is a list containing a symbol and either a string, a @racket[generated-tag] instance, or an arbitrary list. The symbol effectively identifies the type of the tag, such as @racket['part] for a tag that links to a part, or @racket['def] for a Racket function definition. The symbol also effectively determines the interpretation of the second half of the tag. A part can have a @deftech{tag prefix}, which is effectively added onto the second item within each tag whose first item is @racket['part] or @racket['tech]. The prefix is added to a string value by creating a list containing the prefix and string, and it is added to a list value using @racket[cons]; a prefix is not added to a @racket[generated-tag] instance. The prefix is used for reference outside the part, including the use of tags in the part's @racket[tags] field. Typically, a document's main part has a tag prefix that applies to the whole document; references to sections and defined terms within the document from other documents must include the prefix, while references within the same document omit the prefix. Part prefixes can be used within a document as well, to help disambiguate references within the document. Some procedures accept a ``tag'' that is just the string part of the full tag, where the symbol part is supplied automatically. For example, @racket[section] and @racket[secref] both accept a string ``tag'', where @racket['part] is implicit. @; ------------------------------------------------------------------------ @section[#:tag "style"]{Styles} A @deftech{style} combines a @tech{style name} with a list of @tech{style properties} in a @racket[style] structure. A @deftech{style name} is either a string, symbol, of @racket[#f]. A @deftech{style property} can be anything, including a symbol a structure such as @racket[color-property]. A style has a single @tech{style name}, because the name typically corresponds to a configurable instruction to a renderer. For example, with Latex output, a string style name corresponds to a Latex command or environment. For more information on how string style names interact with configuration of a renderer, see @secref["config"]. Symbolic style names, meanwhile, provide a simple layer of abstraction between the renderer and documents for widely supported style; for example, the @racket['italic] style name is supported by all renderers. @tech{Style properties} within a style compose with style names and other properties. Again, symbols are often used for properties that are directly supported by renderers. For example, @racket['unnumbered] style property for a @tech{part} renders the part without a section number. Many properties are renderer-specific, such as a @racket[hover-property] structure that associates text with an element to be shown in an HTML display when the mouse hovers over the text. @; ------------------------------------------------------------------------ @section[#:tag "passes"]{Collected and Resolved Information} The @techlink{collect pass}, @techlink{resolve pass}, and @techlink{render pass} processing steps all produce information that is specific to a rendering mode. Concretely, the operations are all represented as methods on a @racket[render<%>] object. The result of the @method[render<%> collect] method is a @racket[collect-info] instance. This result is provided back as an argument to the @method[render<%> resolve] method, which produces a @racket[resolve-info] value that encapsulates the results from both iterations. The @racket[resolve-info] value is provided back to the @method[render<%> resolve] method for final rendering. Optionally, before the @method[render<%> resolve] method is called, serialized information from other documents can be folded into the @racket[collect-info] instance via the @method[render<%> deserialize-info] method. Other methods provide serialized information out of the collected and resolved records. During the @techlink{collect pass}, the procedure associated with a @racket[collect-element] instance can register information with @racket[collect-put!]. During the @techlink{resolve pass}, collected information for a part can be extracted with @racket[part-collected-info], which includes a part's number and its parent part (or @racket[#f]). More generally, the @racket[resolve-get] method looks up information previously collected. This resolve-time information is normally obtained by the procedure associated with a @techlink{delayed block} or @techlink{delayed element}. The @racket[resolve-get] information accepts both a @racket[part] and a @racket[resolve-info] argument. The @racket[part] argument enables searching for information in each enclosing part before sibling parts. @; ------------------------------------------------------------------------ @section{Structure Reference} @defstruct[part ([tag-prefix (or/c false/c string?)] [tags (listof tag?)] [title-content (or/c false/c list?)] [style style?] [to-collect list?] [blocks (listof block?)] [parts (listof part?)])]{ The @racket[tag-prefix] field determines the optional @techlink{tag prefix} for the part. The @racket[tags] indicates a list of @techlink{tags} that each link to the section. Normally, @racket[tags] should be a non-empty list, so that hyperlinks can target the section. The @racket[title-content] field holds the part's title, if any. For the @racket[style] field, the currently recognized symbolic style names are as follows: @itemize[ @item{@racket['index] --- The part represents an index.} ] The recognized @tech{style properties} are as follows: @itemize[ @item{@racket['unnumbered] --- A section number is computed for an unnumbered section during the @techlink{collect pass}, but the number is not rendered.} @item{@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 @emph{not} rendered on separate pages for multi-page HTML mode; this style applies only to the main part.} @item{@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['hidden] --- The part title is not shown in rendered HTML output, and the part title is not shown in Latex output if it is empty. The @racket['toc-hidden] style usually should be included with @racket['hidden].} @item{@racket['toc-hidden] --- The part title is not shown in tables of contents, including in ``on this page'' boxes.} @item{@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 style for the main part of a document, 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] links (and that only includes an ``on this page'' label for multi-page documents) takes on the location and color of the main table of contents, instead.} @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 minimum, a non-@racket[""] version is rendered when it is attached to a part representing the whole document. The default version for a document is @racket[(version)].} @item{@racket[document-date] structure --- A date for the part, normally used on a document's main part for for Latex output. The default date for a document is @racket[#f], which avoids explicitly specifying a date at the Latex level, so that the current date is used as the document date. Set the date to @racket[""] to suppress a date in an output document.} @item{@racket[body-id] structure --- Generated HTML uses the given string @tt{id} attribute of the @tt{body} tag; this style can 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 @tt{id} for any document that it builds.} ] The @racket[to-collect] field contains @techlink{content} that is inspected during the @techlink{collect pass}, but ignored in later passes (i.e., it doesn't directly contribute to the output). The @racket[blocks] field contains the part's initial flow (before sub-parts). The @racket[parts] field contains sub-parts. } @defstruct[paragraph ([style style?] [content content?])]{ A @techlink{paragraph} has a @tech{style} and a @tech{content}. For the @racket[style] field, a string @tech{style name} corresponds to a CSS class for HTML output or a macro for Latex output (see @secref["extra-style"]). The following symbolic @tech{style names} are recognized: @itemize[ @item{@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 enclosing part.} @item{@racket['wraps] --- Like a @racket[#f] style name, but not @tech{boxable} in the sense of @racket[box-mode] for Latex output.} ] When a paragraph's style is @racket[#f], then it is @tech{boxable} in the sense of @racket[box-mode] for Latex output. The currently recognized @tech{style properties} are as follows: @itemize[ @item{@racket['omitable] --- When a table cell contains a single @racket[paragraph] with the @racket['omitable] style property, then when rendering to HTML, no @tt{
} tag wraps the cell content.} @item{@racket['div] --- Generates @tt{
} (unless a @racket[alt-tag] property is provided).} @item{@racket[alt-tag] structure --- Generates the indicated HTML tag instead of @tt{
} or @tt{
}, @tt{
}, @tt{
} tag or as a Latex command name. The following symbols are recognized as cell-@tech{style properties}: @itemize[ @item{@racket['left] --- Left-align the cell content.} @item{@racket['right] --- Right-align the cell content top baselines.} @item{@racket['center] --- Center the cell content horizontally.} @item{@racket['top] --- Top-align the cell content.} @item{@racket['baseline] --- Align the cell content top baselines.} @item{@racket['bottom] --- bottom-align the cell content.} @item{@racket['vcenter] --- Center the cell content vertically.} ] In addition, for HTML output, @racket[attributes] structures as @tech{style properties} can add arbitrary attributes to a cell's @tt{ | } tag.}
@defstruct[table-columns ([styles (listof style?)])]{
Like @racket[table-cells], but with support for a
@racket[column-attributes] property in each style, and the
@racket[styles] list is otherwise duplicated for each row in the
table. The non-@racket[column-attributes] parts of a
@racket[table-columns] are used only when a @racket[table-cells] property is
not present along with the @racket[table-columns] property.
For HTML table rendering, for each column that has a
@racket[column-attributes] property in the corresponding element of
@racket[styles], the attributes are put into an HTML @tt{col} tag
within the table.}
@deftogether[(
@defstruct[box-mode ([top-name string?]
[center-name string?]
[bottom-name string?])]
@defproc[(box-mode* [name string?]) box-mode?]
)]{
As a @tech{style property}, indicates that a @tech{nested flow} or
@tech{paragraph} is @deftech{boxable} when it is used in a
@deftech{boxing context} for Latex output, but a @tech{nested flow} is
@tech{boxable} only if its content is also @tech{boxable}.
A @tech{boxing context} starts with a table cell in a multi-column
table, and the content of a @tech{block} in a @tech{boxing context} is
also in a @tech{boxing context}. If the cell's content is
@tech{boxable}, then the content determines the width of the cell,
otherwise a width is imposed. A @tech{paragraph} with a @racket[#f]
@tech{style name} is @tech{boxable} as a single line; the
@racket['wraps] @tech{style name} makes the paragraph
non-@tech{boxable} so that its width is imposed and its content can
use multiple lines. A @tech{table} is @tech{boxable} when that all of
its cell content is boxable.
To generate output in box mode, the @racket[box-mode] property
supplies Latex macro names to apply to the @tech{nested flow} or
@tech{paragraph} content. The @racket[top-name] macro is used if the
box's top line is to be aligned with other boxes, @racket[center-name]
if the box's center is to be aligned, and @racket[bottom-name] if the
box's bottom line is to be aligned. The @racket[box-mode*] function
creates a @racket[box-mode] structure with the same name for all three
fields.
A @racket[box-mode] @tech{style property} overrides any automatic
boxed rendering (e.g., for a @tech{paragraph} with @tech{style name}
@racket[#f]). If a @tech{block} has both a @racket[box-mode]
@tech{style property} and a @racket['multicommand] @tech{style
property}, then the Latex macro @racket[top-name],
@racket[center-name], or @racket[bottom-name] is applied with a
separate argument for each of its content.}
@defproc[(block? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is a @racket[paragraph],
@racket[table], @racket[itemization], @racket[nested-flow],
@racket[traverse-block], or @racket[delayed-block], @racket[#f]
otherwise.}
@defproc[(content? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is a string, symbol,
@racket[element], @racket[multiarg-element],
@racket[traverse-element], @racket[delayed-element],
@racket[part-relative-element], a convertible value in
the sense of @racket[convertible?], or list of @tech{content}.
Otherwise, it returns @racket[#f].}
@defstruct[style ([name (or/c string? symbol? #f)]
[properties list?])]{
Represents a @techlink{style}.}
@defthing[plain style?]{
A style @racket[(make-style #f null)].}
@defproc[(element-style? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is a string, symbol, @racket[#f],
or @racket[style] structure.}
@defproc[(tag? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is acceptable as a link
@techlink{tag}, which is a list containing a symbol and either a
string, a @racket[generated-tag] instance, or a list (of arbitrary
values).}
@defstruct[generated-tag ()]{
A placeholder for a tag to be generated during the @techlink{collect
pass}. Use @racket[tag-key] to convert a tag containing a
@racket[generated-tag] instance to one containing a string.
}
@defproc*[([(content->string (content content?)) string?]
[(content->string (content content?) (renderer any/c) (p part?) (info resolve-info?)) string?])]{
Converts @tech{content} to a single string (essentially
rendering the content as ``plain text'').
If @racket[p] and @racket[info] arguments are not supplied, then a
pre-``collect'' substitute is obtained for @tech{delayed
elements}. Otherwise, the two arguments are used to force the
@tech{delayed element} (if it has not been forced already).}
@defproc[(content-width [c content?]) exact-nonnegative-integer?]{
Returns the width in characters of the given @tech{content}.
}
@defproc[(block-width (e block?)) exact-nonnegative-integer?]{
Returns the width in characters of the given @tech{block}.}
@defstruct[collect-info ([ht any/c] [ext-ht any/c] [parts any/c]
[tags any/c] [gen-prefix any/c]
[relatives any/c]
[parents (listof part?)])]{
Encapsulates information accumulated (or being accumulated) from the
@techlink{collect pass}. The fields are exposed, but not currently
intended for external use, except that @racket[collect-info-parents]
is intended for external use.
}
@defstruct[resolve-info ([ci any/c] [delays any/c] [undef any/c])]{
Encapsulates information accumulated (or being accumulated) from the
@techlink{resolve pass}. The fields are exposed, but not currently
intended for external use.
}
@defproc[(info-key? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is an @deftech{info key}: a list of
at least two elements whose first element is a symbol. The result is
@racket[#f] otherwise.
For a list that is an info tag, the interpretation of the second
element of the list is effectively determined by the leading symbol,
which classifies the key. However, a @racket[#f] value as the second
element has an extra meaning: collected information mapped by such
info keys is not propagated out of the part where it is collected;
that is, the information is available within the part and its
sub-parts, but not in ancestor or sibling parts.
Note that every @techlink{tag} is an info key.
}
@defproc[(collect-put! [ci collect-info?] [key info-key?] [val any/c])
void?]{
Registers information in @racket[ci]. This procedure should be called
only during the @techlink{collect pass}.
}
@defproc[(resolve-get [p (or/c part? false/c)] [ri resolve-info?] [key info-key?])
any/c]{
Extract information during the @techlink{resolve pass} or
@techlink{render pass} for @racket[p] from @racket[ri], where the
information was previously registered during the @techlink{collect
pass}. See also @secref["passes"].
The result is @racket[#f] if the no value for the given key is found.
Furthermore, the search failure is recorded for potential consistency
reporting, such as when @exec{racket setup} is used to build
documentation.
}
@defproc[(resolve-get/ext? [p (or/c part? false/c)] [ri resolve-info?] [key info-key?])
(values any/c boolean?)]{
Like @racket[render-get], but returns a second value to indicate
whether the resulting information originated from an external source
(i.e., a different document).}
@defproc[(resolve-search [dep-key any/c] [p (or/c part? false/c)] [ri resolve-info?] [key info-key?])
void?]{
Like @racket[resolve-get], but a shared @racket[dep-key] groups
multiple searches as a single request for the purposes of consistency
reporting and dependency tracking. That is, a single success for the
same @racket[dep-key] means that all of the failed attempts for the
same @racket[dep-key] have been satisfied. However, for dependency
checking, such as when using @exec{racket setup} to re-build
documentation, all attempts are recorded (in case external changes
mean that an earlier attempt would succeed next time).
}
@defproc[(resolve-get/tentative [p (or/c part? false/c)] [ri resolve-info?] [key info-key?])
any/c]{
Like @racket[resolve-search], but without dependency tracking. For
multi-document settings where dependencies are normally tracked, such
as when using @exec{racket setup} to build documentation, this function
is suitable for use only for information within a single document.
}
@defproc[(resolve-get-keys [p (or/c part? false/c)]
[ri resolve-info?]
[pred (info-key? . -> . any/c)])
list?]{
Applies @racket[pred] to each key mapped for @racket[p] in
@racket[ri], returning a list of all keys for which @racket[pred]
returns a true value.
}
@defproc[(part-collected-info [p part?]
[ri resolve-info?])
collected-info?]{
Returns the information collected for @racket[p] as recorded within
@racket[ri].
}
@defproc[(tag-key [t tag?] [ri resolve-info?]) tag?]{
Converts a @racket[generated-tag] value with @racket[t] to a string.
}
@defproc[(traverse-block-block [b traverse-block?]
[i (or/c resolve-info? collect-info?)])
block?]{
Produces the block that replaces @racket[b].}
@defproc[(traverse-element-content [e traverse-element?]
[i (or/c resolve-info? collect-info?)])
content?]{
Produces the content that replaces @racket[e].}
@defthing[block-traverse-procedure/c contract?]{
Defined as
@racketblock[
(recursive-contract
((symbol? any/c . -> . any/c)
(symbol? any/c . -> . any)
. -> . (or/c block-traverse-procedure/c
block?)))
]}
@defthing[element-traverse-procedure/c contract?]{
Defined as
@racketblock[
(recursive-contract
((symbol? any/c . -> . any/c)
(symbol? any/c . -> . any)
. -> . (or/c element-traverse-procedure/c
content?)))
]}
@; ----------------------------------------
@section{HTML Style Properties}
@defmodule[scribble/html-properties]{ The
@racket[scribble/html-properties] library provides datatypes used as
@tech{style properties} for HTML rendering.}
@defstruct[attributes ([assoc (listof (cons/c symbol? string?))])]{
Used as a @tech{style property} to add arbitrary attributes to an HTML
tag.}
@defstruct[alt-tag ([name (and/c string? #rx"^[a-zA-Z0-9]+$")])]{
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{}, @tt{ }, @tt{div}, @|etc|).} @defstruct[column-attributes ([assoc (listof (cons/c symbol? string?))])]{ Used as a @tech{style property} on a style with @racket[table-columns] to add arbitrary attributes to an HTML @tt{col} tag within the table.} @defstruct[url-anchor ([name string?])]{ Used as a @tech{style property} with @racket[element] to insert an anchor before the element.} @defstruct[hover-property ([text string?])]{ Used as a @tech{style property} with @racket[element] to add text that is shown when the mouse hovers over the element.} @defstruct[script-property ([type string?] [script (or/c path-string? (listof string?))])]{ Used as a @tech{style property} with @racket[element] to supply a script alternative to the element content.} @defstruct[css-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])]{ Used as a @tech{style property} to supply a CSS file (if @racket[path] is a path, string, or list) 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. The @racket[path] field can be a result of @racket[path->main-collects-relative].} @defstruct[body-id ([value string?])]{ Used as a @tech{style property} to associate an @tt{id} attribute with an HTML tag.} @defstruct[html-defaults ([prefix (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?))))])]{ Like @racket[latex-defaults], but use for the @exec{scribble} command-line tool's @DFlag{html} and @DFlag{htmls} modes.} @; ---------------------------------------- @section{Latex Style Properties} @defmodule[scribble/latex-properties]{ The @racket[scribble/latex-properties] library provides datatypes used as @tech{style properties} for Latex rendering.} @defstruct[tex-addition ([path (or/c path-string? (cons/c 'collects (listof bytes?)) bytes?)])]{ Used as a @tech{style property} to supply a @filepath{.tex} file (if @racket[path] is a path, string, or list) or content (if @racket[path] is a byte string) to be included in the generated Latex. This property 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 @racket[path->main-collects-relative].} @defstruct[latex-defaults ([prefix (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?))))])]{ 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} 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 be a result of @racket[path->main-collects-relative]. Languages (used with @hash-lang[]) like @racketmodname[scribble/manual] and @racketmodname[scribble/sigplan] add this property to a document to specify appropriate files for Latex rendering.} @defstruct[latex-auto-extra-files ([paths (listof (or/c path-string? (cons/c 'collects (listof bytes?))))])]{ Used as a @tech{style property} for the main @racket[part] of a document to supply extra files needed to build the document via the @exec{scribble} command-line tool (for @DFlag{latex} and @DFlag{pdf} mode). Languages (used with @hash-lang[]) like @racketmodname[scribble/sigplan] add this property to a document to specify appropriate extra files.} |