aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormassifrg <[email protected]>2025-09-13 17:33:48 +0200
committerGitHub <[email protected]>2025-09-13 17:33:48 +0200
commit4be17f77b77815c32ab9ffbae6ece72cc1e36221 (patch)
treec839d58129d7645e63f5f26e777826d39c98181a /src
parent5eb25ab4481eb6ab3b4aafff9ce1fd4086e58b52 (diff)
xml reader: parse MetaString (#11137)
`<MetaString>` contents parsing was missing.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/XML.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/XML.hs b/src/Text/Pandoc/Readers/XML.hs
index e3173f4c9..d5cc444d0 100644
--- a/src/Text/Pandoc/Readers/XML.hs
+++ b/src/Text/Pandoc/Readers/XML.hs
@@ -500,6 +500,9 @@ parseMetaMapEntry e =
parseMetaMapEntryContents :: (PandocMonad m) => [Content] -> XMLReader m (Maybe MetaValue)
parseMetaMapEntryContents cs = msum <$> mapM parseMeta cs
+getElementText :: Element -> T.Text
+getElementText el = T.concat [cdData c | Text c <- elContent el]
+
parseMeta :: (PandocMonad m) => Content -> XMLReader m (Maybe MetaValue)
parseMeta (Text (CData CDataRaw _ _)) = return Nothing
parseMeta (Text (CData _ s _)) =
@@ -515,7 +518,7 @@ parseMeta (Elem e) = do
"MetaBool" -> case (attrValue atNameMetaBoolValue e) of
"true" -> return $ Just $ MetaBool True
_ -> return $ Just $ MetaBool False
- "MetaString" -> pure Nothing
+ "MetaString" -> return $ Just $ MetaString (getElementText e)
"MetaInlines" -> do
inlines <- getInlines (elContent e)
return $ Just $ MetaInlines $ toList inlines