From 77d079a3edb316ffc9584816a29f4974a0765c7a Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 19 Feb 2013 13:59:10 -0700 Subject: [PATCH] scribble: fix 'aux stripping for hyperlinks and HTML titles original commit: ce960756cbea2fa1bafdc0497bb558af851596f6 --- collects/scribble/core.rkt | 14 ++++++++++++-- collects/scribble/html-render.rkt | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/collects/scribble/core.rkt b/collects/scribble/core.rkt index 8789b715..5fefcc0d 100644 --- a/collects/scribble/core.rkt +++ b/collects/scribble/core.rkt @@ -619,14 +619,24 @@ (define (aux-element? e) (and (element? e) (let ([s (element-style e)]) - (and (style? e) + (and (style? s) (memq 'aux (style-properties s)))))) (define (strip-aux content) (cond [(null? content) null] [(aux-element? content) null] - [(list? content) (map strip-aux content)] + [(element? content) + (define c (element-content content)) + (define p (strip-aux c)) + (if (equal? c p) + content + (struct-copy element content [content p]))] + [(list? content) + (define p (map strip-aux content)) + (if (equal? p content) + content + p)] [else content])) ;; ---------------------------------------- diff --git a/collects/scribble/html-render.rkt b/collects/scribble/html-render.rkt index 7fd12bf9..8b083f77 100644 --- a/collects/scribble/html-render.rkt +++ b/collects/scribble/html-render.rkt @@ -667,7 +667,7 @@ [title (cond [(part-title-content d) => (lambda (c) `(title ,@(format-number number '(nbsp)) - ,(content->string c this d ri)))] + ,(content->string (strip-aux c) this d ri)))] [else `(title)])]) (unless (bytes? style-file) (unless (lookup-path style-file alt-paths)