Subject: | Proposed correction for bugs #1949 and #5759 |
Hi,
As described in tickets #1949 and #5759, the content =begin/=end blocks
should be treated as data text (no sequence parsing, etc).
The attached patch (against version 0.17) prevent such processing of
=begin/=end blocks.
The Pod::POM::View::HTML view has been modified as well (which required
a change to the t/htmlview.t test file).
Best regards,
BooK
Subject: | pod-pom.patch.txt |
diff -ru Pod-POM-0.17/lib/Pod/POM/Node.pm Pod-POM/lib/Pod/POM/Node.pm
--- Pod-POM-0.17/lib/Pod/POM/Node.pm 2003-07-24 17:41:00.000000000 +0200
+++ Pod-POM/lib/Pod/POM/Node.pm 2007-01-08 02:57:44.000000000 +0100
@@ -146,12 +146,14 @@
unless defined $node;
push(@{ $self->{ $type } }, $node);
push(@{ $self->{ content } }, $node);
+ $pom->{in_begin} = 1 if $nodeclass eq 'Pod::POM::Node::Begin';
return $node;
}
# REDUCE: expect indicates the token that should terminate this node
if (defined $expect && ($type eq $expect)) {
DEBUG("$name terminated by expected $type\n");
+ $pom->{in_begin} = 0 if $name eq 'begin';
return REDUCE;
}
diff -ru Pod-POM-0.17/lib/Pod/POM/Nodes.pm Pod-POM/lib/Pod/POM/Nodes.pm
--- Pod-POM-0.17/lib/Pod/POM/Nodes.pm 2002-12-06 13:48:57.000000000 +0100
+++ Pod-POM/lib/Pod/POM/Nodes.pm 2007-01-08 02:54:31.000000000 +0100
@@ -204,7 +204,7 @@
my $text = shift;
$text = $pom->parse_sequence($text)
|| return $class->error($pom->error())
- if length $text;
+ if length $text && ! $pom->{in_begin};
$class->SUPER::new($pom, $text);
}
diff -ru Pod-POM-0.17/lib/Pod/POM/View/HTML.pm Pod-POM/lib/Pod/POM/View/HTML.pm
--- Pod-POM-0.17/lib/Pod/POM/View/HTML.pm 2002-03-18 08:47:36.000000000 +0100
+++ Pod-POM/lib/Pod/POM/View/HTML.pm 2007-01-08 10:10:42.000000000 +0100
@@ -196,7 +196,7 @@
sub view_textblock {
my ($self, $text) = @_;
- return "<p>$text</p>\n";
+ return $HTML_PROTECT ? "$text\n" : "<p>$text</p>\n";
}
diff -ru Pod-POM-0.17/t/htmlview.t Pod-POM/t/htmlview.t
--- Pod-POM-0.17/t/htmlview.t 2002-03-18 08:47:37.000000000 +0100
+++ Pod-POM/t/htmlview.t 2007-01-08 10:14:33.000000000 +0100
@@ -286,10 +286,10 @@
</p>
<p>intermediate text</p>
-<p><more>
+<more>
HTML
-</more></p>
-<p>some text</p>
+</more>
+some text
<h1>TESTING URLs hyperlinking</h1>
<p>This is an href link1: <a href="http://example.com">http://example.com</a></p>