X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FPod%2FHTML.pm;h=092d6a864fcc6275e11c61348886a6c5806f6e35;hb=31f3763747b82764bb019cfab5b2a2945fc9a99d;hp=68960632391a12b6d43001f24ce738d35b9facd0;hpb=679854b8bbc65d112071111bbd7f34a6a481fb30;p=freeside.git diff --git a/rt/lib/RT/Pod/HTML.pm b/rt/lib/RT/Pod/HTML.pm index 689606323..092d6a864 100644 --- a/rt/lib/RT/Pod/HTML.pm +++ b/rt/lib/RT/Pod/HTML.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -54,6 +54,10 @@ use base 'Pod::Simple::XHTML'; use HTML::Entities qw//; +__PACKAGE__->_accessorize( + "batch" +); + sub new { my $self = shift->SUPER::new(@_); $self->index(1); @@ -118,27 +122,35 @@ sub resolve_local_link { my $self = shift; my ($name, $section) = @_; + $name .= ""; # stringify name, it may be an object + $section = defined $section ? '#' . $self->idify($section, 1) : ''; my $local; - if ($name =~ /^RT::/) { + if ($name =~ /^RT(::(?!Extension::|Authen::)|$)/ or $self->batch->found($name)) { $local = join "/", map { $self->encode_entities($_) } split /::/, $name; } - elsif ($name =~ /^rt[-_]/) { + elsif ($name =~ /^rt([-_]|$)/) { $local = $self->encode_entities($name); } - elsif ($name eq "RT_Config" or $name eq "RT_Config.pm") { - $local = "RT_Config"; + elsif ($name =~ /^(\w+)_Config(\.pm)?$/) { + $name = "$1_Config"; + $local = "$1_Config"; + } + elsif ($name eq 'README') { + # We process README separately in devel/tools/rt-static-docs + $local = $name; } # These matches handle links that look like filenames, such as those we # parse out of F<> tags. elsif ( $name =~ m{^(?:lib/)(RT/[\w/]+?)\.pm$} or $name =~ m{^(?:docs/)(.+?)\.pod$}) { + $name = join "::", split '/', $1; $local = join "/", map { $self->encode_entities($_) } split /\//, $1; @@ -146,11 +158,20 @@ sub resolve_local_link { if ($local) { # Resolve links correctly by going up - my $depth = $self->batch_mode_current_level - 1; - return ($depth ? "../" x $depth : "") . "$local.html$section"; + my $found = $self->batch->found($name); + my $depth = $self->batch_mode_current_level + + ($found ? -1 : 1); + return ($depth ? "../" x $depth : "") . ($found ? "" : "rt/latest/") . "$local.html$section"; } else { return; } } +sub batch_mode_page_object_init { + my ($self, $batch, $module, $infile, $outfile, $depth) = @_; + $self->SUPER::batch_mode_page_object_init(@_[1..$#_]); + $self->batch( $batch ); + return $self; +} + 1;