fix references lifted to table of contents
Certain lifted reference forms carried the prefix of the original section, but in general the section needs to be similarly carried for rendering elements that may contain references. Also, fix the contract on `elemref` and `elemtag` to use `taglet?` instead of `tag?`. Thanks to Dupéron Georges.
This commit is contained in:
parent
a69f6c6982
commit
30ae71202d
|
@ -691,13 +691,13 @@ renders as a hyperlink with the text:
|
|||
}|}
|
||||
|
||||
|
||||
@defproc[(elemtag [t (or/c tag? string?)] [pre-content pre-content?] ...) element?]{
|
||||
@defproc[(elemtag [t (or/c taglet? generated-tag?)] [pre-content pre-content?] ...) element?]{
|
||||
|
||||
The tag @racket[t] refers to the content form of
|
||||
@racket[pre-content].}
|
||||
|
||||
|
||||
@defproc[(elemref [t (or/c tag? string?)] [pre-content pre-content?] ...
|
||||
@defproc[(elemref [t (or/c taglet? generated-tag?)] [pre-content pre-content?] ...
|
||||
[#:underline? underline? any/c #t]) element?]{
|
||||
|
||||
The @tech{decode}d @racket[pre-content] is hyperlinked to @racket[t],
|
||||
|
|
|
@ -572,11 +572,11 @@
|
|||
;; ----------------------------------------
|
||||
|
||||
(provide/contract
|
||||
[elemtag (->* ((or/c tag? string?))
|
||||
[elemtag (->* ((or/c taglet? generated-tag?))
|
||||
()
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
[elemref (->* ((or/c tag? string?))
|
||||
[elemref (->* ((or/c taglet? generated-tag?))
|
||||
(#:underline? any/c)
|
||||
#:rest (listof pre-content?)
|
||||
element?)]
|
||||
|
|
|
@ -731,24 +731,25 @@
|
|||
(if (or (nearly-top? d)
|
||||
(part-style? d 'toc-hidden))
|
||||
null
|
||||
(list (cons d prefixes)))
|
||||
(list (vector d prefixes d)))
|
||||
;; get internal targets:
|
||||
(map (lambda (v) (cons v prefixes)) (append-map block-targets (part-blocks d)))
|
||||
(map (lambda (v) (vector v prefixes d)) (append-map block-targets (part-blocks d)))
|
||||
(map (lambda (p) (if (or (part-whole-page? p ri)
|
||||
(and (part-style? p 'toc-hidden)
|
||||
(all-toc-hidden? p)))
|
||||
null
|
||||
(flatten p prefixes #f)))
|
||||
(part-parts d)))))))
|
||||
(define any-parts? (ormap (compose part? car) ps))
|
||||
(define any-parts? (ormap (compose part? (lambda (p) (vector-ref p 0))) ps))
|
||||
(if (null? ps)
|
||||
null
|
||||
`((div ([class ,box-class])
|
||||
,@(get-onthispage-label)
|
||||
(table ([class "tocsublist"] [cellspacing "0"])
|
||||
,@(map (lambda (p)
|
||||
(let ([p (car p)]
|
||||
[prefixes (cdr p)]
|
||||
(let ([p (vector-ref p 0)]
|
||||
[prefixes (vector-ref p 1)]
|
||||
[from-d (vector-ref p 2)]
|
||||
[add-tag-prefixes
|
||||
(lambda (t prefixes)
|
||||
(if (null? prefixes)
|
||||
|
@ -765,7 +766,7 @@
|
|||
'(""))
|
||||
,@(if (toc-element? p)
|
||||
(render-content (toc-element-toc-content p)
|
||||
d ri)
|
||||
from-d ri)
|
||||
(parameterize ([current-no-links #t]
|
||||
[extra-breaking? #t])
|
||||
`((a ([href
|
||||
|
@ -793,7 +794,7 @@
|
|||
(if (toc-target2-element? p)
|
||||
(toc-target2-element-toc-content p)
|
||||
(element-content p)))
|
||||
d ri)))))))))
|
||||
from-d ri)))))))))
|
||||
ps)))))))
|
||||
|
||||
(define/private (extract-inherited d ri pred extract)
|
||||
|
|
Loading…
Reference in New Issue
Block a user