git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: Avoid two class attributes when adding 'uri' class.
8218bdbJohn MacFarlane
src/Text/Pandoc/Writers/HTML.hs+7−7
@@ -973,7 +973,7 @@ inlineToHtml opts inline = do
973 (Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
973 (Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
974 linkText <- inlineListToHtml opts txt
974 linkText <- inlineListToHtml opts txt
975 lift $ obfuscateLink opts attr linkText s
975 lift $ obfuscateLink opts attr linkText s
976− (Link attr txt (s,tit)) -> do
976+ (Link (ident,classes,kvs) txt (s,tit)) -> do
977 linkText <- inlineListToHtml opts txt
977 linkText <- inlineListToHtml opts txt
978 slideVariant <- gets stSlideVariant
978 slideVariant <- gets stSlideVariant
979 let s' = case s of
979 let s' = case s of
@@ -983,13 +983,13 @@ inlineToHtml opts inline = do
983 in '#' : prefix ++ xs
983 in '#' : prefix ++ xs
984 _ -> s
984 _ -> s
985 let link = H.a ! A.href (toValue s') $ linkText
985 let link = H.a ! A.href (toValue s') $ linkText
986− let link' = if txt == [Str (unEscapeString s)]
986+ let attr = if txt == [Str (unEscapeString s)]
987− then link ! A.class_ "uri"
987+ then (ident, "uri" : classes, kvs)
988− else link
988+ else (ident, classes, kvs)
989− let link'' = addAttrs opts attr link'
989+ let link' = addAttrs opts attr link
990 return $ if null tit
990 return $ if null tit
991− then link''
991+ then link'
992− else link'' ! A.title (toValue tit)
992+ else link' ! A.title (toValue tit)
993 (Image attr txt (s,tit)) | treatAsImage s -> do
993 (Image attr txt (s,tit)) | treatAsImage s -> do
994 let alternate' = stringify txt
994 let alternate' = stringify txt
995 slideVariant <- gets stSlideVariant
995 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+```