git.iko.soy/typeable/pandoc
on master help sign in
Avoid using deprecated 'decode' from yaml.
commitedce81734e3ba80773920dafd5bb60c3528fbacd authorJohn MacFarlane <jgm@berkeley.edu> dateThu 28 Jun 2018, 17:38 (8 years ago) parent7b3cc7d
1 file changed+5−5
src/Text/Pandoc/App.hs+5−5
src/Text/Pandoc/App.hs+5−5
@@ -62,7 +62,7 @@ import qualified Data.Text as T
6262import qualified Data.Text.Lazy as TL
6363import qualified Data.Text.Lazy.Encoding as TE
6464import qualified Data.Text.Encoding.Error as TE
65−import Data.Yaml (decode)
65+import Data.Yaml (decodeEither)
6666import qualified Data.Yaml as Yaml
6767import GHC.Generics
6868import Network.URI (URI (..), parseURI)
@@ -702,10 +702,10 @@ removeMetaKeys :: [(String,String)] -> Pandoc -> Pandoc
702702removeMetaKeys kvs pdc = foldr (deleteMeta . fst) pdc kvs
703703
704704readMetaValue :: String -> MetaValue
705−readMetaValue s = case decode (UTF8.fromString s) of
706− Just (Yaml.String t) -> MetaString $ T.unpack t
707− Just (Yaml.Bool b) -> MetaBool b
708− _ -> MetaString s
705+readMetaValue s = case decodeEither (UTF8.fromString s) of
706+ Right (Yaml.String t) -> MetaString $ T.unpack t
707+ Right (Yaml.Bool b) -> MetaBool b
708+ _ -> MetaString s
709709
710710-- Determine default reader based on source file extensions
711711defaultReaderName :: String -> [FilePath] -> String