@@ -31,7 +31,7 @@ module Text.Pandoc.Writers.HTML (
3131 ) where
3232import Control.Monad.State.Strict
3333import Data.Char (ord, toLower)
34−import Data.List (intercalate, intersperse, isPrefixOf, partition)
34+import Data.List (intercalate, intersperse, isPrefixOf, partition, delete)
3535import Data.List.Split (splitWhen)
3636import Data.Maybe (fromMaybe, isJust, isNothing, mapMaybe)
3737import qualified Data.Set as Set
@@ -1023,20 +1023,29 @@ inlineToHtml opts inline = do
10231023
10241024 (Emph lst) -> inlineListToHtml opts lst >>= return . H.em
10251025 (Strong lst) -> inlineListToHtml opts lst >>= return . H.strong
1026− (Code attr str) -> case hlCode of
1026+ (Code attr@(ids,cs,kvs) str)
1027+ -> case hlCode of
10271028 Left msg -> do
10281029 unless (null msg) $
10291030 report $ CouldNotHighlight msg
1030− addAttrs opts attr $ H.code $ strToHtml str
1031+ addAttrs opts (ids,cs',kvs) $
1032+ maybe H.code id sampOrVar $
1033+ strToHtml str
10311034 Right h -> do
10321035 modify $ \st -> st{ stHighlighting = True }
1033− addAttrs opts (id',[],keyvals) h
1034− where (id',_,keyvals) = attr
1035− hlCode = if isJust (writerHighlightStyle opts)
1036+ addAttrs opts (ids,[],kvs) $
1037+ maybe id id sampOrVar $ h
1038+ where hlCode = if isJust (writerHighlightStyle opts)
10361039 then highlight
10371040 (writerSyntaxMap opts)
10381041 formatHtmlInline attr str
10391042 else Left ""
1043+ (sampOrVar,cs') =
1044+ if "sample" `elem` cs
1045+ then (Just H.samp,"sample" `delete` cs)
1046+ else if "variable" `elem` cs
1047+ then (Just H.var,"variable" `delete` cs)
1048+ else (Nothing,cs)
10401049 (Strikeout lst) -> inlineListToHtml opts lst >>=
10411050 return . H.del
10421051 (SmallCaps lst) -> inlineListToHtml opts lst >>=