git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: Avoid two class attributes when adding 'uri' class.

Closes #3716.

commit8218bdb95c070b2c09f51ae29c280260fc47dffb authorJohn MacFarlane <jgm@berkeley.edu> dateThu 1 Jun 2017, 18:41 (9 years ago) parent0cf6511
2 files changed+13−7
src/Text/Pandoc/Writers/HTML.hs+7−7 test/command/3716.md+6
src/Text/Pandoc/Writers/HTML.hs+7−7
@@ -973,7 +973,7 @@ inlineToHtml opts inline = do
973973 (Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
974974 linkText <- inlineListToHtml opts txt
975975 lift $ obfuscateLink opts attr linkText s
976− (Link attr txt (s,tit)) -> do
976+ (Link (ident,classes,kvs) txt (s,tit)) -> do
977977 linkText <- inlineListToHtml opts txt
978978 slideVariant <- gets stSlideVariant
979979 let s' = case s of
@@ -983,13 +983,13 @@ inlineToHtml opts inline = do
983983 in '#' : prefix ++ xs
984984 _ -> s
985985 let link = H.a ! A.href (toValue s') $ linkText
986− let link' = if txt == [Str (unEscapeString s)]
987− then link ! A.class_ "uri"
988− else link
989− let link'' = addAttrs opts attr link'
986+ let attr = if txt == [Str (unEscapeString s)]
987+ then (ident, "uri" : classes, kvs)
988+ else (ident, classes, kvs)
989+ let link' = addAttrs opts attr link
990990 return $ if null tit
991− then link''
992− else link'' ! A.title (toValue tit)
991+ then link'
992+ else link' ! A.title (toValue tit)
993993 (Image attr txt (s,tit)) | treatAsImage s -> do
994994 let alternate' = stringify txt
995995 slideVariant <- gets stSlideVariant
test/command/3716.mdnew file+6
@@ -0,0 +1,6 @@
1+```
2+% pandoc
3+<http://example.com>{.foo}
4+^D
5+<p><a href="http://example.com" class="uri foo">http://example.com</a></p>
6+```