@@ -64,17 +64,17 @@ sub escape_id ($id) {
64
64
$ id . trim . subst (/\s + /, ' _' , : g). subst (' "' , ' "' , : g);
65
65
}
66
66
67
- multi visit (Nil , | a) {
67
+ multi visit (Nil , | a) {
68
68
Debug { note colored(" visit called for Nil" , " bold" ) }
69
- }
69
+ }
70
70
multi visit ($ root , : & pre , : & post , : & assemble = -> * % { Nil }) {
71
71
Debug { note colored(" visit called for " , " bold" ) ~ $ root . perl }
72
72
my ($ pre , $ post );
73
73
$ pre = pre($ root ) if defined & pre ;
74
-
74
+
75
75
my @ content = $ root .? contents. map : {visit $ _ , : & pre , : & post , : & assemble };
76
76
$ post = post($ root , : @ content ) if defined & post ;
77
-
77
+
78
78
return assemble(: $ pre , : $ post , : @ content , : node($ root ));
79
79
}
80
80
@@ -141,14 +141,14 @@ sub assemble-list-items(:@content, :$node, *% ) {
141
141
142
142
143
143
# | Converts a Pod tree to a HTML document.
144
- sub pod2html ($ pod , : & url = -> $ url { $ url }, : $ head = ' ' , : $ header = ' ' , : $ footer = ' ' , : $ default-title ,
144
+ sub pod2html ($ pod , : & url = -> $ url { $ url }, : $ head = ' ' , : $ header = ' ' , : $ footer = ' ' , : $ default-title ,
145
145
: $ css-url = ' //design.perl6.org/perl.css' , : $ lang = ' en' ,
146
146
) is export returns Str {
147
147
($ title , $ subtitle , @ meta , @ indexes , @ body , @ footnotes ) = ();
148
148
# | Keep count of how many footnotes we've output.
149
149
my Int $ * done-notes = 0 ;
150
150
& OUTER ::url = & url ;
151
-
151
+
152
152
@ body . push : node2html($ pod . map : { visit $ _ , : assemble(& assemble-list-items ) });
153
153
154
154
my $ title_html = $ title // $ default-title // ' ' ;
@@ -290,7 +290,7 @@ multi sub node2html(Pod::Block::Declarator $node) {
290
290
}
291
291
default {
292
292
Debug { note " I don't know what { $ node . WHEREFORE. WHAT . perl } is. Assuming class..." };
293
- " <h1>" ~ node2html([$ node . WHEREFORE. perl , q { : } , $ node . contents])~ " </h1>" ;
293
+ " <h1>" ~ node2html([$ node . WHEREFORE. perl , q { : } , $ node . contents])~ " </h1>" ;
294
294
}
295
295
}
296
296
}
@@ -531,14 +531,14 @@ multi sub node2inline(Pod::FormattingCode $node) returns Str {
531
531
when ' X' {
532
532
multi sub recurse-until-str (Str : D $ s ){ $ s }
533
533
multi sub recurse-until-str (Pod ::Block $ n ){ $ n . contents>>. & recurse-until-str (). join }
534
-
534
+
535
535
my $ index-text = recurse-until-str($ node ). join ;
536
536
my @ indices = $ node . meta;
537
537
my $ index-name-attr = qq [ index-entry{ @ indices ?? ' -' !! ' ' } { @ indices . join (' -' )} { $ index-text ?? ' -' !! ' ' } $ index-text ] . subst (' _' , ' __' , : g). subst (' ' , ' _' , : g). subst (' %' , ' %25' , : g). subst (' #' , ' %23' , : g);
538
-
538
+
539
539
my $ text = node2inline($ node . contents);
540
540
% crossrefs {$ _ } = $ text for @ indices ;
541
-
541
+
542
542
return qq [ <a name="$ index-name-attr "><span class="index-entry">$ text\ </span></a> ] if $ text ;
543
543
return qq [ <a name="$ index-name-attr "></a> ] ;
544
544
}
0 commit comments