Browse files

Fixed filename references in HTML emitter.

  • Loading branch information...
1 parent efd30bf commit d7a191cf006267ee38cc6bff445b50cfbea9060a @chromatic committed Mar 21, 2012
Showing with 10 additions and 7 deletions.
  1. +4 −1 lib/Pod/PseudoPod/DOM.pm
  2. +1 −1 t/html/basic.t
  3. +4 −4 t/html/tags.t
  4. +1 −1 t/lib/TestDOM.pm
View
5 lib/Pod/PseudoPod/DOM.pm
@@ -7,6 +7,7 @@ use warnings;
use parent 'Pod::PseudoPod';
use Class::Load;
+use File::Basename;
use Pod::PseudoPod::DOM::Elements;
sub new
@@ -18,6 +19,8 @@ sub new
$self->{formatter_role} = $role;
$self->{formatter_args} = $args{formatter_args} || {};
$self->{filename} = $args{filename};
+ ($self->{basefile}) = $self->{filename} =~ m!/?([^/]+)$!
+ if $self->{filename};
Class::Load::load_class( $role );
$self->accept_targets( $role->accept_targets );
@@ -228,7 +231,7 @@ BEGIN
{
my $self = shift;
$self->push_link_element( 'Text::' . ucfirst $type,
- type => $type, link => $self->{filename} );
+ type => $type, link => $self->{basefile} );
};
my $end_meth = sub
View
2 t/html/basic.t
@@ -244,7 +244,7 @@ A plain paragraph with a A<crossreferencelink>.
EOPOD
like $result,
- qr!paragraph with a <a href="$0\.tex#crossreferencelink">XREF header</a>!,
+ qr!paragraph with a <a href="basic.t.pod#crossreferencelink">XREF header<!,
'Link entity in a paragraph';
$result = parse( <<'EOPOD' );
View
8 t/html/tags.t
@@ -26,16 +26,16 @@ like_string $result, qr!<a name="slightlycomplex\?heading"></a>!,
like_string $result, qr!<a class="url" href="http://www.google.com/">!,
'U<> tag should become urls';
-like_string $result, qr!<a href="$0.tex#startofdocument">!,
+like_string $result, qr!<a href="tags.t.pod#startofdocument">!,
'L<> tag should become cross references';
-like_string $result, qr!<a href="$0.tex#startofdocument">!,
+like_string $result, qr!<a href="tags.t.pod#startofdocument">!,
'A<> tag should become cross references';
-like_string $result, qr!<a href="$0.tex#slightlycomplex\?heading">!,
+like_string $result, qr!<a href="tags.t.pod#slightlycomplex\?heading">!,
'... with appropriate quoting';
-like_string $result, qr!<a href="$0.tex#next_heading">!,
+like_string $result, qr!<a href="tags.t.pod#next_heading">!,
'... and non-quoting when appropriate';
done_testing;
View
2 t/lib/TestDOM.pm
@@ -11,7 +11,7 @@ sub import
my ($self, $formatter, @args) = @_;
my @caller = caller;
- my $filename = $caller[1] . '.tex';
+ my $filename = $caller[1] . '.pod';
my $parse = sub
{
my $doc = parse_document( $formatter, $filename, @_ );

0 comments on commit d7a191c

Please sign in to comment.