]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blob - src/Main.hs
8687488f7817281760813cd06cdbc24a06ffb44f
[dead/lwn-epub.git] / src / Main.hs
1 {-# LANGUAGE ScopedTypeVariables, RecordWildCards #-}
2 module Main
3 where
4
5 import Data.Maybe (fromJust)
6 import System.Console.CmdArgs (cmdArgsRun)
7
8 import Text.XML.HXT.Core
9
10
11 import CommandLine (Args(..), apply_args)
12 import Epublishable
13 import LWN.ArticlePage
14 import LWN.FullPage
15
16 my_read :: String -> IOStateArrow s b XmlTree
17 my_read =
18 readDocument [ withValidate no,
19 withParseHTML yes,
20 withInputEncoding utf8,
21 withWarnings no ]
22
23 main :: IO ()
24 main = do
25 Args{..} <- apply_args
26 print article
27
28 -- let article_html = my_read "test/fixtures/501317-article.html"
29 -- ioap <- parse article_html
30 -- let article_page :: ArticlePage = fromJust $ ioap
31 -- epublish article_page "single_article.epub"
32
33 -- let page_html = my_read "test/fixtures/500848-page.html"
34 -- ioap_f <- parse page_html
35 -- let full_page :: FullPage = fromJust $ ioap_f
36 -- epublish full_page "full_page.epub"
37
38 -- let bigpage_html = my_read "test/fixtures/50844-bigpage.html"
39 -- ioap_bp <- parse bigpage_html
40 -- let bigpage :: FullPage = fromJust $ ioap_bp
41 -- epublish bigpage "bigpage.epub"
42
43 -- putStrLn "Done."