aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2016-09-01 16:29:04 +0200
committerFélix Sipma <felix.sipma@no-log.org>2016-09-01 16:31:38 +0200
commit5236263961ddd9144ab328cf8becef1ddffbe0a2 (patch)
treef0ec09b33781677c8a403f65e84dd4b8e2c27e0b
parent50e5224dc2ccec65a03308c399f1c23b026a8886 (diff)
Atom: use html parser if content type is not provided
-rw-r--r--src/Atom.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Atom.hs b/src/Atom.hs
index 1aea270..a8424d7 100644
--- a/src/Atom.hs
+++ b/src/Atom.hs
@@ -67,11 +67,13 @@ parseContent' :: Cursor -> Maybe Content
parseContent' c = parseType (mconcat $ c $| attribute "type")
where
parseType t
- | t == "text" = Just $ TextContent $ B.fromChunks $ c $// content
- | t == "html" || t == "xhtml" = case c $/ xhtmlFilter of
- [] -> Just . HtmlContent . B.fromChunks $ c $/ content
- xs -> Just . HtmlContent $ foldr (B.append . managechildren . child) "" xs
- | otherwise = Nothing
+ | t == "text" = Just $ TextContent $ B.fromChunks $ c $// content
+ | t == "html"
+ || t == "xhtml"
+ || t == "" = case c $/ xhtmlFilter of
+ [] -> Just . HtmlContent . B.fromChunks $ c $/ content
+ xs -> Just . HtmlContent $ foldr (B.append . managechildren . child) "" xs
+ | otherwise = Nothing
managechildren = foldr (B.append . renderMarkup . toMarkup . node) ""
xhtmlFilter :: Axis