mmark-cli 0.0.3.0 → 0.0.4.0
raw patch · 4 files changed
+38/−27 lines, 4 filesdep ~megaparsecdep ~mmarkdep ~stache
Dependency ranges changed: megaparsec, mmark, stache
Files
- CHANGELOG.md +4/−0
- README.md +3/−3
- app/Main.hs +17/−14
- mmark-cli.cabal +14/−10
CHANGELOG.md view
@@ -1,3 +1,7 @@+## MMark CLI 0.0.4.0++* This version works with `mmark-0.0.6.0` and `megaparsec-7.0.0`.+ ## MMark CLI 0.0.3.0 * This version works with `mmark-ext-0.2.0.0` and later.
README.md view
@@ -6,7 +6,7 @@ [](http://stackage.org/lts/package/mmark-cli) [](https://travis-ci.org/mmark-md/mmark-cli) -* [Templates](#tepmlates)+* [Templates](#templates) * [Extensions](#extensions) * [Comment paragraph](#comment-paragraph) * [Font Awesome](#font-awesome)@@ -21,8 +21,8 @@ * [Contribution](#contribution) * [License](#license) -This is a command line application serving as an interface to MMark markdown-processor.+This is a command line application serving as an interface to the MMark+markdown processor. ``` mmark—command line interface to MMark markdown processor
app/Main.hs view
@@ -10,7 +10,6 @@ import Control.Monad import Data.Aeson ((.=), Value (..)) import Data.List (intercalate)-import Data.List.NonEmpty (NonEmpty (..)) import Data.Text (Text) import Data.Version (showVersion) import Data.Void@@ -20,7 +19,7 @@ import System.Directory (makeAbsolute) import System.Exit (exitFailure) import Text.MMark (MMarkErr)-import Text.Megaparsec (Parsec, ParseError, SourcePos (..))+import Text.Megaparsec (Parsec, ParseErrorBundle (..), SourcePos (..)) import qualified Data.Aeson as Aeson import qualified Data.ByteString.Lazy.Char8 as BL import qualified Data.HashMap.Strict as HM@@ -47,10 +46,10 @@ absFile <- makeAbsolute file (absFile,) <$> T.readFile absFile case MMark.parse mdFileName mdInput of- Left errs -> do+ Left bundle -> do if optJson- then (BL.putStrLn . Aeson.encode . parseErrorsJson) errs- else putStr (MMark.parseErrorsPretty mdInput errs)+ then (BL.putStrLn . Aeson.encode . parseErrorsJson) bundle+ else putStr (M.errorBundlePretty bundle) exitFailure Right doc -> do let exts = mconcat@@ -129,8 +128,8 @@ optsParserInfo :: ParserInfo Opts optsParserInfo = info (helper <*> ver <*> optsParser) . mconcat $ [ fullDesc- , progDesc "Command line interface to MMark markdown processor"- , header "mmark—command line interface to MMark markdown processor"+ , progDesc "Command line interface to the MMark markdown processor"+ , header "mmark—command line interface to the MMark markdown processor" ] where ver :: Parser (a -> a)@@ -223,13 +222,17 @@ ---------------------------------------------------------------------------- -- Helpers --- | Represent the given collection of parse errors as 'Value'.+-- | Represent the given collection of parse errors as a 'Value'. -parseErrorsJson :: NonEmpty (ParseError Char MMarkErr) -> Value-parseErrorsJson = Aeson.toJSON . fmap parseErrorObj+parseErrorsJson :: ParseErrorBundle Text MMarkErr -> Value+parseErrorsJson ParseErrorBundle {..}+ = Aeson.toJSON+ . fmap parseErrorObj+ . fst+ $ M.attachSourcePos M.errorOffset bundleErrors bundlePosState where- parseErrorObj :: ParseError Char MMarkErr -> Value- parseErrorObj err = let (SourcePos {..}:|_) = M.errorPos err in Aeson.object+ parseErrorObj :: (M.ParseError Text MMarkErr, SourcePos) -> Value+ parseErrorObj (err, SourcePos {..}) = Aeson.object [ "file" .= sourceName , "line" .= M.unPos sourceLine , "column" .= M.unPos sourceColumn@@ -248,8 +251,8 @@ parseRange :: ReadM (Int, Int) parseRange = eitherReader $ \s -> case M.parse p "" s of- Left err -> Left (M.parseErrorTextPretty err)- Right x -> Right x+ Left bundle -> Left (M.errorBundlePretty bundle)+ Right x -> Right x where p :: Parsec Void String (Int, Int) p = do
mmark-cli.cabal view
@@ -1,7 +1,7 @@ name: mmark-cli-version: 0.0.3.0-cabal-version: >= 1.18-tested-with: GHC==8.0.2, GHC==8.2.2+version: 0.0.4.0+cabal-version: 1.18+tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.3 license: BSD3 license-file: LICENSE.md author: Mark Karpov <markkarpov92@gmail.com>@@ -9,9 +9,9 @@ homepage: https://github.com/mmark-md/mmark-cli bug-reports: https://github.com/mmark-md/mmark-cli/issues category: Text, CLI-synopsis: Command line interface to MMark markdown processor+synopsis: Command line interface to the MMark markdown processor build-type: Simple-description: Command line interface to MMark markdown processor.+description: Command line interface to the MMark markdown processor. extra-doc-files: CHANGELOG.md , README.md @@ -27,22 +27,26 @@ executable mmark main-is: Main.hs hs-source-dirs: app- build-depends: aeson >= 0.11 && < 1.3+ build-depends: aeson >= 0.11 && < 1.5 , base >= 4.9 && < 5.0 , bytestring >= 0.9.2 && < 0.11 , directory >= 1.2.2 && < 1.4 , gitrev >= 1.3 && < 1.4 , lucid >= 2.6 && < 3.0- , megaparsec >= 6.4 && < 7.0- , mmark >= 0.0.4 && < 0.1+ , megaparsec >= 7.0 && < 8.0+ , mmark >= 0.0.6 && < 0.1 , mmark-ext >= 0.2 && < 0.3 , optparse-applicative >= 0.14 && < 0.15- , stache >= 1.2 && < 1.3+ , stache >= 2.0 && < 3.0 , text >= 0.2 && < 1.3 , unordered-containers >= 0.2.5 && < 0.3 other-modules: Paths_mmark_cli if flag(dev)- ghc-options: -Wall -Werror+ ghc-options: -Wall -Werror -Wcompat+ -Wincomplete-record-updates+ -Wincomplete-uni-patterns+ -Wnoncanonical-monad-instances+ -Wnoncanonical-monadfail-instances else ghc-options: -O2 -Wall default-language: Haskell2010