Skip to content

Commit da65497

Browse files
committed
index the X<> tags as well and display the whole section. Use as p6doc '$_' and p6doc '$*OS'
1 parent 3b8af6d commit da65497

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

bin/p6doc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ multi sub MAIN() {
7171
multi sub MAIN($docee) {
7272
return MAIN($docee, :f) if defined $docee.index('.') ;
7373
if 'index.data'.IO ~~ :e {
74-
my %data = eval slurp 'index.data';
75-
return MAIN(%data{$docee} ~ ".$docee", :f) if %data{$docee};
76-
}
74+
my %data = eval slurp 'index.data';
75+
if %data{$docee} {
76+
my $newdoc = %data{$docee}[0][0] ~ "." ~ %data{$docee}[0][1];
77+
return MAIN($newdoc, :f);
78+
}
79+
}
7780
show-docs(locate-module($docee));
7881
}
7982

index.pl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ ()
55
my $outfile = "index.ini";
66
my %words;
77
for dir('lib') -> $file {
8+
my $pod = substr($file.Str, 0 , $file.Str.chars -4);
89
next if $file !~~ /\.pod$/;
9-
#say $file.Str;
10+
my $section = '';
1011
for open('lib/' ~ $file.Str).lines -> $row {
1112
#if $row ~~ /^\=(item|head\d) \s+ X\<(.*)\> \s*$/ {
1213
if $row ~~ /^\=(item|head\d) \s+ (.*?) \s*$/ {
13-
my $w = $1.Str;
14-
%words{$w}.push(substr($file.Str, 0 , $file.Str.chars -4));
15-
#say ' ', $1.Str;
14+
$section = $1.Str;
15+
%words{$section}.push([$pod, $section]);
16+
}
17+
if $row ~~ /X\<(.*?)\>/ and $section {
18+
my $x = $0.Str;
19+
%words{$x}.push([$pod, $section]);
1620
}
1721
}
1822
}

0 commit comments

Comments
 (0)