commit d3a86d35e57f748be2c8f300b869555c64584eb1
parent 7c83877190ca7910b400f692b2b9baadc24d25e9
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Fri, 15 Aug 2008 20:16:06 +0000
assign authors to manuals
svn: r11287
original commit: 9453aaaccf2f0007bae450c291e1cd29a7a14696
Diffstat:
5 files changed, 74 insertions(+), 8 deletions(-)
diff --git a/collects/scribble/basic.ss b/collects/scribble/basic.ss
@@ -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
module-path-index->taglet
module-path-prefix->string)
diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss
@@ -36,6 +36,13 @@
(copy-port (current-input-port) (current-output-port))))
(printf "\\begin{document}\n\\preDoc\n")
(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{")
(render-content (part-title-content d) d ri)
(printf "}{~a}\n"
@@ -78,7 +85,9 @@
null))
(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 ([s (flatten-style
(styled-paragraph-style p))])
@@ -91,13 +100,16 @@
base))
base))
s)))])
- (when (string? style)
- (printf "\\~a{" style))
- (if (toc-paragraph? p)
- (printf "\\newpage \\tableofcontents \\newpage")
- (super render-paragraph p part ri))
- (when (string? style) (printf "}")))
- (printf "\n\n")
+ (unless (and (not author?)
+ (equal? style "author"))
+ (printf "\n\n")
+ (when (string? style)
+ (printf "\\~a{" style))
+ (if (toc-paragraph? p)
+ (printf "\\newpage \\tableofcontents \\newpage")
+ (super render-paragraph p part ri))
+ (when (string? style) (printf "}"))
+ (printf "\n\n")))
null)
(define/override (render-element e part ri)
diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css
@@ -491,3 +491,17 @@ i {
.noborder img {
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 ";
+}
+\ No newline at end of file
diff --git a/collects/scribblings/scribble/basic.scrbl b/collects/scribblings/scribble/basic.scrbl
@@ -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
@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?])
string?]{
diff --git a/collects/scribblings/scribble/scribble.scrbl b/collects/scribblings/scribble/scribble.scrbl
@@ -5,6 +5,8 @@
@title{@bold{Scribble}: PLT Documentation Tool}
+@author["Matthew Flatt" "Eli Barzilay"]
+
Scribble is a collection of tools for creating prose documents,
especially those that document libraries, and especially for HTML and
PDF (via LaTeX) output. More generally, it is useful for cases where