fix link search to walk up sections, instead of using the global table

svn: r6264

original commit: 58828e96a1335c0611f0a5c4e793a4eb30b46667
This commit is contained in:
Matthew Flatt 2007-05-24 10:16:15 +00:00
parent f9019a651f
commit 7fb6f9e3f9
2 changed files with 18 additions and 4 deletions

View File

@ -131,6 +131,19 @@
(list (index-element-plain-seq i) (list (index-element-plain-seq i)
(index-element-entry-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 ;; render methods
@ -192,7 +205,7 @@
(cond (cond
[(and (link-element? i) [(and (link-element? i)
(null? (element-content 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 (if v
(render-content v part ht) (render-content v part ht)
(render-content (list "[missing]") part ht)))] (render-content (list "[missing]") part ht)))]
@ -265,7 +278,7 @@
(or (not (car number)) (or (not (car number))
((car number) . > . 1))) ((car number) . > . 1)))
(cons (list (make-flow (list (make-paragraph (list (cons (list (make-flow (list (make-paragraph (list
(make-element 'hspace (list " "))))))) (make-element 'hspace (list "")))))))
l) l)
l)))) l))))

View File

@ -27,7 +27,8 @@
collect-part collect-part
install-file install-file
get-dest-directory get-dest-directory
format-number) format-number
lookup)
(define/override (get-suffix) #".html") (define/override (get-suffix) #".html")
@ -131,7 +132,7 @@
[(target-element? e) [(target-element? e)
`((a ((name ,(target-element-tag e))) ,@(render-plain-element e part ht)))] `((a ((name ,(target-element-tag e))) ,@(render-plain-element e part ht)))]
[(link-element? e) [(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 (if dest
`((a ((href ,(format "~a~a~a" `((a ((href ,(format "~a~a~a"
(from-root (car dest) (from-root (car dest)