diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index 1833b845..9ae55d68 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -18,6 +18,7 @@ (define on-separate-page (make-parameter #t)) (define next-separate-page (make-parameter #f)) (define collecting-sub (make-parameter 0)) + (define current-no-links (make-parameter #f)) ;; ---------------------------------------- ;; main mixin @@ -136,28 +137,30 @@ (cond [(target-element? e) `((a ((name ,(target-element-tag e))) ,@(render-plain-element e part ht)))] - [(link-element? e) - (let ([dest (lookup part ht (link-element-tag e))]) - (if dest - `((a ((href ,(format "~a~a~a" - (from-root (car dest) - (get-dest-directory)) - (if (caddr dest) - "" - "#") - (if (caddr dest) - "" - (link-element-tag e)))) - ,@(if (string? (element-style e)) - `((class ,(element-style e))) - null)) - ,@(if (null? (element-content e)) - (render-content (cadr dest) part ht) - (render-content (element-content e) part ht)))) - `((font ((class "badlink")) - ,@(if (null? (element-content e)) - `(,(format "~s" (link-element-tag e))) - (render-plain-element e part ht))))))] + [(and (link-element? e) + (not (current-no-links))) + (parameterize ([current-no-links #t]) + (let ([dest (lookup part ht (link-element-tag e))]) + (if dest + `((a ((href ,(format "~a~a~a" + (from-root (car dest) + (get-dest-directory)) + (if (caddr dest) + "" + "#") + (if (caddr dest) + "" + (link-element-tag e)))) + ,@(if (string? (element-style e)) + `((class ,(element-style e))) + null)) + ,@(if (null? (element-content e)) + (render-content (cadr dest) part ht) + (render-content (element-content e) part ht)))) + `((font ((class "badlink")) + ,@(if (null? (element-content e)) + `(,(format "~s" (link-element-tag e))) + (render-plain-element e part ht)))))))] [else (render-plain-element e part ht)])) (define/private (render-plain-element e part ht) @@ -177,7 +180,10 @@ [(string? style) `((span ([class ,style]) ,@(super render-element e part ht)))] [(target-url? style) - `((a ((href ,(target-url-addr style))) ,@(super render-element e part ht)))] + (if (current-no-links) + (super render-element e part ht) + (parameterize ([current-no-links #t]) + `((a ((href ,(target-url-addr style))) ,@(super render-element e part ht)))))] [(image-file? style) `((img ((src ,(install-file (image-file-path style))))))] [else (super render-element e part ht)]))) diff --git a/collects/scribble/manual.ss b/collects/scribble/manual.ss index b668446a..4cc64b00 100644 --- a/collects/scribble/manual.ss +++ b/collects/scribble/manual.ss @@ -203,8 +203,8 @@ [has-optional? (lambda (arg) (and (pair? arg) ((length arg) . > . (if (keyword? (car arg)) - 2 - 3))))] + 3 + 2))))] [arg->elem (lambda (v) (cond [(pair? v) @@ -221,7 +221,9 @@ (parameterize ([current-variable-list (map (lambda (i) (and (pair? i) - (car i))) + (if (keyword? (car i)) + (cadr i) + (car i)))) (apply append (map cdr prototypes)))]) (make-splice (cons diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index 9b9bd7ad..a47970e3 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -281,13 +281,17 @@ (if (and (symbol? c) (char=? (string-ref s 0) #\_)) (values (substring s 1) #t #f) - (values s #f #f))))]) + (values s #f #f))))] + [(is-kw?) (and (identifier? c) + (memq (syntax-e c) (current-keyword-list)))] + [(is-var?) (and (identifier? c) + (memq (syntax-e c) (current-variable-list)))]) (if (element? (syntax-e c)) (out (syntax-e c) #f) (out (if (and (identifier? c) color? (quote-depth . <= . 0) - (not it?)) + (not (or it? is-kw? is-var?))) (make-delayed-element (lambda (renderer sec ht) (let* ([vtag (register-scheme-definition (syntax-e c))] @@ -313,9 +317,9 @@ value-color] [(identifier? c) (cond - [(memq (syntax-e c) (current-keyword-list)) + [is-kw? keyword-color] - [(memq (syntax-e c) (current-variable-list)) + [is-var? variable-color] [it? variable-color] [else symbol-color])]