diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2014-08-11 16:19:06 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2014-08-11 16:23:05 +0100 |
commit | 1952dd0592f9e2fa0a52f55af6b52b8dde6fc514 (patch) | |
tree | e0567810760b86f91dac2c5914379b77c72b2950 /src | |
parent | 72b147071364d6034f7cac634d23010a704627e5 (diff) | |
download | pandoc-1952dd0592f9e2fa0a52f55af6b52b8dde6fc514.tar.gz |
TeX Writer: Write hyperdef and label for identifiers on Div blocks
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index d140932a7..65ceb85a0 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -303,12 +303,17 @@ isLineBreakOrSpace _ = False blockToLaTeX :: Block -- ^ Block to convert -> State WriterState Doc blockToLaTeX Null = return empty -blockToLaTeX (Div (_,classes,_) bs) = do +blockToLaTeX (Div (identifier,classes,_) bs) = do beamer <- writerBeamer `fmap` gets stOptions + ref <- toLabel identifier + let linkAnchor = if null identifier + then empty + else "\\hyperdef{}" <> braces (text ref) <> + braces ("\\label" <> braces (text ref)) contents <- blockListToLaTeX bs if beamer && "notes" `elem` classes -- speaker notes then return $ "\\note" <> braces contents - else return contents + else return (linkAnchor <> contents) blockToLaTeX (Plain lst) = inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst -- title beginning with fig: indicates that the image is a figure |