Permalink
Browse files

Added HTML entity encoding to E<> in index tags.

  • Loading branch information...
1 parent 7c455a4 commit 3fd15b4c0cde790b621156a334281de2ed90b564 @chromatic committed Mar 24, 2012
Showing with 13 additions and 4 deletions.
  1. +9 −4 lib/Pod/PseudoPod/DOM/Role/XHTML.pm
  2. +3 −0 t/html/escapes.t
  3. +1 −0 t/test_file.pod
@@ -67,16 +67,21 @@ my %characters = (
sub emit_character
{
- my $self = shift;
- my $content = eval { $self->emit_kids( @_ ) };
- return '' unless defined $content;
+ my ($self, %args) = @_;
+ my $content = eval { $self->emit_kids( %args ) };
+
+ return '' unless defined $content;
if (my ($char, $class) = $content =~ /(\w)(\w+)/)
{
return $characters{$class}->($char) if exists $characters{$class};
}
- return Pod::Escapes::e2char( $content )
+ my $char = Pod::Escapes::e2char( $content );
+
+ $args{encode} ||= '';
+ return $char unless $args{encode} =~ /^(index_|id$)/;
+ return $self->encode_index_anchor($char);
}
sub emit
View
@@ -89,6 +89,9 @@ like_string $result, qr/<a name="sigils;&amp;1">/,
like_string $result, qr/<a name="\.tfiles1">/,
'... and should suppress HTML tags in index anchors';
+like_string $result, qr/<a name="operators;&lt;1">/,
+ '... encoding entities as necessary';
+
like_string $result, qr/<li>\$BANG BANG\$<p>/,
'escapes work inside items first line';
View
@@ -84,6 +84,7 @@ be single quotes, not fancy curly apostrophes.
X<Special formatting>
X<sigils; &>
X<F<.t> files>
+X<<< operators; C<< E<lt> >> >>>
Index entries are more fun, as more special characters must be escaped, with a
quote sign. E.g. X<negation ! operator>, X<array @ sigil>, X<the pipe |> and

0 comments on commit 3fd15b4

Please sign in to comment.