packages feed

commonmark-extensions 0.2.3.2 → 0.2.3.3

raw patch · 4 files changed

+41/−7 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,5 +1,12 @@ # Changelog for commonmark-extensions +## 0.2.3.3++  - Fix definition_lists extension (#96). We were not properly consuming+    indentation in definitions, which caused problems when the definitions+    themselves contained lists.++ ## 0.2.3.2  - Update lower version bounds for commonmark (#93, David
commonmark-extensions.cabal view
@@ -1,5 +1,5 @@ name:           commonmark-extensions-version:        0.2.3.2+version:        0.2.3.3 synopsis:       Pure Haskell commonmark parser. description:    This library provides some useful extensions to core commonmark
src/Commonmark/Extensions/DefinitionList.hs view
@@ -81,21 +81,27 @@      }  - definitionListDefinitionBlockSpec ::    (Monad m, IsBlock il bl, IsInline il, HasDefinitionList il bl)    => BlockSpec m il bl definitionListDefinitionBlockSpec = BlockSpec      { blockType           = "DefinitionListDefinition"      , blockStart          = try $ do-         n <- gobbleUpToSpaces 3+         initcol <- sourceColumn <$> getPosition+         gobbleUpToSpaces 3          pos <- getPosition          symbol ':' <|> symbol '~'-         gobbleSpaces (min 1 (3 - n))+         try (gobbleUpToSpaces 4 <* notFollowedBy whitespace)+           <|> gobbleSpaces 1+           <|> 1 <$ lookAhead lineEnd+         finalcol <- sourceColumn <$> getPosition          (Node bdata children : rest) <- nodeStack <$> getState+         let definitionIndent :: Int+             definitionIndent = finalcol - initcol          let defnode = Node (defBlockData                               definitionListDefinitionBlockSpec){-                                  blockStartPos = [pos] } []+                                  blockStartPos = [pos],+                                  blockData = toDyn definitionIndent } []          if blockType (blockSpec bdata) == "DefinitionListItem"             then addNodeToStack defnode             else do@@ -153,9 +159,10 @@      , blockCanContain     = const True      , blockContainsLines  = False      , blockParagraph      = False-     , blockContinue       = \node -> do+     , blockContinue       = \node@(Node ndata _cs) -> do          pos <- getPosition-         gobbleSpaces 4 <|> 0 <$ lookAhead blankLine+         let definitionIndent = fromDyn (blockData ndata) 0+         gobbleSpaces definitionIndent <|> 0 <$ lookAhead blankLine          return $! (pos, node)      , blockConstructor    = fmap mconcat . renderChildren      , blockFinalize       = defaultFinalizer
test/definition_lists.md view
@@ -126,6 +126,26 @@ </dl> ```````````````````````````````` +Nested lists:++```````````````````````````````` example+term++:   1. Para one++       Para two+.+<dl>+<dt>term</dt>+<dd>+<ol>+<li><p>Para one</p>+<p>Para two</p></li>+</ol>+</dd>+</dl>+````````````````````````````````+ Multiple definitions, tight:  ```````````````````````````````` example