diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-29 00:03:45 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-29 00:03:45 +0000 |
commit | 902d6c7115c46858580fedb5cb785a1d58941ca4 (patch) | |
tree | 19e48377c38872e3a4df8d62d272ebe51b17b97b /src/Text/Pandoc | |
parent | 5bafe2c9fb81e1e6167410ad61366a6a941a48b6 (diff) | |
download | pandoc-902d6c7115c46858580fedb5cb785a1d58941ca4.tar.gz |
Fixed bug in LaTeX writer: autolinks would not cause
'\usepackage{url}' to be put in the document header.
Also, changes to state in enumerated list items would be
overwritten.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@947 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 530bd26e1..62e220f4f 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -142,7 +142,7 @@ blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do let oldlevel = stOLLevel st put $ st {stOLLevel = oldlevel + 1} items <- mapM listItemToLaTeX lst - put $ st {stOLLevel = oldlevel} + modify (\st -> st {stOLLevel = oldlevel}) exemplar <- if numstyle /= DefaultStyle || numdelim /= DefaultDelim then do addToHeader "\\usepackage{enumerate}" return $ "[" ++ head (orderedListMarkers (1, numstyle, numdelim)) ++ "]" @@ -262,11 +262,12 @@ inlineToLaTeX (TeX str) = return str inlineToLaTeX (HtmlInline str) = return "" inlineToLaTeX (LineBreak) = return "\\\\\n" inlineToLaTeX Space = return " " -inlineToLaTeX (Link text (src, tit)) = do +inlineToLaTeX (Link text (src, _)) = do addToHeader "\\usepackage[breaklinks=true]{hyperref}" case text of [Code x] | x == src -> -- autolink - return $ "\\url{" ++ x ++ "}" + do addToHeader "\\usepackage{url}" + return $ "\\url{" ++ x ++ "}" _ -> do contents <- inlineListToLaTeX $ deVerb text return $ "\\href{" ++ src ++ "}{" ++ contents ++ "}" inlineToLaTeX (Image alternate (source, tit)) = do @@ -276,8 +277,7 @@ inlineToLaTeX (Note contents) = do st <- get put (st {stInNote = True}) contents' <- blockListToLaTeX contents - st <- get - put (st {stInNote = False}) + modify (\st -> st {stInNote = False}) return $ "\\footnote{" ++ stripTrailingNewlines contents' ++ "\n}" -- note: the \n before } is important; removing it causes problems -- if a Verbatim environment occurs at the end of the footnote. |