Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #410 from azawawi/master
Fix #407 again with less duplication
  • Loading branch information
azawawi committed Mar 4, 2016
2 parents e0099d0 + fb32bd0 commit 9d5c0c7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions htmlify.p6
Expand Up @@ -340,7 +340,8 @@ sub find-references(:$pod!, :$url, :$origin) {
}

sub find-p5to6-functions(:$pod!, :$url, :$origin) {
if $pod ~~ Pod::Item {
if $pod ~~ Pod::Heading && $pod.level == 2 {
# Add =head2 function names to hash
my $func-name = ~$pod.contents[0].contents;
%p5to6-functions{$func-name} = 1;
}
Expand Down Expand Up @@ -641,10 +642,15 @@ sub write-search-file () {
}", value: "$name", url: "{@docs.[0].url}" \}]] #"
}
}).flat;

# Add p5to6 functions to JavaScript search index
@items.append( %p5to6-functions.keys.map( {
my $url = "/language/5to6-perlfunc#" ~ uri_escape($_);
sprintf( q[[{ category: "5to6-perlfunc", value: "%s", url: "%s" }]], $_, $url);
}) );
my $url = "/language/5to6-perlfunc#" ~ $_.subst(' ', '_', :g);
sprintf(
q[[{ category: "5to6-perlfunc", value: "%s", url: "%s" }]],
$_, $url
);
}));
spurt("html/js/search.js", $template.subst("ITEMS", @items.join(",\n") ));
}

Expand Down

0 comments on commit 9d5c0c7

Please sign in to comment.