Browse Source

Markdown.pl: allow '/' in auto-quoted attribute values

When auto-quoting the attribute value of something like this:

    <a href=http://example.com/test/>test</a>

Do not stop at the first "/", instead pick up the entire value.

Of course, whitespace will still terminate the value being auto-quoted.

Additionally, when checking the end of the tag to see if it's
self-closing (e.g. "<br/>") do not include the final character of
any value that may have been picked up by the auto-quoting process.

For the example above, that prevents the opening "a" tag from
mistakenly being considered self-closing just because the value
being auto-quoted happens to end in a "/" and butts right up against
the final ">" of the tag.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 3 years ago
parent
commit
a3c4d34b75
  1. 6
      Markdown.pl

6
Markdown.pl

@ -3791,7 +3791,7 @@ sub _Sanitize {
++$atc;
next;
}
if ($tag =~ /\G([^\s<\/>]+)\s*/gcs) {
if ($tag =~ m{\G([^\s<>]+)\s*}gcs) {
# auto quote it
my $v = $1;
$v =~ s/\042/&quot;/go;
@ -3807,11 +3807,11 @@ sub _Sanitize {
$out =~ s/\s+$//;
my $typ = 1;
if ($tagmt{$tt}) {
$typ = ($tag =~ m,/>$,) ? 3 : -3;
$typ = ($sfx =~ m,/>$,) ? 3 : -3;
$out .= $opt{empty_element_suffix};
return ("&lt;" . substr($tag,1), 0) if !$atc && $taga1p{$tt};
} else {
if ($tag =~ m,/>$,) {
if ($sfx =~ m,/>$,) {
return ("&lt;" . substr($tag,1), 0) if !$atc && $taga1p{$tt};
$typ = 3;
} else {

Loading…
Cancel
Save