diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-03-20 07:59:10 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-03-20 07:59:38 -0700 |
| commit | 87ff4d63d1a1d967aad6a6d178ac1a1f132e3613 (patch) | |
| tree | d187e7415fd48122d55281f62e58688f87434fb2 /src | |
| parent | 4e2949ceca5a73557365d3f856bb0a91a0155df2 (diff) | |
HTML writer: avoid duplicate classes.
Closes #8705.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 9d1e8f7df..eed9fc3a1 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -83,6 +83,7 @@ import Text.XML.Light (elChildren, unode, unqual) import qualified Text.XML.Light as XML import Text.XML.Light.Output import Data.String (fromString) +import Data.Containers.ListUtils (nubOrd) data WriterState = WriterState { stNotes :: [Html] -- ^ List of notes @@ -685,7 +686,7 @@ attrsToHtml :: PandocMonad m => WriterOptions -> Attr -> StateT WriterState m [Attribute] attrsToHtml opts (id',classes',keyvals) = do attrs <- toAttrs keyvals - let classes'' = filter (not . T.null) classes' + let classes'' = nubOrd $ filter (not . T.null) classes' return $ [prefixedId opts id' | not (T.null id')] ++ [A.class_ (toValue $ T.unwords classes'') | not (null classes'')] ++ attrs |
