packages feed

commonmark-extensions 0.2.1.1 → 0.2.1.2

raw patch · 4 files changed

+14/−3 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,5 +1,10 @@ # Changelog for commonmark-extensions +## 0.2.1.2++- Fix bug with absolute paths in rebase_relative_paths+  extension on Windows.+ ## 0.2.1.1  - Fix bug in wikilinks extensions.
commonmark-extensions.cabal view
@@ -1,5 +1,5 @@ name:           commonmark-extensions-version:        0.2.1.1+version:        0.2.1.2 synopsis:       Pure Haskell commonmark parser. description:    This library provides some useful extensions to core commonmark
src/Commonmark/Extensions/RebaseRelativePaths.hs view
@@ -14,6 +14,8 @@ import Text.Parsec (getPosition) import Text.Parsec.Pos (sourceName) import System.FilePath+import qualified System.FilePath.Windows as Windows+import qualified System.FilePath.Posix as Posix import Network.URI (URI (uriScheme), parseURI) import qualified Data.Set as Set #if !MIN_VERSION_base(4,11,0)@@ -66,7 +68,9 @@ rebasePath pos path = do   let fp = sourceName pos       isFragment = T.take 1 path == "#"-   in if T.null path || isFragment || isAbsolute (T.unpack path) || isURI path+      path' = T.unpack path+      isAbsolutePath = Posix.isAbsolute path' || Windows.isAbsolute path'+   in if T.null path || isFragment || isAbsolutePath || isURI path          then path          else            case takeDirectory fp of
test/test-commonmark-extensions.hs view
@@ -156,6 +156,7 @@             , "![image]()"             , "[link](#foobar)"             , "![image][ref]"+            , "![image](/absolute/path.jpg)"             , ""             ]   let mdref = "[ref]: baz.png"@@ -168,7 +169,8 @@                  , "<a href=\"http://example.com/foo.jpg\">link</a>"                  , "<img src=\"\" alt=\"image\" />"                  , "<a href=\"#foobar\">link</a>"-                 , "<img src=\"extra/baz.png\" alt=\"image\" /></p>"+                 , "<img src=\"extra/baz.png\" alt=\"image\" />"+                 , "<img src=\"/absolute/path.jpg\" alt=\"image\" /></p>"                  ]   testCase "rebase_relative_paths" (actual @?= expected)