Skip to content

Commit 29fc2b8

Browse files
authored
Enclose scribble parts in an html section tag
Section tag class attribute is set to the level of the part and id attribute is set to 'section <the section number>'.
1 parent 60787f7 commit 29fc2b8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scribble-lib/scribble/html-render.rkt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,17 @@
11261126
,(part-title-and-content-wrapper-attribs w)
11271127
,@l))]
11281128
[else l]))
1129-
(let ([number (collected-info-number (part-collected-info d ri))])
1129+
(let* ([number (collected-info-number (part-collected-info d ri))]
1130+
[depth (add1 (number-depth number))]
1131+
[formatted-number (format-number number "")]
1132+
[number-string
1133+
(if (null? formatted-number)
1134+
"0"
1135+
(car formatted-number))])
11301136
(add-title-and-content-wrapper
1131-
`(,@(let ([pres (extract-pretitle d)])
1137+
`((section ([class ,(format "SsectionLevel~a" depth)]
1138+
[id ,(format "section ~a" number-string)])
1139+
,@(let ([pres (extract-pretitle d)])
11321140
(append-map (lambda (pre)
11331141
(do-render-paragraph pre d ri #f #t))
11341142
pres))
@@ -1216,7 +1224,7 @@
12161224
(if (null? secs)
12171225
null
12181226
(append (render-part (car secs) ri)
1219-
(loop (add1 pos) (cdr secs))))))))))
1227+
(loop (add1 pos) (cdr secs)))))))))))
12201228

12211229
(define/private (render-flow* p part ri starting-item? special-last?)
12221230
;; Wrap each table with <p>, except for a trailing table

0 commit comments

Comments
 (0)