diff --git a/collects/scribble/sigplan.rkt b/collects/scribble/sigplan.rkt index 8eab37c5bd..e6e5bcc8b6 100644 --- a/collects/scribble/sigplan.rkt +++ b/collects/scribble/sigplan.rkt @@ -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) diff --git a/collects/scribble/sigplan/lang.rkt b/collects/scribble/sigplan/lang.rkt index 39ddf14f47..f2aa6ef0e9 100644 --- a/collects/scribble/sigplan/lang.rkt +++ b/collects/scribble/sigplan/lang.rkt @@ -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 diff --git a/collects/scribblings/scribble/sigplan.scrbl b/collects/scribblings/scribble/sigplan.scrbl index 90eaf36b21..2b4f14e826 100644 --- a/collects/scribblings/scribble/sigplan.scrbl +++ b/collects/scribblings/scribble/sigplan.scrbl @@ -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. }