@@ -209,14 +209,20 @@ sub do-metadata returns Str {
209
209
210
210
#| Turns accumulated headings into a nested-C«<ol>» table of contents
211
211
sub do-toc($ pod ) returns Str {
212
- my @ levels is default (0 ) = 0 ;
213
- my proto sub find-headings ($ node , : $ inside-heading ){* }
214
- multi sub find-headings (Str $ s is raw , : $ inside-heading ){ $ inside-heading ?? $ s . trim . & escape_html !! ' ' }
215
- multi sub find-headings (Pod ::FormattingCode $ node is raw where *. type eq ' C' , : $ inside-heading ){
216
- my $ html = $ node . contents. map (*. & find-headings (: $ inside-heading ));
217
- $ inside-heading ?? qq [ <code class="pod-code-inline">{ $ html } </code> ] !! ' '
218
- }
219
- multi sub find-headings (Pod ::Heading $ node is raw , : $ inside-heading ){
212
+ my @ levels is default (0 ) = 0 ;
213
+
214
+ my proto sub find-headings ($ node , : $ inside-heading ){* }
215
+
216
+ multi sub find-headings (Str $ s is raw , : $ inside-heading ){
217
+ $ inside-heading ?? $ s . trim . & escape_html !! ' '
218
+ }
219
+
220
+ multi sub find-headings (Pod ::FormattingCode $ node is raw where *. type eq ' C' , : $ inside-heading ){
221
+ my $ html = $ node . contents. map (*. & find-headings (: $ inside-heading ));
222
+ $ inside-heading ?? qq [ <code class="pod-code-inline">{ $ html } </code> ] !! ' '
223
+ }
224
+
225
+ multi sub find-headings (Pod ::Heading $ node is raw , : $ inside-heading ){
220
226
@ levels . splice ($ node . level) if $ node . level < + @ levels ;
221
227
@ levels [$ node . level-1]++ ;
222
228
my $ level-hierarchy = @ levels . join (' .' ); # e.g. §4.2.12
0 commit comments