blob: b9a0038f14d158757fd5883a958b987ad76a5b03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{-# LANGUAGE OverloadedStrings #-}
module Handlingar
( main
) where
import System.FilePath (dropFileName)
import Text.Pandoc (runIOorExplode)
import qualified Data.Text.IO as T
import System.Directory (canonicalizePath, createDirectoryIfMissing, withCurrentDirectory)
-- import Handlingar.TexOutput (handleTex)
import Handlingar.HtmlOutput (handleHtml)
-- TODO pandoc possibly contains a better way to handle attachements,
-- something about media bag
-- TODO mail attachments from any type supported by pandoc should
-- work, fix a (MimeType -> PandocParser) function
-- TODO input file shouldn't be locked to vimwiki
-- TODO output other things than PDF
-- - Plain text, requires own redering engine (pandoc plugin?)
-- - HTML, should be multi page for each attachement
-- - with support for RXML templates
-- - Mail, where mail attachements are copied verbatim
-- other attachements become mail attachments
-- renumber :: Int -> [Blocks] -> [Blocks]
main :: [String] -> IO ()
main args = do
case args of
[file, heading] -> do
destination <- canonicalizePath "out"
createDirectoryIfMissing True destination
text <- T.readFile file
withCurrentDirectory (dropFileName file) $ do
runIOorExplode $ handleHtml text heading destination
_ -> error "Usage: ./main handlingar <input-file> <heading>"
|