Skip to content

Commit

Permalink
Match HTML declaration blocks with lowercase letters
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle authored and jgm committed Jan 27, 2024
1 parent 4f79ac4 commit 113ac67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions commonmark/src/Commonmark/Blocks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import Control.Monad (foldM, guard, mzero, void, unless,
when)
import Control.Monad.Trans.Class (lift)
import Data.Foldable (foldrM)
import Unicode.Char (isAsciiUpper, isDigit)
import Unicode.Char (isAsciiUpper, isAsciiLower, isDigit)
import Unicode.Char.General.Compat (isSpace)
import Data.Dynamic
import Data.Text (Text)
Expand Down Expand Up @@ -1165,7 +1165,7 @@ startCond 3 = void $ symbol '?'
startCond 4 = void $ try $ do
symbol '!'
satisfyWord (\t -> case T.uncons t of
Just (c, _) -> isAsciiUpper c
Just (c, _) -> isAsciiLetter c
_ -> False)
startCond 5 = void $ try $ do
symbol '!'
Expand Down Expand Up @@ -1231,6 +1231,10 @@ removeConsecutive (x:y:zs)
| x == y + 1 = removeConsecutive (y:zs)
removeConsecutive xs = xs

isAsciiLetter :: Char -> Bool
isAsciiLetter c =
isAsciiUpper c || isAsciiLower c

-------------------------------------------------------------------------

collapseNodeStack :: [BlockNode m il bl] -> BlockParser m il bl (BlockNode m il bl)
Expand Down
14 changes: 14 additions & 0 deletions commonmark/test/regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,17 @@ Test <span> x <span>
<p>Test <span> <span></p>
<p>Test <span> x <span></p>
````````````````````````````````


Issue #142
```````````````````````````````` example
<!X
>
<!x
>
.
<!X
>
<!x
>
````````````````````````````````
Expand Down

0 comments on commit 113ac67

Please sign in to comment.