aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index c06faff1b..6dbba8c35 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -199,10 +199,12 @@ pHeader = try $ do
let bodyTitle = TagOpen tagtype attr ~== TagOpen "h1" [("class","title")]
let level = read (drop 1 tagtype)
contents <- liftM concat $ manyTill inline (pCloses tagtype <|> eof)
+ let ident = maybe "" id $ lookup "id" attr
+ let classes = maybe [] words $ lookup "class" attr
+ let keyvals = [(k,v) | (k,v) <- attr, k /= "class", k /= "id"]
return $ if bodyTitle
then [] -- skip a representation of the title in the body
- else [Header level (fromAttrib "id" $
- TagOpen tagtype attr, [], []) $
+ else [Header level (ident, classes, keyvals) $
normalizeSpaces contents]
pHrule :: TagParser [Block]