diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-05-16 23:00:58 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-06-24 20:27:37 -0700 |
commit | e32a8f5981969bb6d0a11bd945188c35817e4d96 (patch) | |
tree | 83b5db93df221f960f9b32387147cc692ef10103 /src/Text/Pandoc/Writers/Man.hs | |
parent | 5f4a32e46588b5a89cfa38d7ac51e192d62430cc (diff) | |
download | pandoc-e32a8f5981969bb6d0a11bd945188c35817e4d96.tar.gz |
Revised Text.Pandoc.Templates to accept JSON contexts.
Currently the library is set up with a shim for association
lists, for compatibility, but this can change when the writers
are changed.
New export: `varListToJSON`.
Removed `Empty`.
Simplified template type to a newtype.
Diffstat (limited to 'src/Text/Pandoc/Writers/Man.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/Man.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs index 5541aeb3b..17be983ce 100644 --- a/src/Text/Pandoc/Writers/Man.hs +++ b/src/Text/Pandoc/Writers/Man.hs @@ -38,6 +38,7 @@ import Text.Printf ( printf ) import Data.List ( isPrefixOf, intersperse, intercalate ) import Text.Pandoc.Pretty import Control.Monad.State +import qualified Data.Text as T type Notes = [[Block]] data WriterState = WriterState { stNotes :: Notes @@ -77,8 +78,11 @@ pandocToMan opts (Pandoc (Meta title authors date) blocks) = do , ("description", render' description) ] ++ [ ("has-tables", "yes") | hasTables ] ++ [ ("author", render' a) | a <- authors' ] + template = case compileTemplate (T.pack $ writerTemplate opts) of + Left e -> error e + Right t -> t if writerStandalone opts - then return $ renderTemplate context $ writerTemplate opts + then return $ renderTemplate template (varListToJSON context) else return main -- | Return man representation of notes. |