scribble: more control over version formatting

Add "Version" in front of a version name via `.version:before' or
`.versionNoNav:before' and `\SVersionBefore', so that they can
be configured through overriding CSS or Latex macro declarations.

Also, improve the documentation for how the `#:version' argument
of `title' is propagated to a `part' style property.

Closes PR 13227

original commit: a830f77403a1f51de7359c7946b01ef10d401cee
This commit is contained in:
Matthew Flatt 2012-11-02 07:39:33 -06:00
parent b951c48fca
commit 8002d98e5d
5 changed files with 20 additions and 8 deletions

View File

@ -890,7 +890,7 @@
(list (make-element (if (include-navigation?) (list (make-element (if (include-navigation?)
"version" "version"
"versionNoNav") "versionNoNav")
(list "Version: " v))) v))
d d
ri)))))) ri))))))

View File

@ -154,6 +154,10 @@ table td {
font-size: xx-small; /* avoid overlap with author */ font-size: xx-small; /* avoid overlap with author */
} }
.version:before, .versionNoNav:before {
content: "Version ";
}
/* ---------------------------------------- */ /* ---------------------------------------- */
/* Margin notes */ /* Margin notes */

View File

@ -141,12 +141,13 @@
\newenvironment{refcolumnleft}{\begin{refcolumn}}{\end{refcolumn}} \newenvironment{refcolumnleft}{\begin{refcolumn}}{\end{refcolumn}}
% Macros used by `title' and `author': % Macros used by `title' and `author':
\newcommand{\titleAndVersionAndAuthors}[3]{\title{#1\\{\normalsize Version #2}}\author{#3}\maketitle} \newcommand{\titleAndVersionAndAuthors}[3]{\title{#1\\{\normalsize \SVersionBefore{}#2}}\author{#3}\maketitle}
\newcommand{\titleAndVersionAndEmptyAuthors}[3]{\title{#1\\{\normalsize Version #2}}#3\maketitle} \newcommand{\titleAndVersionAndEmptyAuthors}[3]{\title{#1\\{\normalsize \SVersionBefore{}#2}}#3\maketitle}
\newcommand{\titleAndEmptyVersionAndAuthors}[3]{\title{#1}\author{#3}\maketitle} \newcommand{\titleAndEmptyVersionAndAuthors}[3]{\title{#1}\author{#3}\maketitle}
\newcommand{\titleAndEmptyVersionAndEmptyAuthors}[3]{\title{#1}\maketitle} \newcommand{\titleAndEmptyVersionAndEmptyAuthors}[3]{\title{#1}\maketitle}
\newcommand{\SAuthor}[1]{#1} \newcommand{\SAuthor}[1]{#1}
\newcommand{\SAuthorSep}[1]{\qquad} \newcommand{\SAuthorSep}[1]{\qquad}
\newcommand{\SVersionBefore}[1]{Version }
% Useful for some styles, such as sigalternate: % Useful for some styles, such as sigalternate:
\newcommand{\SNumberOfAuthors}[1]{} \newcommand{\SNumberOfAuthors}[1]{}

View File

@ -400,7 +400,12 @@ The recognized @tech{style properties} are as follows:
not @racket[""] may be used when rendering a document; at a not @racket[""] may be used when rendering a document; at a
minimum, a non-@racket[""] version is rendered when it is minimum, a non-@racket[""] version is rendered when it is
attached to a part representing the whole document. The default attached to a part representing the whole document. The default
version for a document is @racket[(version)].} version for a document is @racket[(version)]. In rendered form,
the version is normally prefixed with the word ``Version,'' but
this formatting can be controlled by overriding
@tt{.version:before} and/or @tt{.versionNoNav:before} in CSS
for HTML rendering or by redefining the @tt{\SVersionBefore}
macro for Latex rendering (see @secref["config"]).}
@item{@racket[document-date] structure --- A date for the part, @item{@racket[document-date] structure --- A date for the part,
normally used on a document's main part for for Latex normally used on a document's main part for for Latex

View File

@ -168,18 +168,20 @@ otherwise.}
@defstruct[title-decl ([tag-prefix (or/c #f string?)] @defstruct[title-decl ([tag-prefix (or/c #f string?)]
[tags (listof string?)] [tags (listof string?)]
[version (or/c string? #f)] [version (or/c string? #f)]
[style any/c] [style style?]
[content content?])]{ [content content?])]{
See @racket[decode] and @racket[decode-part]. The @racket[_tag-prefix] See @racket[decode] and @racket[decode-part]. The @racket[tag-prefix]
and @racket[_style] fields are propagated to the resulting and @racketidfont{style} fields are propagated to the resulting
@racket[part]. If the @racketidfont{version} field is not @racket[#f],
it is propagated as a @racket[document-version] style property on the
@racket[part].} @racket[part].}
@defstruct[part-start ([depth integer?] @defstruct[part-start ([depth integer?]
[tag-prefix (or/c #f string?)] [tag-prefix (or/c #f string?)]
[tags (listof string?)] [tags (listof string?)]
[style any/c] [style style?]
[title content?])]{ [title content?])]{
Like @racket[title-decl], but for a sub-part. See @racket[decode] and Like @racket[title-decl], but for a sub-part. See @racket[decode] and