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