tweak doc HTML toc rendering
svn: r10900 original commit: 27b0df2c2a31ed44380d900b65f19b3c48f07c9b
This commit is contained in:
parent
4367ba6549
commit
affe327c7d
|
@ -355,8 +355,13 @@
|
||||||
null)
|
null)
|
||||||
|
|
||||||
(define/public (render-toc-view d ri)
|
(define/public (render-toc-view d ri)
|
||||||
|
(define sub-parts-on-other-page?
|
||||||
|
(and (pair? (part-parts d))
|
||||||
|
(part-whole-page? (car (part-parts d)) ri)))
|
||||||
(define toc-chain
|
(define toc-chain
|
||||||
(let loop ([d d] [r (if (pair? (part-parts d)) (list d) '())])
|
(let loop ([d d] [r (if sub-parts-on-other-page?
|
||||||
|
(list d)
|
||||||
|
'())])
|
||||||
(cond [(collected-info-parent (part-collected-info d ri))
|
(cond [(collected-info-parent (part-collected-info d ri))
|
||||||
=> (lambda (p) (loop p (cons p r)))]
|
=> (lambda (p) (loop p (cons p r)))]
|
||||||
[(pair? r) r]
|
[(pair? r) r]
|
||||||
|
@ -383,7 +388,10 @@
|
||||||
(define-values (title num) (toc-item->title+num t #f))
|
(define-values (title num) (toc-item->title+num t #f))
|
||||||
(define children (part-parts t)) ; note: might be empty
|
(define children (part-parts t)) ; note: might be empty
|
||||||
(define id (format "tocview_~a" i))
|
(define id (format "tocview_~a" i))
|
||||||
(define expand? (eq? t (last toc-chain)))
|
(define last? (eq? t (last toc-chain)))
|
||||||
|
(define expand? (and last?
|
||||||
|
(or (collected-info-parent (part-collected-info d ri)) ;; => last isn't this page
|
||||||
|
sub-parts-on-other-page?))) ;; => last is this page, and it's useful to list subs
|
||||||
(define top? (eq? t top))
|
(define top? (eq? t top))
|
||||||
(define header
|
(define header
|
||||||
`(table ([cellspacing "0"] [cellpadding "0"])
|
`(table ([cellspacing "0"] [cellpadding "0"])
|
||||||
|
@ -403,10 +411,12 @@
|
||||||
,(if top? `(div ([class "tocviewtitle"]) ,header) header)
|
,(if top? `(div ([class "tocviewtitle"]) ,header) header)
|
||||||
,(if (null? children)
|
,(if (null? children)
|
||||||
""
|
""
|
||||||
`(div ([class "tocviewsublist"]
|
`(div ([class ,(cond
|
||||||
[style ,(format "display: ~a; margin-bottom: ~aem;"
|
[(and top? last?) "tocviewsublistonly"]
|
||||||
(if expand? 'block 'none)
|
[top? "tocviewsublisttop"]
|
||||||
(if top? 0 1))]
|
[last? "tocviewsublistbottom"]
|
||||||
|
[else "tocviewsublist"])]
|
||||||
|
[style ,(format "display: ~a;" (if expand? 'block 'none))]
|
||||||
[id ,id])
|
[id ,id])
|
||||||
(table ([cellspacing "0"] [cellpadding "0"])
|
(table ([cellspacing "0"] [cellpadding "0"])
|
||||||
,@(for/list ([c children])
|
,@(for/list ([c children])
|
||||||
|
|
|
@ -158,19 +158,28 @@ table td {
|
||||||
background-color: #f0f0e0;
|
background-color: #f0f0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tocviewlist {
|
.tocviewlist, .tocsublist {
|
||||||
margin: 0.2em;
|
margin-left: 0.2em;
|
||||||
|
margin-right: 0.2em;
|
||||||
|
padding-top: 0.2em;
|
||||||
|
padding-bottom: 0.2em;
|
||||||
}
|
}
|
||||||
.tocviewlist table {
|
.tocviewlist table {
|
||||||
font-size: 82%;
|
font-size: 82%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tocviewsublist {
|
.tocviewsublist, .tocviewsublistonly, .tocviewsublisttop, .tocviewsublistbottom {
|
||||||
margin-left: 0.4em;
|
margin-left: 0.4em;
|
||||||
border-left: 1px solid #bbf;
|
border-left: 1px solid #bbf;
|
||||||
padding-left: 0.8em;
|
padding-left: 0.8em;
|
||||||
}
|
}
|
||||||
.tocviewsublist table {
|
.tocviewsublist {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
.tocviewsublist table,
|
||||||
|
.tocviewsublistonly table,
|
||||||
|
.tocviewsublisttop table,
|
||||||
|
.tocviewsublistbottom table {
|
||||||
font-size: 75%;
|
font-size: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +200,9 @@ table td {
|
||||||
.tocviewtoggle {
|
.tocviewtoggle {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: blue;
|
color: blue;
|
||||||
|
font-size: 75%; /* looks better, and avoids bounce when toggling sub-sections due to font alignments */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tocsublist {
|
|
||||||
margin: 0.2em;
|
|
||||||
}
|
|
||||||
.tocsublist td {
|
.tocsublist td {
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
text-indent: -1em;
|
text-indent: -1em;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user