You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by st...@apache.org on 2002/06/10 19:57:57 UTC

cvs commit: modperl-docs/lib/DocSet/Source POD.pm

stas        2002/06/10 10:57:57

  Modified:    lib/DocSet RunTime.pm
               lib/DocSet/Source POD.pm
  Log:
  DocSet sync
  - fix a bug with resolving L<> when not the minimal lenght link is
    used, also solved a parallel bug with resolving links to ::index
  
  - skip empty lines in preamble, when extracting pod
  
  Revision  Changes    Path
  1.6       +29 -13    modperl-docs/lib/DocSet/RunTime.pm
  
  Index: RunTime.pm
  ===================================================================
  RCS file: /home/cvs/modperl-docs/lib/DocSet/RunTime.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RunTime.pm	21 Apr 2002 07:25:18 -0000	1.5
  +++ RunTime.pm	10 Jun 2002 17:57:57 -0000	1.6
  @@ -106,6 +106,7 @@
   
           my $full_path_regex = quotemeta $full_path;
           $src_docs{$rel_path} = {
  +            "index.html" => 1,              # base index.html
               map { m{(.*?/?)[^/]+$}          # add autogenerated index.html
                     ? ("$1index.html" => 1, $_ => 1)
                     : ($_ => 1);              # shouldn't happen, but just in case
  @@ -121,7 +122,7 @@
           $seen{$full_path}++;
       }
   
  -#    dumper \%src_docs;
  +#   dumper \%src_docs;
   }
   
   # this function returns a URI, so its separators are always /
  @@ -133,27 +134,42 @@
       $exts{html} = 1 unless exists $exts{html};
   
       for my $path (keys %src_docs) {
  -        for my $ext (keys %exts) {
  -#print qq{Try:  $path :: $resource_rel_path.$ext\n};
  -            if (exists $src_docs{$path}{"$resource_rel_path.$ext"}) {
  -#print qq{Found $path/$resource_rel_path.$ext\n};
  -                return join '/', $path, "$resource_rel_path.$ext";
  -            }
  -
  +        if (my $found_path = match_in_doc_src_subset($path,
  +                                                     $resource_rel_path)) {
  +            return $found_path;
           }
       }
   
       # if we didn't find anything so far, it's possible that the path was
       # specified with a longer prefix, that was needed (the above
  -    # searches only the end leaves), so we cut pathes here in the
  -    # search order
  -    for my $rel_path (@search_paths) {
  -        if ($resource_rel_path =~ s|$rel_path/||) {
  -            return find_src_doc($resource_rel_path);
  +    # searches only the end leaves), so try locate the segments of the
  +    # search path and search within maching sub-sets
  +    for my $path (@search_paths) {
  +        if ($resource_rel_path =~ m|^$path/(.*)|) {
  +            if (my $found_path = match_in_doc_src_subset($path, $1)) {
  +                return $found_path;
  +            }
           }
       }
   
   #dumper  $src_docs{"docs/1.0"};
  +    return;
  +}
  +
  +# accepts the base_path (from the @search_paths) and the rel_path as
  +# args, then it tries to find the match by applying known extensions.
  +#
  +# if matched, returns the whole path relative to the root, otherwise
  +# returns undef
  +sub match_in_doc_src_subset {
  +    my ($base_path, $rel_path) = @_;
  +    for my $ext (keys %exts) {
  +#print qq{Try:  $base_path :: $rel_path.$ext\n};
  +        if (exists $src_docs{$base_path}{"$rel_path.$ext"}) {
  +#print qq{Found $base_path/$rel_path.$ext\n};
  +            return join '/', $base_path, "$rel_path.$ext";
  +        }
  +    }
       return;
   }
   
  
  
  
  1.6       +5 -2      modperl-docs/lib/DocSet/Source/POD.pm
  
  Index: POD.pm
  ===================================================================
  RCS file: /home/cvs/modperl-docs/lib/DocSet/Source/POD.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- POD.pm	13 Apr 2002 15:44:20 -0000	1.5
  +++ POD.pm	10 Jun 2002 17:57:57 -0000	1.6
  @@ -161,8 +161,11 @@
   
       my @pod = ();
       my $in_pod = 0;
  -    for (split /\n\n/, ${ $self->{content} }) {
  -        $in_pod ||= /^=/s;
  +    for (split /\n{2,}/, ${ $self->{content} }) {
  +        unless ($in_pod) {
  +            s/^[\s\n]*//ms; # skip empty lines in preamble
  +            $in_pod = /^=/s;
  +        }
           next unless $in_pod;
           $in_pod = 0 if /^=cut/;
           push @pod, $_;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org