git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Mark span contents with label if span has an ID
b09412dAlbert Krewinkel
src/Text/Pandoc/Writers/LaTeX.hs+11−7
@@ -655,16 +655,20 @@ isQuoted _ = False
655-- | Convert inline element to LaTeX
655-- | Convert inline element to LaTeX
656inlineToLaTeX :: Inline -- ^ Inline to convert
656inlineToLaTeX :: Inline -- ^ Inline to convert
657 -> State WriterState Doc
657 -> State WriterState Doc
658−inlineToLaTeX (Span (_,classes,_) ils) = do
658+inlineToLaTeX (Span (id',classes,_) ils) = do
659 let noEmph = "csl-no-emph" `elem` classes
659 let noEmph = "csl-no-emph" `elem` classes
660 let noStrong = "csl-no-strong" `elem` classes
660 let noStrong = "csl-no-strong" `elem` classes
661 let noSmallCaps = "csl-no-smallcaps" `elem` classes
661 let noSmallCaps = "csl-no-smallcaps" `elem` classes
662+ let label' = if (null id')
663+ then empty
664+ else text "\\label" <> braces (text $ toLabel id')
665+ fmap (label' <>)
662− ((if noEmph then inCmd "textup" else id) .
666+ ((if noEmph then inCmd "textup" else id) .
663− (if noStrong then inCmd "textnormal" else id) .
667+ (if noStrong then inCmd "textnormal" else id) .
664− (if noSmallCaps then inCmd "textnormal" else id) .
668+ (if noSmallCaps then inCmd "textnormal" else id) .
665− (if not (noEmph || noStrong || noSmallCaps)
669+ (if not (noEmph || noStrong || noSmallCaps)
666− then braces
670+ then braces
667− else id)) `fmap` inlineListToLaTeX ils
671+ else id)) `fmap` inlineListToLaTeX ils
668inlineToLaTeX (Emph lst) =
672inlineToLaTeX (Emph lst) =
669 inlineListToLaTeX lst >>= return . inCmd "emph"
673 inlineListToLaTeX lst >>= return . inCmd "emph"
670inlineToLaTeX (Strong lst) =
674inlineToLaTeX (Strong lst) =