From 33fd0435815b1ab4c383c5b76bd49526caf14da6 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 30 Sep 2020 13:39:14 -0700 Subject: [PATCH] Markdown.pl: recognize U+00D7 for "x" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When parsing a "checkbox" item or image dimensions, recognize a U+00D7 Multiplication Sign character as equivalent to an "x". The real "x" is preferred (and still recognized along with "X"), but in the case where a U+00D7 (×) ends up in there, just go with it and recognize it as the intent remains clear. Signed-off-by: Kyle J. McKay --- Markdown.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Markdown.pl b/Markdown.pl index e7de390..75576c7 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -1255,11 +1255,11 @@ sub _MakeIMGTag { my $result = $g_escape_table{'<'}."img src=\"" . _EncodeAttText($url) . "\""; my ($w, $h) = (0, 0); ($alt, $title) = (_strip($alt), _strip($title)); - if ($title =~ /^(.*)\(([1-9][0-9]*)[xX]([1-9][0-9]*)\)$/os) { + if ($title =~ /^(.*)\(([1-9][0-9]*)[xX\xd7]([1-9][0-9]*)\)$/os) { ($title, $w, $h) = (_strip($1), $2, $3); - } elsif ($title =~ /^(.*)\(\?[xX]([1-9][0-9]*)\)$/os) { + } elsif ($title =~ /^(.*)\(\?[xX\xd7]([1-9][0-9]*)\)$/os) { ($title, $h) = (_strip($1), $2); - } elsif ($title =~ /^(.*)\(([1-9][0-9]*)[xX]\?\)$/os) { + } elsif ($title =~ /^(.*)\(([1-9][0-9]*)[xX\xd7]\?\)$/os) { ($title, $w) = (_strip($1), $2); } $result .= " alt=\"" . _EncodeAttText($alt) . "\"" if $alt ne ""; @@ -1901,11 +1901,11 @@ sub _ProcessListItems { my $checkbox = ''; my $incr = ''; - if ($list_type eq "ul" && !$leading_item_space && $item =~ /^\[([ xX])\] +(.*)$/s) { - my $checkmark = lc $1; + if ($list_type eq "ul" && !$leading_item_space && $item =~ /^\[([ xX\xd7])\] +(.*)$/s) { + my $checkmark = $1; $item = $2; my ($checkbox_class, $checkbox_val); - if ($checkmark eq "x") { + if ($checkmark ne " ") { ($checkbox_class, $checkbox_val) = ("checkbox-on", "x"); } else { ($checkbox_class, $checkbox_val) = ("checkbox-off", " ");