LaTeX writer: Mark span contents with label if span has an ID
Prepend `\label{span-id}` to span contents iff `span-id` is defined.
This commit is contained in:
parent
2eec20d92f
commit
b09412d852
1 changed files with 11 additions and 7 deletions
|
@ -655,16 +655,20 @@ isQuoted _ = False
|
|||
-- | Convert inline element to LaTeX
|
||||
inlineToLaTeX :: Inline -- ^ Inline to convert
|
||||
-> State WriterState Doc
|
||||
inlineToLaTeX (Span (_,classes,_) ils) = do
|
||||
inlineToLaTeX (Span (id',classes,_) ils) = do
|
||||
let noEmph = "csl-no-emph" `elem` classes
|
||||
let noStrong = "csl-no-strong" `elem` classes
|
||||
let noSmallCaps = "csl-no-smallcaps" `elem` classes
|
||||
((if noEmph then inCmd "textup" else id) .
|
||||
(if noStrong then inCmd "textnormal" else id) .
|
||||
(if noSmallCaps then inCmd "textnormal" else id) .
|
||||
(if not (noEmph || noStrong || noSmallCaps)
|
||||
then braces
|
||||
else id)) `fmap` inlineListToLaTeX ils
|
||||
let label' = if (null id')
|
||||
then empty
|
||||
else text "\\label" <> braces (text $ toLabel id')
|
||||
fmap (label' <>)
|
||||
((if noEmph then inCmd "textup" else id) .
|
||||
(if noStrong then inCmd "textnormal" else id) .
|
||||
(if noSmallCaps then inCmd "textnormal" else id) .
|
||||
(if not (noEmph || noStrong || noSmallCaps)
|
||||
then braces
|
||||
else id)) `fmap` inlineListToLaTeX ils
|
||||
inlineToLaTeX (Emph lst) =
|
||||
inlineListToLaTeX lst >>= return . inCmd "emph"
|
||||
inlineToLaTeX (Strong lst) =
|
||||
|
|
Loading…
Add table
Reference in a new issue