From 902d6c7115c46858580fedb5cb785a1d58941ca4 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Wed, 29 Aug 2007 00:03:45 +0000 Subject: 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 --- src/Text/Pandoc/Writers/LaTeX.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Text') 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. -- cgit v1.2.3