diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-11-24 11:01:21 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-11-24 11:01:55 -0800 |
commit | 6072bdcec95df9f537b22fb7df4a5f8ea7958189 (patch) | |
tree | 6234b23cf7e8e24cb4b2535aee2ad505bb230a8e /src/Text/Pandoc/Readers/HTML | |
parent | a8638894ab698cc0e49757a2732e383b652834bc (diff) | |
download | pandoc-6072bdcec95df9f537b22fb7df4a5f8ea7958189.tar.gz |
HTML reader: parse attributes on links and images.
Closes #6970.
Diffstat (limited to 'src/Text/Pandoc/Readers/HTML')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML/Parsing.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/HTML/Parsing.hs b/src/Text/Pandoc/Readers/HTML/Parsing.hs index 27a23aa69..a8cdf1de2 100644 --- a/src/Text/Pandoc/Readers/HTML/Parsing.hs +++ b/src/Text/Pandoc/Readers/HTML/Parsing.hs @@ -30,7 +30,7 @@ module Text.Pandoc.Readers.HTML.Parsing ) where -import Control.Monad (void, mzero) +import Control.Monad (void, mzero, mplus) import Data.Maybe (fromMaybe) import Data.Text (Text) import Text.HTML.TagSoup @@ -220,9 +220,10 @@ maybeFromAttrib _ _ = Nothing mkAttr :: [(Text, Text)] -> Attr mkAttr attr = (attribsId, attribsClasses, attribsKV) - where attribsId = fromMaybe "" $ lookup "id" attr + where attribsId = fromMaybe "" $ lookup "id" attr `mplus` lookup "name" attr attribsClasses = T.words (fromMaybe "" $ lookup "class" attr) <> epubTypes - attribsKV = filter (\(k,_) -> k /= "class" && k /= "id") attr + attribsKV = filter (\(k,_) -> k /= "class" && k /= "id" && k /= "name") + attr epubTypes = T.words $ fromMaybe "" $ lookup "epub:type" attr toAttr :: [(Text, Text)] -> Attr |