commonmark 0.1.0.0 → 0.1.0.1
raw patch · 8 files changed
+45/−21 lines, 8 filesdep −semigroupsdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: semigroups
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- README.md +2/−0
- changelog.md +10/−1
- commonmark.cabal +5/−6
- src/Commonmark/Blocks.hs +2/−4
- src/Commonmark/Inlines.hs +2/−4
- src/Commonmark/TokParsers.hs +3/−2
- src/Commonmark/Tokens.hs +3/−4
- test/regression.md +18/−0
README.md view
@@ -1,5 +1,7 @@ # commonmark +[](http://hackage.haskell.org/package/commonmark)+ This package provides the core parsing functionality for commonmark, together with HTML renderers.
changelog.md view
@@ -1,3 +1,12 @@ # Changelog for commonmark -## Unreleased changes+## 0.1.0.1++* Set source position when we add a token in gobbleSpaces (#54).+ This fixes a bug in gobbling indented spaces in some nested contexts.+* Drop support for ghc 7.10/base 4.8. We need StrictData.+ Move SCC annotations; ghc 8.0.x doesn't support them on declarations.++## 0.1.0.0++* Initial release
commonmark.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: commonmark-version: 0.1.0.0+version: 0.1.0.1 synopsis: Pure Haskell commonmark parser. description: This library provides the core data types and functions@@ -54,14 +54,12 @@ hs-source-dirs: src build-depends:- base >=4.7 && <5+ base >= 4.9 && <5 , text , bytestring , containers , transformers , parsec- if !impl(ghc >= 8.0)- build-depends: semigroups == 0.18.* exposed-modules: Commonmark Commonmark.Parser@@ -80,6 +78,7 @@ ghc-options: -fwrite-ide-info -hiedir=.hie ghc-options: -Wall -fno-warn-unused-do-bind -funbox-small-strict-fields default-language: Haskell2010+ other-extensions: StrictData test-suite test-commonmark type: exitcode-stdio-1.0@@ -88,7 +87,7 @@ test ghc-options: -threaded -rtsopts -with-rtsopts=-K40K build-depends:- base >=4.7 && <5+ base >= 4.9 && <5 , commonmark , text , tasty@@ -104,7 +103,7 @@ hs-source-dirs: benchmark build-depends: commonmark- , base >= 4.8 && < 5+ , base >= 4.9 && < 5 , text , transformers , containers
src/Commonmark/Blocks.hs view
@@ -106,7 +106,7 @@ => [BlockSpec m il bl] -> [BlockParser m il bl bl] -- ^ Parsers to run at end -> BlockParser m il bl bl-processLines specs finalParsers = do+processLines specs finalParsers = {-# SCC processLines #-} do let go = eof <|> (processLine specs >> go) in go tree <- (nodeStack <$> getState) >>= collapseNodeStack updateState $ \st -> st{ nodeStack = [reverseSubforests tree] }@@ -114,7 +114,6 @@ tree':_ <- nodeStack <$> getState body <- blockConstructor (blockSpec (rootLabel tree')) tree' return $! body <> endContent-{-# SCC processLines #-} reverseSubforests :: Tree a -> Tree a reverseSubforests (Node x cs) = Node x $ map reverseSubforests $ reverse cs@@ -384,7 +383,7 @@ runInlineParser :: Monad m => [Tok] -> BlockParser m il bl il-runInlineParser toks = do+runInlineParser toks = {-# SCC runInlineParser #-} do refmap <- referenceMap <$> getState ilParser <- inlineParser <$> getState res <- lift $ ilParser refmap toks@@ -392,7 +391,6 @@ Right ils -> return $! ils Left err -> mkPT (\_ -> return (Empty (return (Error err)))) -- pass up ParseError-{-# SCC runInlineParser #-} addRange :: (Monad m, IsBlock il bl) => BlockNode m il bl -> bl -> bl
src/Commonmark/Inlines.hs view
@@ -563,7 +563,7 @@ let left = leftCursor st right = rightCursor st bottoms = stackBottoms st- in case -- trace (prettyCursors left right)+ in {-# SCC processEm #-} case -- trace (prettyCursors left right) (center left, center right) of (_, Nothing) -> reverse $ case center (rightCursor st) of@@ -646,7 +646,6 @@ _ -> processEm st{ rightCursor = moveRight right , leftCursor = moveRight left }-{-# SCC processEm #-} -- This only applies to emph delims, not []: delimsMatch :: IsInline a@@ -708,7 +707,7 @@ bottoms = stackBottoms st bottom = absoluteBottom st -- trace (prettyCursors left right) $ return $! ()- in case (center left, center right) of+ in {-# SCC processBs #-} case (center left, center right) of (_, Nothing) -> reverse $ case center (rightCursor st) of Nothing -> befores (rightCursor st)@@ -843,7 +842,6 @@ (_, _) -> processBs bracketedSpecs st{ rightCursor = moveRight right }-{-# SCC processBs #-} -- This just changes a single quote Delim that occurs
src/Commonmark/TokParsers.hs view
@@ -115,10 +115,11 @@ n | n < numspaces -> (+ n) <$> gobble' requireAll (numspaces - n) | n == numspaces -> return $! n | otherwise -> do- let newtok = Tok Spaces- (incSourceColumn pos numspaces)+ let newpos = incSourceColumn pos numspaces+ let newtok = Tok Spaces newpos (T.replicate (n - numspaces) " ") getInput >>= setInput . (newtok:)+ setPosition $ newpos return $! numspaces) <|> if requireAll then mzero
src/Commonmark/Tokens.hs view
@@ -34,7 +34,7 @@ -- | Convert a 'Text' into a list of 'Tok'. The first parameter -- species the source name. tokenize :: String -> Text -> [Tok]-tokenize name = go (initialPos name) . T.groupBy f+tokenize name = {-# SCC tokenize #-} go (initialPos name) . T.groupBy f where -- We group \r\n, consecutive spaces, and consecutive alphanums; -- everything else gets in a token by itself.@@ -64,10 +64,9 @@ | otherwise -> Tok (Symbol thead) pos t : go (incSourceColumn pos 1) ts-{-# SCC tokenize #-} -- | Reverses 'tokenize'. @untokenize . tokenize@ should be -- the identity. untokenize :: [Tok] -> Text-untokenize = mconcat . map tokContents-{-# SCC untokenize #-}+untokenize = {-# SCC untokenize #-} mconcat . map tokContents+
test/regression.md view
@@ -154,3 +154,21 @@ . <p>[a](<b) c></p> ````````````````````````````````++Issue #54.++```````````````````````````````` example+1. Point 1+ ```bash+ date+ pwd+ ```+.+<ol>+<li>Point 1+<pre><code class="language-bash">date+pwd+</code></pre>+</li>+</ol>+````````````````````````````````