@@ -92,6 +92,7 @@ block = choice
95 , pRawHtmlBlock
96 , pRawHtmlBlock
@@ -177,6 +178,13 @@ pRawTag = do
177 then return []
178 then return []
178 else return $ renderTags' [tag]
179 else return $ renderTags' [tag]
181+pDiv :: TagParser [Block]
183+ getOption readerParseRaw >>= guard
184+ TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="div") (const True)
185+ contents <- pInTags "div" block
186+ return [Div (mkAttr attr) contents]
180pRawHtmlBlock :: TagParser [Block]
188pRawHtmlBlock :: TagParser [Block]
181pRawHtmlBlock = do
189pRawHtmlBlock = do
182 raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
190 raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag
@@ -295,11 +303,7 @@ pCodeBlock = try $ do
295 let result = case reverse result' of
303 let result = case reverse result' of
296 '\n':_ -> init result'
304 '\n':_ -> init result'
297 _ -> result'
305 _ -> result'
298− let attribsId = fromMaybe "" $ lookup "id" attr
299− let attribsClasses = words $ fromMaybe "" $ lookup "class" attr
300− let attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr
301− let attribs = (attribsId, attribsClasses, attribsKV)
302− return [CodeBlock attribs result]
306+ return [CodeBlock (mkAttr attr) result]
304inline :: TagParser [Inline]
308inline :: TagParser [Inline]
305inline = choice
309inline = choice
@@ -314,6 +318,7 @@ inline = choice
317 , pRawHtmlInline
322 , pRawHtmlInline
@@ -397,11 +402,14 @@ pCode :: TagParser [Inline]
397pCode = try $ do
402pCode = try $ do
398 (TagOpen open attr) <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True)
403 (TagOpen open attr) <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True)
399 result <- manyTill pAnyTag (pCloses open)
404 result <- manyTill pAnyTag (pCloses open)
400− let ident = fromMaybe "" $ lookup "id" attr
401− let classes = words $ fromMaybe [] $ lookup "class" attr
402− let rest = filter (\(x,_) -> x /= "id" && x /= "class") attr
403− return [Code (ident,classes,rest)
404− $ intercalate " " $ lines $ innerText result]
405+ return [Code (mkAttr attr) $ intercalate " " $ lines $ innerText result]
407+pSpan :: TagParser [Inline]
409+ getOption readerParseRaw >>= guard
410+ TagOpen _ attr <- lookAhead $ pSatisfy $ tagOpen (=="span") (const True)
411+ contents <- pInTags "span" inline
412+ return [Span (mkAttr attr) contents]
406pRawHtmlInline :: TagParser [Inline]
414pRawHtmlInline :: TagParser [Inline]
407pRawHtmlInline = do
415pRawHtmlInline = do
@@ -648,3 +656,10 @@ htmlTag f = try $ do
649 rendered <- manyTill anyChar (char '>')
657 rendered <- manyTill anyChar (char '>')
650 return (next, rendered ++ ">")
658 return (next, rendered ++ ">")
660+mkAttr :: [(String, String)] -> Attr
661+mkAttr attr = (attribsId, attribsClasses, attribsKV)
662+ where attribsId = fromMaybe "" $ lookup "id" attr
663+ attribsClasses = words $ fromMaybe "" $ lookup "class" attr
664+ attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr