Add @nocopyright option to scribble/sigplan.
original commit: dba04c8aea07466a9459fd55fd55290e1179ac6a
This commit is contained in:
parent
2b9bb591e6
commit
9ed7cf89ea
|
@ -35,17 +35,17 @@
|
|||
(->* () () #:rest (listof pre-content?)
|
||||
content?)])
|
||||
|
||||
(provide preprint 10pt
|
||||
(provide preprint 10pt nocopyright
|
||||
include-abstract)
|
||||
|
||||
(define-syntax (preprint stx)
|
||||
(raise-syntax-error #f
|
||||
"option must appear on the same line as `#lang scribble/sigplan'"
|
||||
stx))
|
||||
(define-syntax (10pt stx)
|
||||
(raise-syntax-error #f
|
||||
"option must appear on the same line as `#lang scribble/sigplan'"
|
||||
stx))
|
||||
(define-syntax-rule (defopts name ...)
|
||||
(begin (define-syntax (name stx)
|
||||
(raise-syntax-error #f
|
||||
"option must appear on the same line as `#lang scribble/sigplan'"
|
||||
stx))
|
||||
...
|
||||
(provide name ...)))
|
||||
(defopts preprint 10pt nocopyright)
|
||||
|
||||
(define sigplan-extras
|
||||
(let ([abs (lambda (s)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
scribble/base
|
||||
scribble/decode
|
||||
scribble/sigplan
|
||||
racket/list
|
||||
"../private/defaults.ss"
|
||||
(for-syntax scheme/base))
|
||||
(provide (except-out (all-from-out scribble/doclang) #%module-begin)
|
||||
|
@ -15,30 +16,32 @@
|
|||
(syntax-case stx ()
|
||||
[(_ id . body)
|
||||
(let ([preprint? #f]
|
||||
[10pt? #f])
|
||||
[10pt? #f]
|
||||
[nocopyright? #f])
|
||||
(let loop ([stuff #'body])
|
||||
(syntax-case* stuff (preprint 10pt) (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
|
||||
(syntax-case* stuff (preprint 10pt nocopyright) (lambda (a b) (eq? (syntax-e a) (syntax-e b)))
|
||||
[(ws . body)
|
||||
;; Skip intraline whitespace to find options:
|
||||
(and (string? (syntax-e #'ws))
|
||||
(regexp-match? #rx"^ *$" (syntax-e #'ws)))
|
||||
(loop #'body)]
|
||||
[(preprint . body)
|
||||
(set! preprint? #t)
|
||||
(set! preprint? "preprint")
|
||||
(loop #'body)]
|
||||
[(nocopyright . body)
|
||||
(set! nocopyright? "nocopyrightspace")
|
||||
(loop #'body)]
|
||||
[(10pt . body)
|
||||
(set! 10pt? #t)
|
||||
(set! 10pt? "10pt")
|
||||
(loop #'body)]
|
||||
[body
|
||||
#`(#%module-begin id (post-process #,preprint? #,10pt?) () . body)])))]))
|
||||
#`(#%module-begin id (post-process #,preprint? #,10pt? #,nocopyright?) () . body)])))]))
|
||||
|
||||
(define ((post-process preprint? 10pt?) doc)
|
||||
(define ((post-process . opts) doc)
|
||||
(let ([options
|
||||
(cond
|
||||
[(and preprint? 10pt?) "[preprint, 10pt]"]
|
||||
[preprint? "[preprint]"]
|
||||
[10pt? "[10pt]"]
|
||||
[else ""])])
|
||||
(if (ormap values opts)
|
||||
(format "[~a]" (apply string-append (add-between (filter values opts) ", ")))
|
||||
"")])
|
||||
(add-sigplan-styles
|
||||
(add-defaults doc
|
||||
(string->bytes/utf-8
|
||||
|
|
|
@ -29,7 +29,17 @@ same line as @hash-lang[], with only whitespace between
|
|||
#lang scribble/sigplan @10pt
|
||||
}|
|
||||
|
||||
The @racket[10pt] and @racket[preprint] options can be
|
||||
@defidform[nocopyright]{
|
||||
|
||||
Enables the @tt{nocopyright} option. Use @racket[nocopyright] only on the
|
||||
same line as @hash-lang[], with only whitespace between
|
||||
@racketmodname[scribble/sigplan] and @racket[nocopyright]:
|
||||
|
||||
@verbatim[#:indent 2]|{
|
||||
#lang scribble/sigplan @nocopyright
|
||||
}|}
|
||||
|
||||
The @racket[10pt], @racket[preprint], and @racket[nocopyright] options can be
|
||||
used together and may appear in any order.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user