HTML reader: Preserve all header attributes.
This commit is contained in:
parent
cc410a71b5
commit
14b64ed46c
1 changed files with 4 additions and 2 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue