aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-19 18:57:25 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-19 18:57:25 -0800
commit978d94952633f938d54e7b157faf6b9315b1453b (patch)
treedda9f9e8cf85da7a1da676d3da031eb9ea450e71 /src
parente1f3c6058e1c5e3211ed5d5ee317ab9432da11d8 (diff)
downloadpandoc-978d94952633f938d54e7b157faf6b9315b1453b.tar.gz
Made writeNative sensitive to writerStandalone.
The Pandoc (Meta ...) is not written unless standalone is set.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Native.hs11
1 files changed, 7 insertions, 4 deletions
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