@@ -35,6 +35,7 @@ use experimental :pack;
35
35
my $ type-graph ;
36
36
my % routines-by-type ;
37
37
my % * POD2HTML-CALLBACKS ;
38
+ my % p5to6-functions ;
38
39
39
40
# TODO: Generate menulist automatically
40
41
my @ menu =
@@ -227,6 +228,11 @@ sub process-pod-source(:$kind, :$pod, :$filename, :$pod-is-complete) {
227
228
228
229
find-definitions : $ pod , : $ origin , : url(" /$ kind /$ filename" );
229
230
find-references : $ pod , : $ origin , : url(" /$ kind /$ filename" );
231
+
232
+ # Special handling for 5to6-perlfunc
233
+ if $ filename eq ' 5to6-perlfunc' {
234
+ find-p5to6-functions( : $ pod , : $ origin , : url(" /$ kind /$ filename" ))
235
+ }
230
236
}
231
237
232
238
# XXX: Generalize
@@ -320,6 +326,18 @@ sub find-references(:$pod!, :$url, :$origin) {
320
326
}
321
327
}
322
328
329
+ sub find-p5to6-functions (: $ pod ! , : $ url , : $ origin ) {
330
+ if $ pod ~~ Pod ::Item {
331
+ my $ func-name = ~ $ pod . contents[0 ]. contents;
332
+ % p5to6-functions {$ func-name } = 1 ;
333
+ }
334
+ elsif $ pod .? contents {
335
+ for $ pod . contents -> $ sub-pod {
336
+ find-p5to6-functions(: pod($ sub-pod ), : $ url , : $ origin ) if $ sub-pod ~~ Pod ::Block;
337
+ }
338
+ }
339
+ }
340
+
323
341
sub register-reference (: $ pod ! , : $ origin , : $ url ) {
324
342
if $ pod . meta {
325
343
for @ ( $ pod . meta ) -> $ meta {
@@ -602,15 +620,19 @@ sub write-search-file () {
602
620
sub escape (Str $ s ) {
603
621
$ s . trans ([</ \\ " >] => [<\\ / \\\\ \\ " > ]);
604
622
}
605
- my $ items = $ * DR . get-kinds. map (-> $ kind {
623
+ my @ items = $ * DR . get-kinds. map (-> $ kind {
606
624
$ * DR . lookup($ kind , : by<kind >). categorize ({escape . name })\
607
625
. pairs . sort ({. key }). map : -> (: key($ name ), : value(@ docs )) {
608
626
qq [[ \{ category: "{
609
627
( @ docs > 1 ?? $ kind !! @ docs . [0 ]. subkinds[0 ] ). wordcase
610
628
} ", value: "$ name ", url: "{ @ docs . [0 ]. url} " \} ]] # "
611
629
}
612
- }). flat . join (" ,\n " );
613
- spurt (" html/js/search.js" , $ template . subst (" ITEMS" , $ items ));
630
+ }). flat ;
631
+ @ items . append ( % p5to6-functions . keys . map ( {
632
+ my $ url = " /language/5to6-perlfunc.html#" ~ uri_escape($ _ );
633
+ sprintf ( q [[ { category: "5to6-perlfunc", value: "%s", url: "%s" } ]] , $ _ , $ url );
634
+ }) );
635
+ spurt (" html/js/search.js" , $ template . subst (" ITEMS" , @ items . join (" ,\n " ) ));
614
636
}
615
637
616
638
sub write-disambiguation-files () {
0 commit comments