diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-11 11:28:11 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-11 11:28:11 -0700 |
commit | 95d9b43b425a57575c4c147a105cbe69d78854eb (patch) | |
tree | 78c03476c54ce3c46bd328ef4a2dee38743a351c /src | |
parent | 6fae136cbb1ed28047e615217b5ce082875f5b19 (diff) | |
parent | 1952dd0592f9e2fa0a52f55af6b52b8dde6fc514 (diff) | |
download | pandoc-95d9b43b425a57575c4c147a105cbe69d78854eb.tar.gz |
Merge pull request #1519 from mpickering/more
EPUB Normalisation and anchors for div blocks in tex
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/EPUB.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index f900c0adc..d4eef3556 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -95,7 +95,7 @@ fetchImages mimes root arc (query iq -> links) = (mapMaybe getEntry links) where getEntry link = - let abslink = root </> link in + let abslink = normalise (root </> link) in (link , lookup link mimes, ) . fromEntry <$> findEntryByPath abslink arc 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 |