add scribble/jfp

svn: r18507
This commit is contained in:
Matthew Flatt 2010-03-10 22:17:51 +00:00
parent c1640d005f
commit 826fbdf16f
10 changed files with 1274 additions and 2 deletions

66
collects/scribble/jfp.ss Normal file
View File

@ -0,0 +1,66 @@
#lang scheme/base
(require setup/main-collects
scribble/core
(except-in scribble/base author)
scribble/decode
scribble/html-properties
scribble/latex-properties
(for-syntax scheme/base))
(provide abstract include-abstract
author author/short
affiliation affiliation-mark affiliation-sep)
(define jfp-extras
(let ([abs (lambda (s)
(path->main-collects-relative
(build-path (collection-path "scribble") "jfp" s)))])
(list
(make-css-addition (abs "jfp.css"))
(make-tex-addition (abs "jfp.tex")))))
;; ----------------------------------------
;; Abstracts:
(define abstract-style (make-style "abstract" jfp-extras))
(define (abstract . strs)
(make-nested-flow
abstract-style
(decode-flow strs)))
(define (extract-abstract p)
(unless (part? p)
(error 'include-abstract "doc binding is not a part: ~e" p))
(unless (null? (part-parts p))
(error 'include-abstract "abstract part has sub-parts: ~e" (part-parts p)))
(when (part-title-content p)
(error 'include-abstract "abstract part has title content: ~e" (part-title-content p)))
(part-blocks p))
(define-syntax-rule (include-abstract mp)
(begin
(require (only-in mp [doc abstract-doc]))
(make-nested-flow abstract-style (extract-abstract abstract-doc))))
;; ----------------------------------------
;; Author
(define (author . long)
(apply (apply author/short long) long))
(define ((author/short . short) . long)
(make-paragraph
(make-style 'author jfp-extras)
(list
(make-multiarg-element "JFPAuthor" (list (decode-content short)
(decode-content long))))))
(define (affiliation . txt)
(make-element (make-style "Affiliation" jfp-extras) (decode-content txt)))
(define (affiliation-mark . txt)
(make-element (make-style "MarkSuperscript" jfp-extras) (decode-content txt)))
(define (affiliation-sep)
(hspace 2))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
\newcommand{\Affiliation}[1]{\\ #1}
\newcommand{\MarkSuperscript}[1]{$^{#1}$}
\newcommand{\JFPAuthor}[2]{\author[#1]{#2}}

View File

@ -0,0 +1,31 @@
#lang scheme/base
(require scribble/doclang
scribble/core
(except-in scribble/base author)
scribble/decode
scribble/jfp
"../private/defaults.ss"
(for-syntax scheme/base))
(provide (except-out (all-from-out scribble/doclang) #%module-begin)
(all-from-out scribble/jfp)
(all-from-out scribble/base)
(rename-out [module-begin #%module-begin]))
;; No options, currently, but keep in case we want to support some:
(define-syntax (module-begin stx)
(syntax-case* stx () (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
[(_ id ws . body)
;; Skip intraline whitespace to find options:
(and (string? (syntax-e #'ws))
(regexp-match? #rx"^ *$" (syntax-e #'ws)))
#'(module-begin id . body)]
[(_ id . body)
#'(#%module-begin id (post-process) () . body)]))
(define ((post-process) doc)
(add-defaults doc
(string->bytes/utf-8
(format "\\documentclass{jfp}\n\\usepackage{times}\n\\usepackage{qcourier}\n"))
(scribble-file "jfp/style.tex")
(list (scribble-file "jfp/jfp.cls"))
#f))

View File

@ -0,0 +1,15 @@
#lang s-exp syntax/module-reader
scribble/jfp/lang
#:read scribble:read-inside
#:read-syntax scribble:read-syntax-inside
#:whole-body-readers? #t
#:wrapper1 (lambda (t) (cons 'doc (t)))
#:info (lambda (key defval default)
(case key
[(color-lexer)
(dynamic-require 'syntax-color/scribble-lexer 'scribble-inside-lexer)]
[else (default key defval)]))
(require (prefix-in scribble: "../../reader.ss"))

View File

@ -0,0 +1,3 @@
\renewcommand{\titleAndVersionAndAuthors}[3]{\title[#2]{#1}#3\maketitle}
\renewcommand{\titleAndEmptyVersionAndAuthors}[3]{\titleAndVersionAndAuthors{#1}{#1}{#3}}

View File

@ -8,3 +8,5 @@
@include-section["base.scrbl"]
@include-section["manual-stub.scrbl"]
@include-section["sigplan.scrbl"]
@include-section["jfp.scrbl"]

View File

@ -0,0 +1,55 @@
#lang scribble/manual
@(require (except-in "utils.ss" author)
(for-label scribble/jfp))
@(define-syntax-rule (def base-author)
(begin
(require (for-label scribble/base))
(define base-author @scheme[author])))
@(def base-author)
@title{JFP Paper Format}
@defmodulelang[scribble/jfp]{The @schememodname[scribble/jfp]
language is like @schememodname[scribble/manual], but configured with
Latex style defaults to use the @filepath{jfp.cls} class
file that is included with Scribble.}
Latex output with @schememodname[scribble/jfp] uses a main-document
version supplied to @scheme[title] as the short-form document name (to
be used in page headers).
@defproc[(abstract [pre-content pre-content?] ...) block?]{
Generates a @tech{nested flow} for a paper abstract.}
@defform[(include-abstract module-path)]{
Similar to @scheme[include-section], but incorporates the document in the
specified module as an abstract. The document must have no title or
sub-parts.}
@defproc[(author [name pre-content?] ...)
block?]{
A replacement for @base-author from @schememodname[scribble/base].}
@defproc[((author/short [short-name pre-content?] ...) [long-name pre-content?] ...)
block?]{
Like @scheme[author], but allows the short-form names (to be used in
page headers) to be specified separately from the long-form name.}
@deftogether[(
@defproc[(affiliation [place pre-content?] ...) element?]
@defproc[(affiliation-mark [mark pre-content?] ...) element?]
@defproc[(affiliation-sep) element?]
)]{
Use @scheme[affiliation] within @scheme[author] or the long-name part
of @scheme[author/short] to specify affiliations after all authors.
If different authors have different affiliations, use
@scheme[affiliation-mark] with a number after each author, and then
use @scheme[affiliation-mark] before each different affiliation within
a single @scheme[affiliation], using @scheme[(affiliation-sep)] to
separate affiliations.}

View File

@ -26,7 +26,7 @@ Generates a @tech{nested flow} for a paper abstract.}
@defform[(include-abstract module-path)]{
Similar to @scheme[include-path], but incorporates the document in the
Similar to @scheme[include-section], but incorporates the document in the
specified module as an abstract. The document must have no title or
sub-parts.}

View File

@ -118,7 +118,7 @@ coerced to one.
@deftogether[(
@defproc[(make-styled-paragraph [style any/c][content list?]) paragraph?]
@defproc[(make-styled-paragraph [content list?][style any/c]) paragraph?]
@defproc[(styled-paragraph? [v any/c]) boolean?]
@defproc[(styled-paragraph-style [p paragraph?]) style?]
)]{