diff options
Diffstat (limited to 'Text/Pandoc')
-rw-r--r-- | Text/Pandoc/Writers/ConTeXt.hs | 10 | ||||
-rw-r--r-- | Text/Pandoc/Writers/LaTeX.hs | 2 |
2 files changed, 7 insertions, 5 deletions
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 '}' |