Skip to content

Commit

Permalink
Improved HTML escaping in index anchors.
Browse files Browse the repository at this point in the history
  • Loading branch information
chromatic committed Mar 23, 2012
1 parent 8df68b9 commit a1df6dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Pod/PseudoPod/DOM/Role/XHTML.pm
Expand Up @@ -246,8 +246,7 @@ sub encode_index_anchor


$text =~ s/^\*//; $text =~ s/^\*//;
$text =~ s/[\s"]//g; $text =~ s/[\s"]//g;
$text =~ s/</&lt;/g; $text = encode_entities($text);
$text =~ s/>/&gt;/g;


return $text; return $text;
} }
Expand Down
3 changes: 3 additions & 0 deletions t/html/escapes.t
Expand Up @@ -83,6 +83,9 @@ like_string $result, qr/<a name="codeanditalicstext1">/,
like_string $result, qr/<a name="&lt;=&gt;;numericcomparisonoperator1">/, like_string $result, qr/<a name="&lt;=&gt;;numericcomparisonoperator1">/,
'... and should escape <> symbols'; '... and should escape <> symbols';


like_string $result, qr/<a name="sigils;&amp;1">/,
'... in index anchors as well';

like_string $result, qr/<li>\$BANG BANG\$<p>/, like_string $result, qr/<li>\$BANG BANG\$<p>/,
'escapes work inside items first line'; 'escapes work inside items first line';


Expand Down
1 change: 1 addition & 0 deletions t/test_file.pod
Expand Up @@ -82,6 +82,7 @@ behavior (C<$some_variable-->) should be fine too. C<'single quotes'> need to
be single quotes, not fancy curly apostrophes. be single quotes, not fancy curly apostrophes.


X<Special formatting> X<Special formatting>
X<sigils; &>


Index entries are more fun, as more special characters must be escaped, with a 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 quote sign. E.g. X<negation ! operator>, X<array @ sigil>, X<the pipe |> and
Expand Down

0 comments on commit a1df6dd

Please sign in to comment.