Skip to content

Commit

Permalink
HTML writer: Avoid two class attributes when adding 'uri' class.
Browse files Browse the repository at this point in the history
Closes #3716.
  • Loading branch information
jgm committed Jun 1, 2017
1 parent 0cf6511 commit 8218bdb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Text/Pandoc/Writers/HTML.hs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ inlineToHtml opts inline = do
(Link attr txt (s,_)) | "mailto:" `isPrefixOf` s -> do
linkText <- inlineListToHtml opts txt
lift $ obfuscateLink opts attr linkText s
(Link attr txt (s,tit)) -> do
(Link (ident,classes,kvs) txt (s,tit)) -> do
linkText <- inlineListToHtml opts txt
slideVariant <- gets stSlideVariant
let s' = case s of
Expand All @@ -983,13 +983,13 @@ inlineToHtml opts inline = do
in '#' : prefix ++ xs
_ -> s
let link = H.a ! A.href (toValue s') $ linkText
let link' = if txt == [Str (unEscapeString s)]
then link ! A.class_ "uri"
else link
let link'' = addAttrs opts attr link'
let attr = if txt == [Str (unEscapeString s)]
then (ident, "uri" : classes, kvs)
else (ident, classes, kvs)
let link' = addAttrs opts attr link
return $ if null tit
then link''
else link'' ! A.title (toValue tit)
then link'
else link' ! A.title (toValue tit)
(Image attr txt (s,tit)) | treatAsImage s -> do
let alternate' = stringify txt
slideVariant <- gets stSlideVariant
Expand Down
6 changes: 6 additions & 0 deletions test/command/3716.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```
% pandoc
<http://example.com>{.foo}
^D
<p><a href="http://example.com" class="uri foo">http://example.com</a></p>
```

0 comments on commit 8218bdb

Please sign in to comment.