@@ -28,6 +28,7 @@ import qualified Data.Set as Set
28import Data.Text (Text)
28import Data.Text (Text)
29import qualified Data.Text as T
29import qualified Data.Text as T
30import qualified Data.YAML as YAML
30import qualified Data.YAML as YAML
31+import qualified Data.YAML.Event as YE
31import System.FilePath (addExtension, takeExtension)
32import System.FilePath (addExtension, takeExtension)
32import Text.HTML.TagSoup
33import Text.HTML.TagSoup
33import Text.Pandoc.Builder (Blocks, Inlines)
34import Text.Pandoc.Builder (Blocks, Inlines)
@@ -244,22 +245,22 @@ yamlBsToMeta :: PandocMonad m => BS.ByteString -> MarkdownParser m (F Meta)
244yamlBsToMeta bstr = do
245yamlBsToMeta bstr = do
245 pos <- getPosition
246 pos <- getPosition
246 case YAML.decodeNode' YAML.failsafeSchemaResolver False False bstr of
247 case YAML.decodeNode' YAML.failsafeSchemaResolver False False bstr of
247− Right ((YAML.Doc (YAML.Mapping _ o)):_) -> (fmap Meta) <$> yamlMap o
248+ Right ((YAML.Doc (YAML.Mapping _ _ o)):_) -> (fmap Meta) <$> yamlMap o
248 Right [] -> return . return $ mempty
249 Right [] -> return . return $ mempty
249− Right [YAML.Doc (YAML.Scalar YAML.SNull)] -> return . return $ mempty
250+ Right [YAML.Doc (YAML.Scalar _ YAML.SNull)] -> return . return $ mempty
250 Right _ -> do
251 Right _ -> do
251 logMessage $
252 logMessage $
252 CouldNotParseYamlMetadata "not an object"
253 CouldNotParseYamlMetadata "not an object"
254 return . return $ mempty
255 return . return $ mempty
255− Left err' -> do
256+ Left (_pos, err') -> do
256 logMessage $ CouldNotParseYamlMetadata
257 logMessage $ CouldNotParseYamlMetadata
258 return . return $ mempty
259 return . return $ mempty
260−nodeToKey :: Monad m => YAML.Node -> m Text
261+nodeToKey :: Monad m => YAML.Node YE.Pos -> m Text
261−nodeToKey (YAML.Scalar (YAML.SStr t)) = return t
262+nodeToKey (YAML.Scalar _ (YAML.SStr t)) = return t
262−nodeToKey (YAML.Scalar (YAML.SUnknown _ t)) = return t
263+nodeToKey (YAML.Scalar _ (YAML.SUnknown _ t)) = return t
263nodeToKey _ = fail "Non-string key in YAML mapping"
264nodeToKey _ = fail "Non-string key in YAML mapping"
265toMetaValue :: PandocMonad m
266toMetaValue :: PandocMonad m
@@ -291,8 +292,8 @@ checkBoolean t =
291 else Nothing
292 else Nothing
293yamlToMetaValue :: PandocMonad m
294yamlToMetaValue :: PandocMonad m
294− => YAML.Node -> MarkdownParser m (F MetaValue)
295+ => YAML.Node YE.Pos-> MarkdownParser m (F MetaValue)
295−yamlToMetaValue (YAML.Scalar x) =
296+yamlToMetaValue (YAML.Scalar _ x) =
296 case x of
297 case x of
297 YAML.SStr t -> toMetaValue t
298 YAML.SStr t -> toMetaValue t
298 YAML.SBool b -> return $ return $ MetaBool b
299 YAML.SBool b -> return $ return $ MetaBool b
@@ -303,16 +304,16 @@ yamlToMetaValue (YAML.Scalar x) =
303 Just b -> return $ return $ MetaBool b
304 Just b -> return $ return $ MetaBool b
304 Nothing -> toMetaValue t
305 Nothing -> toMetaValue t
305 YAML.SNull -> return $ return $ MetaString ""
306 YAML.SNull -> return $ return $ MetaString ""
306−yamlToMetaValue (YAML.Sequence _ xs) = do
307+yamlToMetaValue (YAML.Sequence _ _ xs) = do
307 xs' <- mapM yamlToMetaValue xs
308 xs' <- mapM yamlToMetaValue xs
308 return $ do
309 return $ do
309 xs'' <- sequence xs'
310 xs'' <- sequence xs'
310 return $ B.toMetaValue xs''
311 return $ B.toMetaValue xs''
311−yamlToMetaValue (YAML.Mapping _ o) = fmap B.toMetaValue <$> yamlMap o
312+yamlToMetaValue (YAML.Mapping _ _ o) = fmap B.toMetaValue <$> yamlMap o
312yamlToMetaValue _ = return $ return $ MetaString ""
313yamlToMetaValue _ = return $ return $ MetaString ""
314yamlMap :: PandocMonad m
315yamlMap :: PandocMonad m
315− => M.Map YAML.Node YAML.Node
316+ => M.Map (YAML.Node YE.Pos) (YAML.Node YE.Pos)
316 -> MarkdownParser m (F (M.Map String MetaValue))
317 -> MarkdownParser m (F (M.Map String MetaValue))
317yamlMap o = do
318yamlMap o = do
318 kvs <- forM (M.toList o) $ \(key, v) -> do
319 kvs <- forM (M.toList o) $ \(key, v) -> do