From 7fb6f9e3f9ef2a2cb1d81573437efdb9d60b63ee Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 24 May 2007 10:16:15 +0000 Subject: [PATCH] fix link search to walk up sections, instead of using the global table svn: r6264 original commit: 58828e96a1335c0611f0a5c4e793a4eb30b46667 --- collects/scribble/base-render.ss | 17 +++++++++++++++-- collects/scribble/html-render.ss | 5 +++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/collects/scribble/base-render.ss b/collects/scribble/base-render.ss index bb0d57a1..d74b859c 100644 --- a/collects/scribble/base-render.ss +++ b/collects/scribble/base-render.ss @@ -131,6 +131,19 @@ (list (index-element-plain-seq i) (index-element-entry-seq i)))) + (define/public (lookup part ht key) + (let ([v (hash-table-get (if part + (collected-info-info (part-collected-info part)) + ht) + key + #f)]) + (or v + (and part + (lookup (collected-info-parent + (part-collected-info part)) + ht + key))))) + ;; ---------------------------------------- ;; render methods @@ -192,7 +205,7 @@ (cond [(and (link-element? i) (null? (element-content i))) - (let ([v (hash-table-get ht (link-element-tag i) #f)]) + (let ([v (lookup part ht (link-element-tag i))]) (if v (render-content v part ht) (render-content (list "[missing]") part ht)))] @@ -265,7 +278,7 @@ (or (not (car number)) ((car number) . > . 1))) (cons (list (make-flow (list (make-paragraph (list - (make-element 'hspace (list " "))))))) + (make-element 'hspace (list ""))))))) l) l)))) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index a36dd8af..b2362a04 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -27,7 +27,8 @@ collect-part install-file get-dest-directory - format-number) + format-number + lookup) (define/override (get-suffix) #".html") @@ -131,7 +132,7 @@ [(target-element? e) `((a ((name ,(target-element-tag e))) ,@(render-plain-element e part ht)))] [(link-element? e) - (let ([dest (hash-table-get ht (link-element-tag e) #f)]) + (let ([dest (lookup part ht (link-element-tag e))]) (if dest `((a ((href ,(format "~a~a~a" (from-root (car dest)