From 978d94952633f938d54e7b157faf6b9315b1453b Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 19 Jan 2011 18:57:25 -0800 Subject: Made writeNative sensitive to writerStandalone. The Pandoc (Meta ...) is not written unless standalone is set. --- src/Text/Pandoc/Writers/Native.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/Native.hs b/src/Text/Pandoc/Writers/Native.hs index 3b5ea7481..cbda71555 100644 --- a/src/Text/Pandoc/Writers/Native.hs +++ b/src/Text/Pandoc/Writers/Native.hs @@ -29,7 +29,7 @@ Utility functions and definitions used by the various Pandoc modules. -} module Text.Pandoc.Writers.Native ( writeNative ) where -import Text.Pandoc.Shared ( WriterOptions ) +import Text.Pandoc.Shared ( WriterOptions(..) ) import Data.List ( intercalate ) import Text.Pandoc.Definition @@ -81,6 +81,9 @@ prettyBlock block = show block -- | Prettyprint Pandoc document. writeNative :: WriterOptions -> Pandoc -> String -writeNative _ (Pandoc meta blocks) = "Pandoc " ++ "(" ++ show meta ++ - ")\n" ++ (prettyBlockList 0 blocks) ++ "\n" - +writeNative opts (Pandoc meta blocks) | writerStandalone opts = + "Pandoc " ++ "(" ++ show meta ++ ")\n " ++ prettyBlockList 2 blocks +-- -- writeNative _ (Pandoc _ [Plain [x]]) = show x +-- writeNative _ (Pandoc _ [Plain xs]) = show xs +-- writeNative _ (Pandoc _ [x]) = prettyBlock x +writeNative _ (Pandoc _ xs) = prettyBlockList 0 xs -- cgit v1.2.3