Skip to content

Commit

Permalink
Allow L<text|schem:...> tags.
Browse files Browse the repository at this point in the history
As of the latest `perlpod` and `perlpodspec` committed to blead and forthcoming in Perl 5.12, and now included in Pod::Simple 3.11, on CPAN, the  formerly disallowed `L<text|schem:...>` tags are now allowed. Pod::Simple 3.11 has been updated to take full advantage of this format in all output formats (including plain text). Thus, it makes sense for Pod::Test to now allow this tag. It also simplifies the code a bit. :-)
  • Loading branch information
theory committed Dec 11, 2009
1 parent 5eeaf3f commit ae6a448
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 89 deletions.
2 changes: 0 additions & 2 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ t/empty-file.pod
t/good.t
t/item-ordering.pod
t/item-ordering.t
t/link.pod
t/link.t
t/load.t
t/missing-file.t
t/pod.t
Expand Down
44 changes: 2 additions & 42 deletions Pod.pm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ use 5.008;

use Test::Builder;
use File::Spec;
use Pod::Simple;

our %ignore_dirs = (
'.bzr' => 'Bazaar',
Expand Down Expand Up @@ -126,7 +127,7 @@ sub pod_file_ok {
return;
}

my $checker = Test::Pod::_parser->new;
my $checker = Pod::Simple->new;

$checker->output_string( \my $trash ); # Ignore any output
$checker->parse_file( $file );
Expand Down Expand Up @@ -290,44 +291,3 @@ as the Artistic License v2.0 or GNU Public License v2.0.
=cut

1;

package Test::Pod::_parser;
use base 'Pod::Simple';
use strict;

sub _handle_element_start {
my($parser, $element_name, $attr_hash_r) = @_;

# Curiously, Pod::Simple supports L<text|scheme:...> rather well.

if( $element_name eq "L" and $attr_hash_r->{type} eq "url") {
$parser->{_state_of_concern}{'Lurl'} = $attr_hash_r->{to};
}

return $parser->SUPER::_handle_element_start(@_);
}

sub _handle_element_end {
my($parser, $element_name) = @_;

delete $parser->{_state_of_concern}{'Lurl'}
if $element_name eq "L" and exists $parser->{_state_of_concern}{'Lurl'};

return $parser->SUPER::_handle_element_end(@_);
}

sub _handle_text {
my($parser, $text) = @_;
if( my $href = $parser->{_state_of_concern}{'Lurl'} ) {
if( $href ne $text ) {
my $line = $parser->line_count() -2; # XXX: -2, WHY WHY WHY??

$parser->whine($line, "L<text|scheme:...> is invalid according to perlpod");
}
}

return $parser->SUPER::_handle_text(@_);
}

1;

25 changes: 0 additions & 25 deletions t/link.pod

This file was deleted.

20 changes: 0 additions & 20 deletions t/link.t

This file was deleted.

0 comments on commit ae6a448

Please sign in to comment.