]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blobdiff - src/Epublishable.hs
Combine ArticlePage and FullPage into one Page type.
[dead/lwn-epub.git] / src / Epublishable.hs
diff --git a/src/Epublishable.hs b/src/Epublishable.hs
deleted file mode 100644 (file)
index 3ca9b68..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-module Epublishable
-where
-
-import Text.Pandoc
-import qualified Data.ByteString.Lazy as B (ByteString, writeFile)
-import Data.Time (getCurrentTime)
-import Data.Tree.NTree.TypeDefs (NTree)
-import System.FilePath (normalise)
-import Text.XML.HXT.Core (IOSArrow, XNode, XmlTree)
-
-import XHTML
-
-
-class (XHTML a) => Epublishable a where
-  parse :: IOSArrow XmlTree (NTree XNode) -> IO (Maybe a)
-
-  title :: a -> String
-
-  metadata :: a -> IO String
-  metadata obj = do
-    date <- getCurrentTime
-    return $
-      "<dc:creator>http://lwn.net/</dc:creator>\n" ++
-      "<dc:date>" ++ (show date) ++ "</dc:date>\n" ++
-      "<dc:language>en-US</dc:language>\n" ++
-      "<dc:rights>Copyright Eklektix, Inc.</dc:rights>\n" ++
-      "<dc:title>" ++ (title obj) ++ "</dc:title>\n"
-
-  epublish :: a -> FilePath -> IO ()
-  epublish obj path = do
-    let xhtml = to_xhtml obj
-    epmd <- metadata obj
-    epub <- xhtml_to_epub epmd xhtml
-    let normalized_path = normalise path
-    B.writeFile normalized_path epub
-
-xhtml_to_epub :: String -> String -> IO B.ByteString
-xhtml_to_epub epmd =
-   write_epub . read_html
-   where
-     my_writer_options = defaultWriterOptions { writerEPUBMetadata = epmd }
-     write_epub = writeEPUB Nothing [] my_writer_options
-     read_html  = readHtml defaultParserState