From 35c983c9f06d0a0f1a635648a156c945d60d924a Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 15 Mar 2021 22:41:52 -0700 Subject: [PATCH] Markdown.pl: do not choke on

etc. Adjust code to properly handle "empty" tags that are written as an open plus closing tag but do not contain any whitespace in the opening tag. The code already properly handles turning
into just
, but it was failing to handle that when the opening tag did not contain any whitespace such as

. Adjust the code to return the proper value for the opening tag under such a condition so that it's handled properly. Previously a sequence such as

would fail as it would end up being turned into

which then fails XML validation. Now it works properly and turns

into
as it should have been doing all along. Signed-off-by: Kyle J. McKay --- Markdown.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Markdown.pl b/Markdown.pl index 7635190..cbc240b 100755 --- a/Markdown.pl +++ b/Markdown.pl @@ -3750,7 +3750,8 @@ sub _Sanitize { my $tt = lc($1); return ("<" . substr($tag,1), 0) if $taga1p{$tt}; if ($tagmt{$tt}) { - return ("<" . $tt . $opt{empty_element_suffix}, 3); + my $typ = ($tag =~ m,/>$,) ? 3 : -3; + return ("<" . $tt . $opt{empty_element_suffix}, $typ); } elsif ($tag =~ m,/>$,) { return ("<" . $tt . ">", 3); } else {