aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-08-18 19:23:34 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-08-18 19:23:34 -0700
commitfa03bf52cbf82e6dea09bd2176bb4f64012a8365 (patch)
treeedd5aec7ef6723816077762a2d6cdca869a7ae26 /src/Text/Pandoc/Writers
parentf9ae93d85464070eea5a7b0dc037be037b602acb (diff)
downloadpandoc-fa03bf52cbf82e6dea09bd2176bb4f64012a8365.tar.gz
ConTeXt: Use buffering for footnotes containing code blocks.
Closes #291.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index a64b15b58..01b2cd601 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -31,6 +31,7 @@ Conversion of 'Pandoc' format into ConTeXt.
module Text.Pandoc.Writers.ConTeXt ( writeConTeXt ) where
import Text.Pandoc.Definition
import Text.Pandoc.Shared
+import Text.Pandoc.Generic (queryWith)
import Text.Printf ( printf )
import Data.List ( intercalate )
import Control.Monad.State
@@ -290,5 +291,10 @@ inlineToConTeXt (Image _ (src, _)) = do
return $ braces $ "\\externalfigure" <> brackets (text src')
inlineToConTeXt (Note contents) = do
contents' <- blockListToConTeXt contents
- return $ text "\\footnote{" <>
- nest 2 contents' <> char '}'
+ let codeBlock x@(CodeBlock _ _) = [x]
+ codeBlock _ = []
+ let codeBlocks = queryWith codeBlock contents
+ return $ if null codeBlocks
+ then text "\\footnote{" <> nest 2 contents' <> char '}'
+ else text "\\startbuffer " <> nest 2 contents' <>
+ text "\\stopbuffer\\footnote{\\getbuffer}"