Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

index the X<> tags as well and display the whole section. Use as p6do…

…c '$_' and p6doc '$*OS'
  • Loading branch information...
commit da6549716937d2e3c93281963fd9a11b68139ef4 1 parent 3b8af6d
Gabor Szabo szabgab authored

Showing 2 changed files with 14 additions and 7 deletions. Show diff stats Hide diff stats

  1. +6 3 bin/p6doc
  2. +8 4 index.pl
9 bin/p6doc
@@ -71,9 +71,12 @@ multi sub MAIN() {
71 71 multi sub MAIN($docee) {
72 72 return MAIN($docee, :f) if defined $docee.index('.') ;
73 73 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 + }
77 80 show-docs(locate-module($docee));
78 81 }
79 82
12 index.pl
@@ -5,14 +5,18 @@ ()
5 5 my $outfile = "index.ini";
6 6 my %words;
7 7 for dir('lib') -> $file {
  8 + my $pod = substr($file.Str, 0 , $file.Str.chars -4);
8 9 next if $file !~~ /\.pod$/;
9   - #say $file.Str;
  10 + my $section = '';
10 11 for open('lib/' ~ $file.Str).lines -> $row {
11 12 #if $row ~~ /^\=(item|head\d) \s+ X\<(.*)\> \s*$/ {
12 13 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]);
16 20 }
17 21 }
18 22 }

0 comments on commit da65497

Please sign in to comment.
Something went wrong with that request. Please try again.