From 13b1b87efcebaa6c6a41ad95d591f1b1da063725 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Tue, 4 Dec 2007 04:14:16 +0000 Subject: Improvements to LaTeX and ConTeXt footnote handling: + ConTeXt: } at end of footnote now occurs on a new line when the footnote ends with \stoptyping, just as in LaTeX writer. + LaTeX and ConTeXt: \footnote is no longer indented. The indentation causes problems with wrapping, as it makes the line too long. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1137 788f1e2b-df1e-0410-8736-df70ead52e1b --- Text/Pandoc/Writers/ConTeXt.hs | 10 ++++++---- Text/Pandoc/Writers/LaTeX.hs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'Text/Pandoc/Writers') diff --git a/Text/Pandoc/Writers/ConTeXt.hs b/Text/Pandoc/Writers/ConTeXt.hs index 1ea17272d..73f5123c5 100644 --- a/Text/Pandoc/Writers/ConTeXt.hs +++ b/Text/Pandoc/Writers/ConTeXt.hs @@ -31,7 +31,7 @@ module Text.Pandoc.Writers.ConTeXt ( writeConTeXt ) where import Text.Pandoc.Definition import Text.Pandoc.Shared import Text.Printf ( printf ) -import Data.List ( (\\), intersperse ) +import Data.List ( (\\), intersperse, isSuffixOf ) import Control.Monad.State import Text.PrettyPrint.HughesPJ hiding ( Str ) @@ -292,7 +292,9 @@ inlineToConTeXt (Image alternate (src, tit)) = do text tit <> text "}\n{\\externalfigure[" <> text src <> text "]}" inlineToConTeXt (Note contents) = do contents' <- blockListToConTeXt contents - return $ text " \\footnote{" <> - text (stripTrailingNewlines $ render contents') <> - char '}' + let rawnote = stripTrailingNewlines $ render contents' + -- note: a \n before } is needed when note ends with a \stoptyping + let optNewline = "\\stoptyping" `isSuffixOf` rawnote + return $ text "\\footnote{" <> + text rawnote <> (if optNewline then char '\n' else empty) <> char '}' diff --git a/Text/Pandoc/Writers/LaTeX.hs b/Text/Pandoc/Writers/LaTeX.hs index d66a66941..01c4de58a 100644 --- a/Text/Pandoc/Writers/LaTeX.hs +++ b/Text/Pandoc/Writers/LaTeX.hs @@ -315,5 +315,5 @@ inlineToLaTeX (Note contents) = do let rawnote = stripTrailingNewlines $ render contents' -- note: a \n before } is needed when note ends with a Verbatim environment let optNewline = "\\end{Verbatim}" `isSuffixOf` rawnote - return $ text " \\footnote{" <> + return $ text "\\footnote{" <> text rawnote <> (if optNewline then char '\n' else empty) <> char '}' -- cgit v1.2.3