assign authors to manuals

svn: r11287

original commit: 9453aaaccf2f0007bae450c291e1cd29a7a14696
This commit is contained in:
Matthew Flatt 2008-08-15 20:16:06 +00:00
parent 7c83877190
commit d3a86d35e5
5 changed files with 73 additions and 8 deletions

View File

@ -79,6 +79,31 @@
;; ---------------------------------------- ;; ----------------------------------------
(provide author
author+email)
(define (author . auths)
(make-styled-paragraph
(let ([nl (make-element 'newline '("\n"))])
(case (length auths)
[(1) auths]
[(2) (list (car auths) nl "and " (cadr auths))]
[else (let ([r (reverse auths)])
(append (add-between (reverse (cdr r))
(make-element #f (list "," nl)))
(list "," nl "and " (car r))))]))
"author"))
(define (author+email name email)
(make-element #f
(list
name
" <"
(regexp-replace* #rx"[.]"
(regexp-replace* #rx"@" email " at ")
" dot ")
">")))
;; ----------------------------------------
(provide intern-taglet (provide intern-taglet
module-path-index->taglet module-path-index->taglet
module-path-prefix->string) module-path-prefix->string)

View File

@ -36,6 +36,13 @@
(copy-port (current-input-port) (current-output-port)))) (copy-port (current-input-port) (current-output-port))))
(printf "\\begin{document}\n\\preDoc\n") (printf "\\begin{document}\n\\preDoc\n")
(when (part-title-content d) (when (part-title-content d)
(let ([m (ormap (lambda (v)
(and (styled-paragraph? v)
(equal? "author" (styled-paragraph-style v))
v))
(flow-paragraphs (part-flow d)))])
(when m
(do-render-paragraph m d ri #t)))
(printf "\\titleAndVersion{") (printf "\\titleAndVersion{")
(render-content (part-title-content d) d ri) (render-content (part-title-content d) d ri)
(printf "}{~a}\n" (printf "}{~a}\n"
@ -78,7 +85,9 @@
null)) null))
(define/override (render-paragraph p part ri) (define/override (render-paragraph p part ri)
(printf "\n\n") (do-render-paragraph p part ri #f))
(define/private (do-render-paragraph p part ri author?)
(let ([style (and (styled-paragraph? p) (let ([style (and (styled-paragraph? p)
(let ([s (flatten-style (let ([s (flatten-style
(styled-paragraph-style p))]) (styled-paragraph-style p))])
@ -91,13 +100,16 @@
base)) base))
base)) base))
s)))]) s)))])
(unless (and (not author?)
(equal? style "author"))
(printf "\n\n")
(when (string? style) (when (string? style)
(printf "\\~a{" style)) (printf "\\~a{" style))
(if (toc-paragraph? p) (if (toc-paragraph? p)
(printf "\\newpage \\tableofcontents \\newpage") (printf "\\newpage \\tableofcontents \\newpage")
(super render-paragraph p part ri)) (super render-paragraph p part ri))
(when (string? style) (printf "}"))) (when (string? style) (printf "}"))
(printf "\n\n") (printf "\n\n")))
null) null)
(define/override (render-element e part ri) (define/override (render-element e part ri)

View File

@ -491,3 +491,17 @@ i {
.noborder img { .noborder img {
border: 0; border: 0;
} }
.author {
position: relative;
float: right;
left: 2em;
top: -3em;
height: 0em;
width: 23em; /* very wide to keep author names on separate lines */
margin: 0em -23em 0em 0em;
font-size: 82%;
}
.author:before {
content: "by ";
}

View File

@ -127,6 +127,18 @@ Returns @scheme[#t] if @scheme[v] is an item produced by
visible to the enclosing context). Since this form expands to visible to the enclosing context). Since this form expands to
@scheme[require], it must be used in a module or top-level context.} @scheme[require], it must be used in a module or top-level context.}
@defproc[(author [author any/c] ...) block?]{
Generates a @scheme[styled-paragraph] to show the author(s) of a
document, where each author is represented by an
@tech{element}. Normally, this function is used after @scheme[title]
for the beginning of a document. See also @scheme[author+email].}
@defproc[(author+email [author elem] [email string?]) element?]{
Combines an author name with an e-mail address, obscuring the e-mail
address slightly to avoid address-harvesting robots.}
@defproc[(module-path-prefix->string [mod-path module-path?]) @defproc[(module-path-prefix->string [mod-path module-path?])
string?]{ string?]{

View File

@ -5,6 +5,8 @@
@title{@bold{Scribble}: PLT Documentation Tool} @title{@bold{Scribble}: PLT Documentation Tool}
@author["Matthew Flatt" "Eli Barzilay"]
Scribble is a collection of tools for creating prose documents, Scribble is a collection of tools for creating prose documents,
especially those that document libraries, and especially for HTML and especially those that document libraries, and especially for HTML and
PDF (via LaTeX) output. More generally, it is useful for cases where PDF (via LaTeX) output. More generally, it is useful for cases where