You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Explain the problem.
The function lookupMetaBlocks is not producing an error when it fails to convert whatever found to blocks. The code in pandoc 3.6.3 is:
-- | Retrieve the metadata value for a given @key@
-- and extract blocks.
lookupMetaBlocks :: Text -> Meta -> [Block]
lookupMetaBlocks key meta =
case lookupMeta key meta of
Just (MetaBlocks bs) -> bs
Just (MetaInlines ils) -> [Plain ils]
Just (MetaString s) -> [Plain [Str s]]
_ -> []
If the value retrieved has type MetaList [..] then the value is silently lost with _ -> []
I would recommend to produce a suitable error message, eventhough such a case does not occur within the Pandoc code. -- I had constructed a value with a type of MetaList [MetaBlocks [Block]] which can be converted to [Block] but not withinlookupMetaBlocks`; an error message would have drawn my attention to the problem, finding the cause for the unexplained data loss was more difficult.
Pandoc version?
pandoc 3.6.3 on linux (debian bookworm), ghc 9.10.1
The text was updated successfully, but these errors were encountered:
Well, none of these lookupMeta... functions return a type that could hold an error, so this would require changing all the types and checking for the error status in the calling sites.
If you want something fancier, it is of always possible to use lookupMeta and do the pattern matching yourself.
Explain the problem.
The function
lookupMetaBlocks
is not producing an error when it fails to convert whatever found to blocks. The code in pandoc 3.6.3 is:If the value retrieved has type
MetaList [..]
then the value is silently lost with_ -> []
I would recommend to produce a suitable error message, eventhough such a case does not occur within the Pandoc code. -- I had constructed a value with a type of
MetaList [MetaBlocks [Block]] which can be converted to
[Block]but not within
lookupMetaBlocks`; an error message would have drawn my attention to the problem, finding the cause for the unexplained data loss was more difficult.Pandoc version?
pandoc 3.6.3 on linux (debian bookworm), ghc 9.10.1
The text was updated successfully, but these errors were encountered: