diff options
Diffstat (limited to 'trypandoc/trypandoc.hs')
-rw-r--r-- | trypandoc/trypandoc.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/trypandoc/trypandoc.hs b/trypandoc/trypandoc.hs index 2e4797669..f56a00ac5 100644 --- a/trypandoc/trypandoc.hs +++ b/trypandoc/trypandoc.hs @@ -41,6 +41,9 @@ app req respond = do text <- getParam "text" >>= checkLength . fromMaybe T.empty fromFormat <- fromMaybe "" <$> getParam "from" toFormat <- fromMaybe "" <$> getParam "to" + standalone <- (==) "1" . fromMaybe "" <$> getParam "standalone" + compiledTemplate <- runIO . compileDefaultTemplate $ toFormat + let template = if standalone then either (const Nothing) Just compiledTemplate else Nothing let reader = case runPure $ getReader fromFormat of Right (TextReader r, es) -> r readerOpts{ readerExtensions = es } @@ -48,7 +51,7 @@ app req respond = do ++ T.unpack fromFormat let writer = case runPure $ getWriter toFormat of Right (TextWriter w, es) -> w writerOpts{ - writerExtensions = es } + writerExtensions = es, writerTemplate = template } _ -> error $ "could not find writer for " ++ T.unpack toFormat let result = case runPure $ reader (tabFilter 4 text) >>= writer of |