Skip to content
Open
8 changes: 4 additions & 4 deletions scribble-lib/scribble/acmart.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#:email (or/c pre-content? email? (listof email?)))
#:rest (listof pre-content?)
block?)]
[authorsaddresses (->* () () #:rest (listof pre-content?) block?)]
[shortauthors (->* () () #:rest (listof pre-content?) element?)]
[authorsaddresses (-> pre-content? ... block?)]
[shortauthors (-> pre-content? ... element?)]
[institution
(->* ()
(#:departments (listof (or/c pre-content? institution?)))
Expand All @@ -67,7 +67,7 @@
#:country (or/c pre-content? #f))
affiliation?)]
[affiliation? (-> any/c boolean?)]
[abstract (->* () () #:rest (listof pre-content?) block?)]
[abstract (-> pre-content? ... block?)]
[acmConference (-> string? string? string? block?)]
[grantsponsor (-> string? string? string? content?)]
[grantnum (->* (string? string?) (#:url string?) content?)]
Expand All @@ -76,7 +76,7 @@
[received (->* (string?) (#:stage string?) block?)]
[citestyle (-> content? block?)]
[ccsdesc (->* (string?) (#:number exact-integer?) block?)]
[CCSXML (->* () () #:rest (listof pre-content?) any/c)]))
[CCSXML (-> pre-content? ... any/c)]))
(provide
invisible-element-to-collect-for-acmart-extras
include-abstract)
Expand Down
19 changes: 9 additions & 10 deletions scribble-lib/scribble/lp/lang/common.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,15 @@
(strip-comments (cdr body))]
[(eq? ad 'code:blank)
(strip-comments (cdr body))]
[(and (or (eq? ad 'code:hilite)
(eq? ad 'code:quote))
(let* ([d (cdr body)]
[dd (if (syntax? d)
(syntax-e d)
d)])
(and (pair? dd)
(or (null? (cdr dd))
(and (syntax? (cdr dd))
(null? (syntax-e (cdr dd))))))))
[(cond
[(or (eq? ad 'code:hilite) (eq? ad 'code:quote))
(define d (cdr body))
(define dd
(if (syntax? d)
(syntax-e d)
d))
(and (pair? dd) (or (null? (cdr dd)) (and (syntax? (cdr dd)) (null? (syntax-e (cdr dd))))))]
[else #f])
(define d (cdr body))
(define r
(strip-comments (car (if (syntax? d) (syntax-e d) d))))
Expand Down
51 changes: 13 additions & 38 deletions scribble-lib/scribble/sigplan.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,19 @@
scribble/latex-properties
(for-syntax racket/base))

(provide/contract
[abstract
(->* () () #:rest (listof pre-content?)
block?)]
[subtitle
(->* () () #:rest (listof pre-content?)
content?)]
[authorinfo
(-> pre-content? pre-content? pre-content?
block?)]
[conferenceinfo
(-> pre-content? pre-content?
block?)]
[copyrightyear
(->* () () #:rest (listof pre-content?)
block?)]
[copyrightdata
(->* () () #:rest (listof pre-content?)
block?)]
[exclusive-license
(->* () ()
block?)]
[doi
(->* () () #:rest (listof pre-content?)
block?)]
[to-appear
(->* () () #:rest pre-content?
block?)]
[category
(->* (pre-content? pre-content? pre-content?)
((or/c #f pre-content?))
content?)]
[terms
(->* () () #:rest (listof pre-content?)
content?)]
[keywords
(->* () () #:rest (listof pre-content?)
content?)])
(provide (contract-out
[abstract (->* () () #:rest (listof pre-content?) block?)]
[subtitle (->* () () #:rest (listof pre-content?) content?)]
[authorinfo (-> pre-content? pre-content? pre-content? block?)]
[conferenceinfo (-> pre-content? pre-content? block?)]
[copyrightyear (->* () () #:rest (listof pre-content?) block?)]
[copyrightdata (->* () () #:rest (listof pre-content?) block?)]
[exclusive-license (->* () () block?)]
[doi (->* () () #:rest (listof pre-content?) block?)]
[to-appear (->* () () #:rest pre-content? block?)]
[category (->* (pre-content? pre-content? pre-content?) ((or/c #f pre-content?)) content?)]
[terms (->* () () #:rest (listof pre-content?) content?)]
[keywords (->* () () #:rest (listof pre-content?) content?)]))

(provide preprint 10pt nocopyright onecolumn noqcourier notimes
include-abstract)
Expand Down
146 changes: 77 additions & 69 deletions scribble-lib/scribble/srcdoc.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@
(syntax-shift-phase-level s #f)))
(with-syntax ([((req ...) ...)
(for/list ([rs (in-list (reverse requires))])
(map (lambda (r)
(syntax-case r ()
[(op arg ...)
(with-syntax ([(arg ...) (map shift-and-introduce
(syntax->list #'(arg ...)))])
#'(op arg ...))]
[else (shift-and-introduce r)]))
(syntax->list rs)))]
(for/list ([r (in-list (syntax->list rs))])
(syntax-case r ()
[(op arg ...)
(with-syntax ([(arg ...) (map shift-and-introduce
(syntax->list #'(arg ...)))])
#'(op arg ...))]
[else (shift-and-introduce r)])))]
[(expr ...)
(map shift-and-introduce (reverse doc-exprs))]
[doc-body
Expand Down Expand Up @@ -128,11 +127,12 @@
(let ([t (syntax-local-value #'id (lambda () #f))])
(unless (provide/doc-transformer? t)
(raise-syntax-error #f "not bound as a provide/doc transformer" stx #'id))
(let* ([i (make-syntax-introducer)]
[i2 (lambda (x) (syntax-local-introduce (i x)))])
(let-values ([(p/c d req/d id) ((provide/doc-transformer-proc t)
(i (syntax-local-introduce form)))])
(list (i2 p/c) (i req/d) (i d) (i id)))))]
(define i (make-syntax-introducer))
(define (i2 x)
(syntax-local-introduce (i x)))
(let-values ([(p/c d req/d id) ((provide/doc-transformer-proc t)
(i (syntax-local-introduce form)))])
(list (i2 p/c) (i req/d) (i d) (i id))))]
[_ (raise-syntax-error #f "not a provide/doc sub-form" stx form)]))])
(with-syntax ([(p/c ...)
(map (lambda (form f)
Expand Down Expand Up @@ -345,44 +345,52 @@

(let ([build-mandatories/optionals
(λ (names contracts extras)
(let ([names-length (length names)]
[contracts-length (length contracts)])
(let loop ([contracts contracts]
[names names]
[extras extras])
(cond
[(and (null? names) (null? contracts)) '()]
[(or (null? names) (null? contracts))
(raise-syntax-error #f
(format "mismatched ~a argument list count and domain contract count (~a)"
(if extras "optional" "mandatory")
(if (null? names)
"ran out of names"
"ran out of contracts"))
stx)]
[else
(let ([fst-name (car names)]
[fst-ctc (car contracts)])
(if (keyword? (syntax-e fst-ctc))
(begin
(unless (pair? (cdr contracts))
(raise-syntax-error #f
"keyword not followed by a contract"
stx))
(cons (if extras
(list fst-ctc fst-name (cadr contracts) (car extras))
(list fst-ctc fst-name (cadr contracts)))
(loop (cddr contracts)
(cdr names)
(if extras
(cdr extras)
extras))))
(cons (if extras
(list fst-name fst-ctc (car extras))
(list fst-name fst-ctc))
(loop (cdr contracts) (cdr names) (if extras
(cdr extras)
extras)))))]))))])
(define names-length (length names))
(define contracts-length (length contracts))
(let loop ([contracts contracts]
[names names]
[extras extras])
(cond
[(and (null? names) (null? contracts)) '()]
[(or (null? names) (null? contracts))
(raise-syntax-error
#f
(format
"mismatched ~a argument list count and domain contract count (~a)"
(if extras "optional" "mandatory")
(if (null? names)
"ran out of names"
"ran out of contracts"))
stx)]
[else
(let ([fst-name (car names)]
[fst-ctc (car contracts)])
(if (keyword? (syntax-e fst-ctc))
(begin
(unless (pair? (cdr contracts))
(raise-syntax-error
#f
"keyword not followed by a contract"
stx))
(cons (if extras
(list fst-ctc
fst-name
(cadr contracts)
(car extras))
(list fst-ctc fst-name (cadr contracts)))
(loop (cddr contracts)
(cdr names)
(if extras
(cdr extras)
extras))))
(cons (if extras
(list fst-name fst-ctc (car extras))
(list fst-name fst-ctc))
(loop (cdr contracts)
(cdr names)
(if extras
(cdr extras)
extras)))))])))])

#`([(id #,@(build-mandatories/optionals (syntax->list #'(mandatory-names ...))
(syntax->list #'(mandatory ...))
Expand All @@ -404,19 +412,22 @@
[((x y) ...)
(andmap identifier? (syntax->list #'(x ... y ...)))]
[((x y) ...)
(for-each
(λ (var)
(unless (identifier? var)
(raise-syntax-error #f "expected an identifier in the optional names" stx var)))
(syntax->list #'(x ... y ...)))]
(for ([var (in-list (syntax->list #'(x ... y ...)))])
(unless (identifier? var)
(raise-syntax-error
#f
"expected an identifier in the optional names"
stx
var)))]
[(a ...)
(for-each
(λ (a)
(syntax-case stx ()
[(x y) (void)]
[other
(raise-syntax-error #f "expected an sequence of two idenfiers" stx #'other)]))
(syntax->list #'(a ...)))]))]
(for ([a (in-list (syntax->list #'(a ...)))])
(syntax-case stx ()
[(x y) (void)]
[other
(raise-syntax-error #f
"expected an sequence of two idenfiers"
stx
#'other)]))]))]
[x
(raise-syntax-error
#f
Expand Down Expand Up @@ -492,12 +503,9 @@
"expected an identifier or sequence of two identifiers"
stx
#'struct-name)])
(for ([f (in-list (syntax->list #'(field-name ...)))])
(unless (identifier? f)
(raise-syntax-error #f
"expected an identifier"
stx
f)))
(for ([f (in-list (syntax->list #'(field-name ...)))]
#:unless (identifier? f))
(raise-syntax-error #f "expected an identifier" stx f))
(define omit-constructor? #f)
(define-values (ds-args desc)
(let loop ([ds-args '()]
Expand Down
Loading