aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/LaTeX.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-04-25 08:08:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-04-25 08:08:00 -0700
commit60297089f642818599b925c5e3bd7ecdfbf93c1d (patch)
tree5466dcff5cd5529eadca899577da4c918d85f228 /src/Text/Pandoc/Writers/LaTeX.hs
parentcbeb3bb2132908b76e3a83e61ff99418ebdf83b4 (diff)
parentb09412d852880a0c8e18e1cab9b0ce33f0e0e8a2 (diff)
downloadpandoc-60297089f642818599b925c5e3bd7ecdfbf93c1d.tar.gz
Merge pull request #1265 from tarleb/org-links
Improvements handling of internal links
Diffstat (limited to 'src/Text/Pandoc/Writers/LaTeX.hs')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index e12c9078f..e52220f01 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -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) =