From ac0de467abd735beb59cf836ebcea44803f150cb Mon Sep 17 00:00:00 2001 From: Christophe HENRY Date: Mon, 8 Mar 2021 10:41:59 +0100 Subject: [PATCH] Improves processing of ^^^ and ^ --- htmgem.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htmgem.php b/htmgem.php index ca7a4af..eb213f6 100644 --- a/htmgem.php +++ b/htmgem.php @@ -103,14 +103,16 @@ foreach ($fileLines as $line) { if (empty($line)) { echo "

 

\n"; } elseif ('^^^' == $line3) { - $mode_textAttributes = !$mode_textAttributes; - } elseif ('^' == $line1) { - if (preg_match("/^\^\s*(.*)$/", $line, $parts)) { - $line = $parts[1]; - $mode_textAttributes_temp = true; + if (preg_match("/^\^\^\^\s+(.*)$/", $line)) { + $mode_textAttributes = !$mode_textAttributes; } else { $mode = "raw"; + continue; } + } elseif ('^' == $line1 and !$mode_textAttributes_temp) { + preg_match("/^\^\s*(.*)$/", $line, $parts); + $line = $parts[1]; + $mode_textAttributes_temp = true; continue; } elseif ("#" == $line1) { preg_match("/^(#{1,3})\s*(.*)/", $line, $sharps);