Made writeNative sensitive to writerStandalone.

The Pandoc (Meta ...) is not written unless standalone is set.
This commit is contained in:
John MacFarlane 2011-01-19 18:57:25 -08:00
parent e1f3c6058e
commit 978d949526

View file

@ -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