git.iko.soy/typeable/pandoc
on master help sign in
Reworked Text.Pandoc.ODT to use zip-archive instead of calling external 'zip'.

+ Removed utf8-string and xml-light modules, and unneeded content.xml. + Removed code for building reference.odt from Setup.hs. The ODT is now built using template haskell in Text.Pandoc.ODT. + Removed copyright statements for utf8-string and xml modules, since they are no longer included in the source. + README: Removed claim that 'zip' is needed for ODT production. + Removed dependency on 'zip' from debian/control. + Text.Pandoc.Shared: Removed withTempDir, added inDirectory. + Added makeZip to Text.Pandoc.TH. + pandoc.cabal: Added dependencies on old-time, zip-archive, and utf8-string. Added markdown2pdf files to extra-sources list. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1417 788f1e2b-df1e-0410-8736-df70ead52e1b

commit4dca8f6e75948d489e8127119ce3787cb97ee1e2 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateThu 4 Sep 2008, 02:51 (18 years ago) parent9b7ec2d
17 files changed+75−1537
Codec/Binary/UTF8/String.hs−97 README−5 Setup.hs−29 System/IO/UTF8.hs−118 Text/Pandoc/ODT.hs+46−98 Text/Pandoc/Shared.hs+9−17 Text/Pandoc/TH.hs+13−1 Text/XML/Light.hs−96 Text/XML/Light/Cursor.hs−327 Text/XML/Light/Input.hs−307 Text/XML/Light/Output.hs−150 Text/XML/Light/Proc.hs−103 Text/XML/Light/Types.hs−91 debian/control+3−3 debian/copyright−62 odt-styles/content.xml−17 pandoc.cabal+4−16
Codec/Binary/UTF8/String.hsdeleted−97
@@ -1,97 +0,0 @@
1−--
2−-- |
3−-- Module : Codec.Binary.UTF8.String
4−-- Copyright : (c) Eric Mertens 2007
5−-- License : BSD3-style (see LICENSE)
6−--
7−-- Maintainer: emertens@galois.com
8−-- Stability : experimental
9−-- Portability : portable
10−--
11−-- Support for encoding UTF8 Strings to and from @[Word8]@
12−--
13−
14−module Codec.Binary.UTF8.String (
15− encode
16− , decode
17− , encodeString
18− , decodeString
19− ) where
20−
21−import Data.Word (Word8)
22−import Data.Bits ((.|.),(.&.),shiftL,shiftR)
23−import Data.Char (chr,ord)
24−
25−default(Int)
26−
27−-- | Encode a string using 'encode' and store the result in a 'String'.
28−encodeString :: String -> String
29−encodeString xs = map (toEnum . fromEnum) (encode xs)
30−
31−-- | Decode a string using 'decode' using a 'String' as input.
32−-- | This is not safe but it is necessary if UTF-8 encoded text
33−-- | has been loaded into a 'String' prior to being decoded.
34−decodeString :: String -> String
35−decodeString xs = decode (map (toEnum . fromEnum) xs)
36−
37−replacement_character :: Char
38−replacement_character = '\xfffd'
39−
40−-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.
41−encode :: String -> [Word8]
42−encode = concatMap (map fromIntegral . go . ord)
43− where
44− go oc
45− | oc <= 0x7f = [oc]
46−
47− | oc <= 0x7ff = [ 0xc0 + (oc `shiftR` 6)
48− , 0x80 + oc .&. 0x3f
49− ]
50−
51− | oc <= 0xffff = [ 0xe0 + (oc `shiftR` 12)
52− , 0x80 + ((oc `shiftR` 6) .&. 0x3f)
53− , 0x80 + oc .&. 0x3f
54− ]
55− | otherwise = [ 0xf0 + (oc `shiftR` 18)
56− , 0x80 + ((oc `shiftR` 12) .&. 0x3f)
57− , 0x80 + ((oc `shiftR` 6) .&. 0x3f)
58− , 0x80 + oc .&. 0x3f
59− ]
60−
61−--
62−-- | Decode a UTF8 string packed into a list of Word8 values, directly to String
63−--
64−decode :: [Word8] -> String
65−decode [ ] = ""
66−decode (c:cs)
67− | c < 0x80 = chr (fromEnum c) : decode cs
68− | c < 0xc0 = replacement_character : decode cs
69− | c < 0xe0 = multi1
70− | c < 0xf0 = multi_byte 2 0xf 0x800
71− | c < 0xf8 = multi_byte 3 0x7 0x10000
72− | c < 0xfc = multi_byte 4 0x3 0x200000
73− | c < 0xfe = multi_byte 5 0x1 0x4000000
74− | otherwise = replacement_character : decode cs
75− where
76− multi1 = case cs of
77− c1 : ds | c1 .&. 0xc0 == 0x80 ->
78− let d = ((fromEnum c .&. 0x1f) `shiftL` 6) .|. fromEnum (c1 .&. 0x3f)
79− in if d >= 0x000080 then toEnum d : decode ds
80− else replacement_character : decode ds
81− _ -> replacement_character : decode cs
82−
83− multi_byte :: Int -> Word8 -> Int -> [Char]
84− multi_byte i mask overlong = aux i cs (fromEnum (c .&. mask))
85− where
86− aux 0 rs acc
87− | overlong <= acc && acc <= 0x10ffff &&
88− (acc < 0xd800 || 0xdfff < acc) &&
89− (acc < 0xfffe || 0xffff < acc) = chr acc : decode rs
90− | otherwise = replacement_character : decode rs
91−
92− aux n (r:rs) acc
93− | r .&. 0xc0 == 0x80 = aux (n-1) rs
94− $ shiftL acc 6 .|. fromEnum (r .&. 0x3f)
95−
96− aux _ rs _ = replacement_character : decode rs
97−
README−5
@@ -87,11 +87,6 @@ Supported output formats include `markdown`, `latex`, `context`
8787Texinfo), `mediawiki` (MediaWiki markup), `man` (groff man), and `s5`
8888(which produces an HTML file that acts like powerpoint).
8989
90−For `odt` output, you must have `zip` in the path. If you
91−don't have it installed, you can get the free [Info-ZIP].
92−
93−[Info-ZIP]: http://www.info-zip.org/Zip.html
94−
9590Supported input formats include `markdown`, `html`, `latex`, and `rst`.
9691Note that the `rst` reader only parses a subset of reStructuredText
9792syntax. For example, it doesn't handle tables, option lists, or
Setup.hs−29
@@ -12,7 +12,6 @@ import Data.Maybe ( fromJust, isNothing, catMaybes )
1212
1313main = defaultMainWithHooks $
1414 simpleUserHooks { runTests = runTestSuite
15− , preConf = checkReferenceODT
1615 , postBuild = makeManPages }
1716
1817-- | Run test suite.
@@ -20,34 +19,6 @@ runTestSuite _ _ _ _ = do
2019 inDirectory "tests" $ runCommand "runhaskell -i.. RunTests.hs" >>= waitForProcess
2120 return ()
2221
23−-- | If reference.odt needs rebuilding, build it.
24−checkReferenceODT _ _ = inDirectory "odt-styles" $ do
25− let refodt = "reference.odt"
26− let deps = [ "meta.xml", "content.xml", "settings.xml", "META-INF/manifest.xml",
27− "Thumbnails/thumbnail.png", "styles.xml", "mimetype" ]
28− modifiedDeps <- modifiedDependencies refodt deps
29− if null modifiedDeps
30− then return ()
31− else makeReferenceODT modifiedDeps
32− return emptyHookedBuildInfo
33−
34−-- | Create reference.odt by zipping up sources in odt-styles directory.
35−makeReferenceODT :: [FilePath] -> IO ()
36−makeReferenceODT sources = do
37− zipPathMaybe <- findExecutable "zip"
38− if isNothing zipPathMaybe
39− then error $ "The 'zip' command, which is needed to build reference.odt\n" ++
40− "from sources in the odt-styles directory, was not found.\n" ++
41− "Try again after installing zip (http://www.info-zip.org/Zip.html).\n" ++
42− "Or use the pandoc source tarball, which contains a prebuilt reference.odt."
43− else do
44− putStrLn "Creating reference.odt:"
45− ec <- runProcess (fromJust zipPathMaybe) (["-9", "-r", "reference.odt"] ++ sources)
46− Nothing Nothing Nothing Nothing (Just stderr) >>= waitForProcess
47− case ec of
48− ExitSuccess -> return ()
49− _ -> error "Error creating ODT."
50−
5122-- | Build man pages from markdown sources in man/man1/.
5223makeManPages _ _ _ _ = do
5324 mapM makeManPage ["pandoc.1", "hsmarkdown.1", "html2markdown.1", "markdown2pdf.1"]
System/IO/UTF8.hsdeleted−118
@@ -1,118 +0,0 @@
1−-----------------------------------------------------------------------------
2−-- |
3−-- Module : System.IO.UTF8
4−-- Copyright : (c) Eric Mertens 2007
5−-- License : BSD3-style (see LICENSE)
6−--
7−-- Maintainer: emertens@galois.com
8−-- Stability : experimental
9−-- Portability : portable
10−--
11−-- String IO preserving UTF8 encoding.
12−--
13−
14−module System.IO.UTF8 (
15− print
16− , putStr
17− , putStrLn
18− , getLine
19− , readLn
20− , readFile
21− , writeFile
22− , appendFile
23− , getContents
24− , hGetLine
25− , hGetContents
26− , hPutStr
27− , hPutStrLn
28− ) where
29−
30−import Control.Monad (liftM)
31−import Data.Char (ord, chr)
32−import Data.Word (Word8)
33−import Prelude (String, ($), (=<<), (>>=), (.), map, toEnum, fromEnum, Read,
34− Show(..))
35−import System.IO (Handle, IO, FilePath)
36−import qualified System.IO as IO
37−
38−import Codec.Binary.UTF8.String (encode, decode)
39−
40−
41−-- | Encode a string in UTF8 form.
42−encodeString :: String -> String
43−encodeString xs = bytesToString (encode xs)
44−
45−-- | Decode a string from UTF8
46−decodeString :: String -> String
47−decodeString xs = decode (stringToBytes xs)
48−
49−-- | Convert a list of bytes to a String
50−bytesToString :: [Word8] -> String
51−bytesToString xs = map (chr . fromEnum) xs
52−
53−-- | String to list of bytes.
54−stringToBytes :: String -> [Word8]
55−stringToBytes xs = map (toEnum . ord) xs
56−
57−-- | The 'print' function outputs a value of any printable type to the
58−-- standard output device. This function differs from the
59−-- System.IO.print in that it preserves any UTF8 encoding of the shown value.
60−--
61−print :: Show a => a -> IO ()
62−print x = putStrLn (show x)
63−
64−-- | Write a UTF8 string to the standard output device
65−putStr :: String -> IO ()
66−putStr x = IO.putStr (encodeString x)
67−
68−-- | The same as 'putStr', but adds a newline character.
69−putStrLn :: String -> IO ()
70−putStrLn x = IO.putStrLn (encodeString x)
71−
72−-- | Read a UTF8 line from the standard input device
73−getLine :: IO String
74−getLine = liftM decodeString IO.getLine
75−
76−-- | The 'readLn' function combines 'getLine' and 'readIO', preserving UTF8
77−readLn :: Read a => IO a
78−readLn = IO.readIO =<< getLine
79−
80−-- | The 'readFile' function reads a file and
81−-- returns the contents of the file as a UTF8 string.
82−-- The file is read lazily, on demand, as with 'getContents'.
83−readFile :: FilePath -> IO String
84−readFile n = liftM decodeString (IO.openBinaryFile n IO.ReadMode >>=
85− IO.hGetContents)
86−
87−-- | The computation 'writeFile' @file str@ function writes the UTF8 string @str@,
88−-- to the file @file@.
89−writeFile :: FilePath -> String -> IO ()
90−writeFile n c = IO.withBinaryFile n IO.WriteMode $ \ h ->
91− IO.hPutStr h $ encodeString c
92−
93−-- | The computation 'appendFile' @file str@ function appends the UTF8 string @str@,
94−-- to the file @file@.
95−appendFile :: FilePath -> String -> IO ()
96−appendFile n c = IO.withBinaryFile n IO.AppendMode $ \h ->
97− IO.hPutStr h $ encodeString c
98−
99−-- | Read a UTF8 line from a Handle
100−hGetLine :: Handle -> IO String
101−hGetLine h = liftM decodeString $ IO.hGetLine h
102−
103−-- | Lazily read a UTF8 string from a Handle
104−hGetContents :: Handle -> IO String
105−hGetContents h = liftM decodeString (IO.hGetContents h)
106−
107−-- | Write a UTF8 string to a Handle.
108−hPutStr :: Handle -> String -> IO ()
109−hPutStr h s = IO.hPutStr h (encodeString s)
110−
111−-- | Write a UTF8 string to a Handle, appending a newline.
112−hPutStrLn :: Handle -> String -> IO ()
113−hPutStrLn h s = IO.hPutStrLn h (encodeString s)
114−
115−-- | Lazily read stdin as a UTF8 string.
116−getContents :: IO String
117−getContents = liftM decodeString IO.getContents
118−
Text/Pandoc/ODT.hs+46−98
@@ -29,22 +29,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2929Functions for producing an ODT file from OpenDocument XML.
3030-}
3131module Text.Pandoc.ODT ( saveOpenDocumentAsODT ) where
32−import Text.Pandoc.TH ( binaryContentsOf )
33−import Data.Maybe ( fromJust )
34−import Data.List ( partition, intersperse )
35−import System.Directory
36−import System.FilePath ( (</>), takeDirectory, takeFileName, splitDirectories )
37−import System.Process ( runProcess, waitForProcess )
38−import System.Exit
39−import Text.XML.Light
40−import Text.XML.Light.Cursor
41−import Text.Pandoc.Shared ( withTempDir )
42−import Network.URI ( isURI )
43−import qualified Data.ByteString as B ( writeFile, pack )
44−import Data.ByteString.Internal ( c2w )
32+import Text.Pandoc.TH ( makeZip )
33+import Data.List ( find )
34+import System.FilePath ( (</>), takeFileName )
35+import qualified Data.ByteString.Lazy as B
36+import Data.ByteString.Lazy.UTF8 ( fromString )
4537import Prelude hiding ( writeFile, readFile )
46−import System.IO ( stderr )
47−import System.IO.UTF8
38+import Codec.Archive.Zip
39+import Control.Applicative ( (<$>) )
40+import Text.ParserCombinators.Parsec
41+import System.Time
4842
4943-- | Produce an ODT file from OpenDocument XML.
5044saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
@@ -52,89 +46,43 @@ saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
5246 -> String -- ^ OpenDocument XML contents.
5347 -> IO ()
5448saveOpenDocumentAsODT destinationODTPath sourceDirRelative xml = do
55− let zipCmd = "zip"
56− -- check for zip in path:
57− zipPathMaybe <- findExecutable zipCmd
58− let zipPath = case zipPathMaybe of
59− Nothing -> error $ "The '" ++ zipCmd ++
60− "' command, which is needed to build an ODT file, was not found.\n" ++
61− "It can be obtained from http://www.info-zip.org/Zip.html\n" ++
62− "Debian (and Debian-based) linux: apt-get install zip\n" ++
63− "Windows: See http://gnuwin32.sourceforge.net/packages/zip.htm"
64− Just x -> x
65− withTempDir "pandoc-odt" $ \tempDir -> do
66− let tempODT = tempDir </> "reference.odt"
67− B.writeFile tempODT $ B.pack $ map c2w $(binaryContentsOf $ "odt-styles" </> "reference.odt")
68− xml' <- handlePictures tempODT sourceDirRelative xml
69− writeFile (tempDir </> "content.xml") xml'
70− ph <- runProcess zipPath ["-9", "-q", "-r", tempODT, "content.xml", "Pictures"]
71− (Just tempDir) Nothing Nothing Nothing (Just stderr)
72− ec <- waitForProcess ph -- requires compilation with -threaded
73− case ec of
74− ExitSuccess -> copyFile tempODT destinationODTPath
75− _ -> error "Error creating ODT." >> exitWith ec
49+ let refArchive = read $(makeZip "odt-styles")
50+ -- handle pictures
51+ let (newContents, pics) =
52+ case runParser pPictures [] "OpenDocument XML contents" xml of
53+ Left err -> error $ show err
54+ Right x -> x
55+ picEntries <- mapM (makePictureEntry sourceDirRelative) pics
56+ (TOD epochTime _) <- getClockTime
57+ let contentEntry = toEntry "content.xml" epochTime $ fromString newContents
58+ let archive = foldr addEntryToArchive refArchive (contentEntry : picEntries)
59+ B.writeFile destinationODTPath $ fromArchive archive
7660
77−-- | Find <draw:image ... /> elements and copy the file (xlink:href attribute) into Pictures/ in
78−-- the zip file. If filename is a URL, attempt to download it. Modify xlink:href attributes
79−-- to point to the new locations in Pictures/. Return modified XML.
80−handlePictures :: FilePath -- ^ Path of ODT file in temp directory
81− -> FilePath -- ^ Directory (relative) containing source file
82− -> String -- ^ OpenDocument XML string
83− -> IO String -- ^ Modified XML
84−handlePictures tempODT sourceDirRelative xml = do
85− let parsed = case parseXMLDoc xml of
86− Nothing -> error "Could not parse OpenDocument XML."
87− Just x -> x
88− let cursor = case (fromForest $ elContent parsed) of
89− Nothing -> error "ODT appears empty"
90− Just x -> x
91− cursor' <- scanPictures tempODT sourceDirRelative cursor
92− let modified = parsed { elContent = toForest $ root cursor' }
93− return $ showTopElement modified
61+makePictureEntry :: FilePath -- ^ Relative directory of source file
62+ -> (FilePath, String) -- ^ Path and new path of picture
63+ -> IO Entry
64+makePictureEntry sourceDirRelative (path, newPath) = do
65+ entry <- readEntry [] $ sourceDirRelative </> path
66+ return (entry { eRelativePath = newPath })
9467
95−scanPictures :: FilePath -> FilePath -> Cursor -> IO Cursor
96−scanPictures tempODT sourceDirRelative cursor = do
97− cursor' <- handleTree tempODT sourceDirRelative cursor
98− case right cursor' of
99− Just n -> scanPictures tempODT sourceDirRelative n
100− Nothing -> return cursor'
101−
102−handleTree :: FilePath -> FilePath -> Cursor -> IO Cursor
103−handleTree tempODT sourceDirRelative cursor = do
104− case firstChild cursor of
105− Nothing -> modifyContentM (handleContent tempODT sourceDirRelative) cursor
106− Just n -> scanPictures tempODT sourceDirRelative n >>= return . fromJust . parent
107−
108−-- | If content is an image link, handle it appropriately.
109−-- Otherwise, handle children if any.
110−handleContent :: FilePath -> FilePath -> Content -> IO Content
111−handleContent tempODT sourceDirRelative content@(Elem el) = do
112− if qName (elName el) == "image"
113− then do
114− let (hrefs, rest) = partition (\a -> qName (attrKey a) == "href") $ elAttribs el
115− let href = case hrefs of
116− [] -> error $ "No href found in " ++ show el
117− [x] -> x
118− _ -> error $ "Multiple hrefs found in " ++ show el
119− if isURI $ attrVal href
120− then return content
121− else do -- treat as filename
122− let oldLoc = sourceDirRelative </> attrVal href
123− fileExists <- doesFileExist oldLoc
124− if fileExists
125− then do
126− let pref = take 230 $ concat $ intersperse "_" $
127− splitDirectories $ takeDirectory $ attrVal href
128− let picName = pref ++ "_" ++ (takeFileName $ attrVal href)
129− let tempDir = takeDirectory tempODT
130− createDirectoryIfMissing False $ tempDir </> "Pictures"
131− copyFile oldLoc $ tempDir </> "Pictures" </> picName
132− let newAttrs = (href { attrVal = "Pictures/" ++ picName }) : rest
133− return $ Elem (el { elAttribs = newAttrs })
134− else do
135− hPutStrLn stderr $ "Warning: Unable to find image at " ++ oldLoc ++ " - ignoring."
136− return content
137− else return content
138−
139−handleContent _ _ c = return c -- not Element
68+pPictures :: GenParser Char [(FilePath, String)] ([Char], [(FilePath, String)])
69+pPictures = do
70+ contents <- concat <$> many (pPicture <|> many1 (noneOf "<") <|> string "<")
71+ pics <- getState
72+ return (contents, pics)
14073
74+pPicture :: GenParser Char [(FilePath, String)] [Char]
75+pPicture = try $ do
76+ string "<draw:image xlink:href=\""
77+ path <- manyTill anyChar (char '"')
78+ let filename = takeFileName path
79+ pics <- getState
80+ newPath <- case find (\(o, _) -> o == path) pics of
81+ Just (_, new) -> return new
82+ Nothing -> do
83+ -- get a unique name
84+ let dups = length $ (filter (\(o, _) -> takeFileName o == filename)) pics
85+ let new = "Pictures/" ++ replicate dups '0' ++ filename
86+ updateState ((path, new) :)
87+ return new
88+ return $ "<draw:image xlink:href=\"" ++ newPath ++ "\""
Text/Pandoc/Shared.hs+9−17
@@ -101,7 +101,7 @@ module Text.Pandoc.Shared (
101101 WriterOptions (..),
102102 defaultWriterOptions,
103103 -- * File handling
104− withTempDir
104+ inDirectory
105105 ) where
106106
107107import Text.Pandoc.Definition
@@ -112,10 +112,7 @@ import Text.Pandoc.CharacterReferences ( characterReference )
112112import Data.Char ( toLower, toUpper, ord, isLower, isUpper )
113113import Data.List ( find, isPrefixOf )
114114import Control.Monad ( join )
115−import Control.Exception ( bracket )
116115import Network.URI ( parseURI, URI (..), isAllowedInURI )
117−import System.FilePath ( (</>), (<.>) )
118−import System.IO.Error ( catch, ioError, isAlreadyExistsError )
119116import System.Directory
120117import Prelude hiding ( putStrLn, writeFile, readFile, getContents )
121118import System.IO.UTF8
@@ -920,16 +917,11 @@ defaultWriterOptions =
920917-- File handling
921918--
922919
923−-- | Perform a function in a temporary directory and clean up.
924−withTempDir :: FilePath -> (FilePath -> IO a) -> IO a
925−withTempDir baseName = bracket (createTempDir 0 baseName) (removeDirectoryRecursive)
926−
927−-- | Create a temporary directory with a unique name.
928−createTempDir :: Integer -> FilePath -> IO FilePath
929−createTempDir num baseName = do
930− sysTempDir <- getTemporaryDirectory
931− let dirName = sysTempDir </> baseName <.> show num
932− catch (createDirectory dirName >> return dirName) $
933− \e -> if isAlreadyExistsError e
934− then createTempDir (num + 1) baseName
935− else ioError e
920+-- | Perform an IO action in a directory, returning to starting directory.
921+inDirectory :: FilePath -> IO a -> IO a
922+inDirectory path action = do
923+ oldDir <- getCurrentDirectory
924+ setCurrentDirectory path
925+ result <- action
926+ setCurrentDirectory oldDir
927+ return result
Text/Pandoc/TH.hs+13−1
@@ -30,7 +30,8 @@ Template haskell functions used by Pandoc modules.
3030-}
3131module Text.Pandoc.TH (
3232 contentsOf,
33− binaryContentsOf
33+ binaryContentsOf,
34+ makeZip
3435 ) where
3536
3637import Language.Haskell.TH
@@ -39,6 +40,8 @@ import qualified Data.ByteString as B
3940import Data.ByteString.Internal ( w2c )
4041import Prelude hiding ( readFile )
4142import System.IO.UTF8
43+import Codec.Archive.Zip
44+import Text.Pandoc.Shared ( inDirectory )
4245
4346-- | Insert contents of text file into a template.
4447contentsOf :: FilePath -> ExpQ
@@ -51,3 +54,12 @@ binaryContentsOf p = lift =<< (runIO $ B.readFile p)
5154
5255instance Lift B.ByteString where
5356 lift x = return (LitE (StringL $ map w2c $ B.unpack x))
57+
58+instance Lift Archive where
59+ lift x = return (LitE (StringL $ show x ))
60+
61+-- | Construct zip file from files in a directory, and
62+-- insert into a template.
63+makeZip :: FilePath -> ExpQ
64+makeZip path = lift =<< (runIO $ inDirectory path $ addFilesToArchive [OptRecursive] emptyArchive ["."])
65+
Text/XML/Light.hsdeleted−96
@@ -1,96 +0,0 @@
1−{-# LANGUAGE FlexibleInstances #-}
2−--------------------------------------------------------------------
3−-- |
4−-- Module : Text.XML.Light
5−-- Copyright : (c) Galois, Inc. 2007
6−-- License : BSD3
7−--
8−-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
9−-- Stability : provisional
10−-- Portability: portability
11−--
12−-- A lightweight XML parsing, filtering and generating library.
13−--
14−-- This module reexports functions from:
15−--
16−-- * "Text.XML.Light.Types"
17−--
18−-- * "Text.XML.Light.Proc"
19−--
20−-- * "Text.XML.Light.Input"
21−--
22−-- * "Text.XML.Light.Output"
23−--
24−
25−module Text.XML.Light (
26−
27− module Text.XML.Light,
28− module Text.XML.Light.Types,
29− module Text.XML.Light.Proc,
30− module Text.XML.Light.Input,
31− module Text.XML.Light.Output
32−
33− ) where
34−
35−import Text.XML.Light.Types
36−import Text.XML.Light.Proc
37−import Text.XML.Light.Input
38−import Text.XML.Light.Output
39−
40−-- | Add an attribute to an element.
41−add_attr :: Attr -> Element -> Element
42−add_attr a e = add_attrs [a] e
43−
44−-- | Add some attributes to an element.
45−add_attrs :: [Attr] -> Element -> Element
46−add_attrs as e = e { elAttribs = as ++ elAttribs e }
47−
48−-- | Create an unqualified name.
49−unqual :: String -> QName
50−unqual x = blank_name { qName = x }
51−
52−-- | A smart element constructor which uses the type of its argument
53−-- to determine what sort of element to make.
54−class Node t where
55− node :: QName -> t -> Element
56−
57−instance Node ([Attr],[Content]) where
58− node n (attrs,cont) = blank_element { elName = n
59− , elAttribs = attrs
60− , elContent = cont
61− }
62−
63−instance Node [Attr] where node n as = node n (as,[]::[Content])
64−instance Node Attr where node n a = node n [a]
65−instance Node () where node n () = node n ([]::[Attr])
66−
67−instance Node [Content] where node n cs = node n ([]::[Attr],cs)
68−instance Node Content where node n c = node n [c]
69−instance Node ([Attr],Content) where node n (as,c) = node n (as,[c])
70−instance Node (Attr,Content) where node n (a,c) = node n ([a],[c])
71−
72−instance Node ([Attr],[Element]) where
73− node n (as,cs) = node n (as,map Elem cs)
74−
75−instance Node ([Attr],Element) where node n (as,c) = node n (as,[c])
76−instance Node (Attr,Element) where node n (a,c) = node n ([a],c)
77−instance Node ([Element]) where node n es = node n ([]::[Attr],es)
78−instance Node (Element) where node n e = node n [e]
79−
80−instance Node ([Attr],[CData]) where
81− node n (as,cs) = node n (as,map Text cs)
82−
83−instance Node ([Attr],CData) where node n (as,c) = node n (as,[c])
84−instance Node (Attr,CData) where node n (a,c) = node n ([a],c)
85−instance Node [CData] where node n es = node n ([]::[Attr],es)
86−instance Node CData where node n e = node n [e]
87−
88−instance Node ([Attr],String) where
89− node n (as,t) = node n (as,blank_cdata { cdData = t })
90−
91−instance Node (Attr,String) where node n (a,t) = node n ([a],t)
92−instance Node [Char] where node n t = node n ([]::[Attr],t)
93−
94−-- | Create node with unqualified name
95−unode :: Node t => String -> t -> Element
96−unode = node . unqual
Text/XML/Light/Cursor.hsdeleted−327
@@ -1,327 +0,0 @@
1−--------------------------------------------------------------------
2−-- |
3−-- Module : Text.XML.Light.Cursor
4−-- Copyright : (c) Galois, Inc. 2008
5−-- License : BSD3
6−--
7−-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
8−-- Stability : provisional
9−-- Portability:
10−--
11−-- XML cursors for working XML content withing the context of
12−-- an XML document. This implemntation is based on the general
13−-- tree zipper written by Krasimir Angelov and Iavor S. Diatchki.
14−--
15−
16−module Text.XML.Light.Cursor
17− ( Tag(..), getTag, setTag, fromTag
18− , Cursor(..), Path
19−
20− -- * Conversions
21− , fromContent
22− , fromElement
23− , fromForest
24− , toForest
25− , toTree
26−
27− -- * Moving around
28− , parent
29− , root
30− , getChild
31− , firstChild
32− , lastChild
33− , left
34− , right
35−
36− -- ** Searching
37− , findChild
38− , findLeft
39− , findRight
40−
41− -- * Node classification
42− , isRoot
43− , isFirst
44− , isLast
45− , isLeaf
46− , isChild
47− , hasChildren
48− , getNodeIndex
49−
50− -- * Updates
51− , setContent
52− , modifyContent
53− , modifyContentM
54−
55− -- ** Inserting content
56− , insertLeft
57− , insertRight
58− , insertGoLeft
59− , insertGoRight
60−
61− -- ** Removing content
62− , removeLeft
63− , removeRight
64− , removeGoLeft
65− , removeGoRight
66− , removeGoUp
67−
68− ) where
69−
70−import Text.XML.Light.Types
71−import Data.Maybe(isNothing)
72−
73−data Tag = Tag { tagName :: QName
74− , tagAttribs :: [Attr]
75− , tagLine :: Maybe Line
76− } deriving (Show)
77−
78−getTag :: Element -> Tag
79−getTag e = Tag { tagName = elName e
80− , tagAttribs = elAttribs e
81− , tagLine = elLine e
82− }
83−
84−setTag :: Tag -> Element -> Element
85−setTag t e = fromTag t (elContent e)
86−
87−fromTag :: Tag -> [Content] -> Element
88−fromTag t cs = Element { elName = tagName t
89− , elAttribs = tagAttribs t
90− , elLine = tagLine t
91− , elContent = cs
92− }
93−
94−type Path = [([Content],Tag,[Content])]
95−
96−-- | The position of a piece of content in an XML document.
97−data Cursor = Cur
98− { current :: Content -- ^ The currently selected content.
99− , lefts :: [Content] -- ^ Siblings on the left, closest first.
100− , rights :: [Content] -- ^ Siblings on the right, closest first.
101− , parents :: Path -- ^ The contexts of the parent elements of this location.
102− } deriving (Show)
103−
104−-- Moving around ---------------------------------------------------------------
105−
106−-- | The parent of the given location.
107−parent :: Cursor -> Maybe Cursor
108−parent loc =
109− case parents loc of
110− (pls,v,prs) : ps -> Just
111− Cur { current = Elem
112− (fromTag v
113− (combChildren (lefts loc) (current loc) (rights loc)))
114− , lefts = pls, rights = prs, parents = ps
115− }
116− [] -> Nothing
117−
118−
119−-- | The top-most parent of the given location.
120−root :: Cursor -> Cursor
121−root loc = maybe loc root (parent loc)
122−
123−-- | The left sibling of the given location.
124−left :: Cursor -> Maybe Cursor
125−left loc =
126− case lefts loc of
127− t : ts -> Just loc { current = t, lefts = ts
128− , rights = current loc : rights loc }
129− [] -> Nothing
130−
131−-- | The right sibling of the given location.
132−right :: Cursor -> Maybe Cursor
133−right loc =
134− case rights loc of
135− t : ts -> Just loc { current = t, lefts = current loc : lefts loc
136− , rights = ts }
137− [] -> Nothing
138−
139−-- | The first child of the given location.
140−firstChild :: Cursor -> Maybe Cursor
141−firstChild loc =
142− do (t : ts, ps) <- downParents loc
143− return Cur { current = t, lefts = [], rights = ts , parents = ps }
144−
145−-- | The last child of the given location.
146−lastChild :: Cursor -> Maybe Cursor
147−lastChild loc =
148− do (ts, ps) <- downParents loc
149− case reverse ts of
150− l : ls -> return Cur { current = l, lefts = ls, rights = []
151− , parents = ps }
152− [] -> Nothing
153−
154−-- | Find the next left sibling that satisfies a predicate.
155−findLeft :: (Cursor -> Bool) -> Cursor -> Maybe Cursor
156−findLeft p loc = do loc1 <- left loc
157− if p loc1 then return loc1 else findLeft p loc1
158−
159−-- | Find the next right sibling that satisfies a predicate.
160−findRight :: (Cursor -> Bool) -> Cursor -> Maybe Cursor
161−findRight p loc = do loc1 <- right loc
162− if p loc1 then return loc1 else findRight p loc1
163−
164−-- | The first child that satisfies a predicate.
165−findChild :: (Cursor -> Bool) -> Cursor -> Maybe Cursor
166−findChild p loc =
167− do loc1 <- firstChild loc
168− if p loc1 then return loc1 else findRight p loc1
169−
170−-- | The child with the given index (starting from 0).
171−getChild :: Int -> Cursor -> Maybe Cursor
172−getChild n loc =
173− do (ts,ps) <- downParents loc
174− (ls,t,rs) <- splitChildren ts n
175− return Cur { current = t, lefts = ls, rights = rs, parents = ps }
176−
177−
178−-- | private: computes the parent for "down" operations.
179−downParents :: Cursor -> Maybe ([Content], Path)
180−downParents loc =
181− case current loc of
182− Elem e -> Just ( elContent e
183− , (lefts loc, getTag e, rights loc) : parents loc
184− )
185− _ -> Nothing
186−
187−-- Conversions -----------------------------------------------------------------
188−
189−-- | A cursor for the guven content.
190−fromContent :: Content -> Cursor
191−fromContent t = Cur { current = t, lefts = [], rights = [], parents = [] }
192−
193−-- | A cursor for the guven element.
194−fromElement :: Element -> Cursor
195−fromElement e = fromContent (Elem e)
196−
197−-- | The location of the first tree in a forest.
198−fromForest :: [Content] -> Maybe Cursor
199−fromForest (t:ts) = Just Cur { current = t, lefts = [], rights = ts
200− , parents = [] }
201−fromForest [] = Nothing
202−
203−-- | Computes the tree containing this location.
204−toTree :: Cursor -> Content
205−toTree loc = current (root loc)
206−
207−-- | Computes the forest containing this location.
208−toForest :: Cursor -> [Content]
209−toForest loc = let r = root loc in combChildren (lefts r) (current r) (rights r)
210−
211−
212−-- Queries ---------------------------------------------------------------------
213−
214−-- | Are we at the top of the document?
215−isRoot :: Cursor -> Bool
216−isRoot loc = null (parents loc)
217−
218−-- | Are we at the left end of the the document?
219−isFirst :: Cursor -> Bool
220−isFirst loc = null (lefts loc)
221−
222−-- | Are we at the right end of the document?
223−isLast :: Cursor -> Bool
224−isLast loc = null (rights loc)
225−
226−-- | Are we at the bottom of the document?
227−isLeaf :: Cursor -> Bool
228−isLeaf loc = isNothing (downParents loc)
229−
230−-- | Do we have a parent?
231−isChild :: Cursor -> Bool
232−isChild loc = not (isRoot loc)
233−
234−-- | Get the node index inside the sequence of children
235−getNodeIndex :: Cursor -> Int
236−getNodeIndex loc = length (lefts loc)
237−
238−-- | Do we have children?
239−hasChildren :: Cursor -> Bool
240−hasChildren loc = not (isLeaf loc)
241−
242−
243−
244−-- Updates ---------------------------------------------------------------------
245−
246−-- | Change the current content.
247−setContent :: Content -> Cursor -> Cursor
248−setContent t loc = loc { current = t }
249−
250−-- | Modify the current content.
251−modifyContent :: (Content -> Content) -> Cursor -> Cursor
252−modifyContent f loc = setContent (f (current loc)) loc
253−
254−-- | Modify the current content, allowing for an effect.
255−modifyContentM :: Monad m => (Content -> m Content) -> Cursor -> m Cursor
256−modifyContentM f loc = do x <- f (current loc)
257− return (setContent x loc)
258−
259−-- | Insert content to the left of the current position.
260−insertLeft :: Content -> Cursor -> Cursor
261−insertLeft t loc = loc { lefts = t : lefts loc }
262−
263−-- | Insert content to the right of the current position.
264−insertRight :: Content -> Cursor -> Cursor
265−insertRight t loc = loc { rights = t : rights loc }
266−
267−-- | Remove the conent on the left of the current position, if any.
268−removeLeft :: Cursor -> Maybe (Content,Cursor)
269−removeLeft loc = case lefts loc of
270− l : ls -> return (l,loc { lefts = ls })
271− [] -> Nothing
272−
273−-- | Remove the conent on the right of the current position, if any.
274−removeRight :: Cursor -> Maybe (Content,Cursor)
275−removeRight loc = case rights loc of
276− l : ls -> return (l,loc { rights = ls })
277− [] -> Nothing
278−
279−
280−-- | Insert content to the left of the current position.
281−-- The new content becomes the current position.
282−insertGoLeft :: Content -> Cursor -> Cursor
283−insertGoLeft t loc = loc { current = t, rights = current loc : rights loc }
284−
285−-- | Insert content to the right of the current position.
286−-- The new content becomes the current position.
287−insertGoRight :: Content -> Cursor -> Cursor
288−insertGoRight t loc = loc { current = t, lefts = current loc : lefts loc }
289−
290−-- | Remove the current element.
291−-- The new position is the one on the left.
292−removeGoLeft :: Cursor -> Maybe Cursor
293−removeGoLeft loc = case lefts loc of
294− l : ls -> Just loc { current = l, lefts = ls }
295− [] -> Nothing
296−
297−-- | Remove the current element.
298−-- The new position is the one on the right.
299−removeGoRight :: Cursor -> Maybe Cursor
300−removeGoRight loc = case rights loc of
301− l : ls -> Just loc { current = l, rights = ls }
302− [] -> Nothing
303−
304−-- | Remove the current element.
305−-- The new position is the parent of the old position.
306−removeGoUp :: Cursor -> Maybe Cursor
307−removeGoUp loc =
308− case parents loc of
309− (pls,v,prs) : ps -> Just
310− Cur { current = Elem (fromTag v (reverse (lefts loc) ++ rights loc))
311− , lefts = pls, rights = prs, parents = ps
312− }
313− [] -> Nothing
314−
315−
316−-- | private: Gets the given element of a list.
317−-- Also returns the preceeding elements (reversed) and the folloing elements.
318−splitChildren :: [a] -> Int -> Maybe ([a],a,[a])
319−splitChildren _ n | n < 0 = Nothing
320−splitChildren cs pos = loop [] cs pos
321− where loop acc (x:xs) 0 = Just (acc,x,xs)
322− loop acc (x:xs) n = loop (x:acc) xs $! n-1
323− loop _ _ _ = Nothing
324−
325−-- | private: combChildren ls x ys = reverse ls ++ [x] ++ ys
326−combChildren :: [a] -> a -> [a] -> [a]
327−combChildren ls t rs = foldl (flip (:)) (t:rs) ls
Text/XML/Light/Input.hsdeleted−307
@@ -1,307 +0,0 @@
1−--------------------------------------------------------------------
2−-- |
3−-- Module : Text.XML.Light.Input
4−-- Copyright : (c) Galois, Inc. 2007
5−-- License : BSD3
6−--
7−-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
8−-- Stability : provisional
9−-- Portability: portable
10−--
11−-- Lightweight XML parsing
12−--
13−
14−module Text.XML.Light.Input (parseXML,parseXMLDoc) where
15−
16−import Text.XML.Light.Types
17−import Text.XML.Light.Proc
18−import Text.XML.Light.Output(tagEnd)
19−
20−import Data.Char(isSpace)
21−import Data.List(isPrefixOf)
22−import Numeric(readHex)
23−
24−-- | parseXMLDoc, parse a XMLl document to maybe an element
25−parseXMLDoc :: String -> Maybe Element
26−parseXMLDoc xs = strip (parseXML xs)
27− where strip cs = case onlyElems cs of
28− e : es
29− | "?xml" `isPrefixOf` qName (elName e)
30− -> strip (map Elem es)
31− | otherwise -> Just e
32− _ -> Nothing
33−
34−-- | parseXML to a list of content chunks
35−parseXML :: String -> [Content]
36−parseXML xs = parse $ tokens $ preprocess xs
37−
38−------------------------------------------------------------------------
39−
40−parse :: [Token] -> [Content]
41−parse [] = []
42−parse ts = let (es,_,ts1) = nodes ([],Nothing) [] ts
43− in es ++ parse ts1
44−
45−-- Information about namespaces.
46−-- The first component is a map that associates prefixes to URIs,
47−-- the second is the URI for the default namespace, if one was provided.
48−type NSInfo = ([(String,String)],Maybe String)
49−
50−nodes :: NSInfo -> [QName] -> [Token] -> ([Content], [QName], [Token])
51−
52−nodes ns ps (TokCRef ref : ts) =
53− let (es,qs,ts1) = nodes ns ps ts
54− in (CRef ref : es, qs, ts1)
55−
56−nodes ns ps (TokText txt : ts) =
57− let (es,qs,ts1) = nodes ns ps ts
58− (more,es1) = case es of
59− Text cd : es1'
60− | cdVerbatim cd == cdVerbatim txt -> (cdData cd,es1')
61− _ -> ([],es)
62−
63− in (Text txt { cdData = cdData txt ++ more } : es1, qs, ts1)
64−
65−nodes cur_info ps (TokStart p t as empty : ts) = (node : siblings, open, toks)
66− where
67− new_name = annotName new_info t
68− new_info = foldr addNS cur_info as
69− node = Elem Element { elLine = Just p
70− , elName = new_name
71− , elAttribs = map (annotAttr new_info) as
72− , elContent = children
73− }
74−
75− (children,(siblings,open,toks))
76− | empty = ([], nodes cur_info ps ts)
77− | otherwise = let (es1,qs1,ts1) = nodes new_info (new_name:ps) ts
78− in (es1,
79− case qs1 of
80− [] -> nodes cur_info ps ts1
81− _ : qs3 -> ([],qs3,ts1))
82−
83−nodes ns ps (TokEnd p t : ts) = let t1 = annotName ns t
84− in case break (t1 ==) ps of
85− (as,_:_) -> ([],as,ts)
86− -- Unknown closing tag. Insert as text.
87− (_,[]) ->
88− let (es,qs,ts1) = nodes ns ps ts
89− in (Text CData {
90− cdLine = Just p,
91− cdVerbatim = CDataText,
92− cdData = tagEnd t ""
93− } : es,qs, ts1)
94−
95−nodes _ ps [] = ([],ps,[])
96−
97−
98−annotName :: NSInfo -> QName -> QName
99−annotName (namespaces,def_ns) n =
100− n { qURI = maybe def_ns (`lookup` namespaces) (qPrefix n) }
101−
102−annotAttr :: NSInfo -> Attr -> Attr
103−annotAttr ns a@(Attr { attrKey = k}) =
104− case (qPrefix k, qName k) of
105− (Nothing,"xmlns") -> a
106− _ -> a { attrKey = annotName ns k }
107−
108−addNS :: Attr -> NSInfo -> NSInfo
109−addNS (Attr { attrKey = key, attrVal = val }) (ns,def) =
110− case (qPrefix key, qName key) of
111− (Nothing,"xmlns") -> (ns, if null val then Nothing else Just val)
112− (Just "xmlns", k) -> ((k, val) : ns, def)
113− _ -> (ns,def)
114−
115−
116−-- Lexer -----------------------------------------------------------------------
117−
118−type LChar = (Line,Char)
119−type LString = [LChar]
120−data Token = TokStart Line QName [Attr] Bool -- is empty?
121− | TokEnd Line QName
122− | TokCRef String
123− | TokText CData
124− deriving Show
125−
126−tokens :: String -> [Token]
127−tokens = tokens' . linenumber 1
128−
129−tokens' :: LString -> [Token]
130−tokens' ((_,'<') : c@(_,'!') : cs) = special c cs
131−
132−tokens' ((_,'<') : cs) = tag (dropSpace cs) -- we are being nice here
133−tokens' [] = []
134−tokens' cs@((l,_):_) = let (as,bs) = breakn ('<' ==) cs
135− in map cvt (decode_text as) ++ tokens' bs
136−
137− -- XXX: Note, some of the lines might be a bit inacuarate
138− where cvt (TxtBit x) = TokText CData { cdLine = Just l
139− , cdVerbatim = CDataText
140− , cdData = x
141− }
142− cvt (CRefBit x) = case cref_to_char x of
143− Just c -> TokText CData { cdLine = Just l
144− , cdVerbatim = CDataText
145− , cdData = [c]
146− }
147− Nothing -> TokCRef x
148−
149−
150−special :: LChar -> LString -> [Token]
151−special _ ((_,'-') : (_,'-') : cs) = skip cs
152− where skip ((_,'-') : (_,'-') : (_,'>') : ds) = tokens' ds
153− skip (_ : ds) = skip ds
154− skip [] = [] -- unterminated comment
155−
156−special c ((_,'[') : (_,'C') : (_,'D') : (_,'A') : (_,'T') : (_,'A') : (_,'[')
157− : cs) =
158− let (xs,ts) = cdata cs
159− in TokText CData { cdLine = Just (fst c), cdVerbatim = CDataVerbatim, cdData = xs }
160− : tokens' ts
161− where cdata ((_,']') : (_,']') : (_,'>') : ds) = ([],ds)
162− cdata ((_,d) : ds) = let (xs,ys) = cdata ds in (d:xs,ys)
163− cdata [] = ([],[])
164−
165−special c cs =
166− let (xs,ts) = munch "" 0 cs
167− in TokText CData { cdLine = Just (fst c), cdVerbatim = CDataRaw, cdData = '<':'!':(reverse xs) } : tokens' ts
168− where munch acc nesting ((_,'>') : ds)
169− | nesting == (0::Int) = ('>':acc,ds)
170− | otherwise = munch ('>':acc) (nesting-1) ds
171− munch acc nesting ((_,'<') : ds)
172− = munch ('<':acc) (nesting+1) ds
173− munch acc n ((_,x) : ds) = munch (x:acc) n ds
174− munch acc _ [] = (acc,[]) -- unterminated DTD markup
175−
176−--special c cs = tag (c : cs) -- invalid specials are processed as tags
177−
178−
179−qualName :: LString -> (QName,LString)
180−qualName xs = let (as,bs) = breakn endName xs
181− (q,n) = case break (':'==) as of
182− (q1,_:n1) -> (Just q1, n1)
183− _ -> (Nothing, as)
184− in (QName { qURI = Nothing, qPrefix = q, qName = n }, bs)
185− where endName x = isSpace x || x == '=' || x == '>' || x == '/'
186−
187−
188−
189−
190−
191−tag :: LString -> [Token]
192−tag ((p,'/') : cs) = let (n,ds) = qualName (dropSpace cs)
193− in TokEnd p n : case ds of
194− (_,'>') : es -> tokens' es
195− -- tag was not properly closed...
196− _ -> tokens' ds
197−tag [] = []
198−tag cs = let (n,ds) = qualName cs
199− (as,b,ts) = attribs (dropSpace ds)
200− in TokStart (fst (head cs)) n as b : ts
201−
202−attribs :: LString -> ([Attr], Bool, [Token])
203−attribs cs = case cs of
204− (_,'>') : ds -> ([], False, tokens' ds)
205−
206− (_,'/') : ds -> ([], True, case ds of
207− (_,'>') : es -> tokens' es
208− -- insert missing > ...
209− _ -> tokens' ds)
210−
211− (_,'?') : (_,'>') : ds -> ([], True, tokens' ds)
212−
213− -- doc ended within a tag..
214− [] -> ([],False,[])
215−
216− _ -> let (a,cs1) = attrib cs
217− (as,b,ts) = attribs cs1
218− in (a:as,b,ts)
219−
220−attrib :: LString -> (Attr,LString)
221−attrib cs = let (ks,cs1) = qualName cs
222− (vs,cs2) = attr_val (dropSpace cs1)
223− in ((Attr ks (decode_attr vs)),dropSpace cs2)
224−
225−attr_val :: LString -> (String,LString)
226−attr_val ((_,'=') : cs) = string (dropSpace cs)
227−attr_val cs = ("",cs)
228−
229−
230−dropSpace :: LString -> LString
231−dropSpace = dropWhile (isSpace . snd)
232−
233−-- | Match the value for an attribute. For malformed XML we do
234−-- our best to guess the programmer's intention.
235−string :: LString -> (String,LString)
236−string ((_,'"') : cs) = break' ('"' ==) cs
237−
238−-- Allow attributes to be enclosed between ' '.
239−string ((_,'\'') : cs) = break' ('\'' ==) cs
240−
241−-- Allow attributes that are not enclosed by anything.
242−string cs = breakn eos cs
243− where eos x = isSpace x || x == '>' || x == '/'
244−
245−
246−break' :: (a -> Bool) -> [(b,a)] -> ([a],[(b,a)])
247−break' p xs = let (as,bs) = breakn p xs
248− in (as, case bs of
249− [] -> []
250− _ : cs -> cs)
251−
252−breakn :: (a -> Bool) -> [(b,a)] -> ([a],[(b,a)])
253−breakn p l = (map snd as,bs) where (as,bs) = break (p . snd) l
254−
255−
256−
257−decode_attr :: String -> String
258−decode_attr cs = concatMap cvt (decode_text cs)
259− where cvt (TxtBit x) = x
260− cvt (CRefBit x) = case cref_to_char x of
261− Just c -> [c]
262− Nothing -> '&' : x ++ ";"
263−
264−data Txt = TxtBit String | CRefBit String deriving Show
265−
266−decode_text :: [Char] -> [Txt]
267−decode_text xs@('&' : cs) = case break (';' ==) cs of
268− (as,_:bs) -> CRefBit as : decode_text bs
269− _ -> [TxtBit xs]
270−decode_text [] = []
271−decode_text cs = let (as,bs) = break ('&' ==) cs
272− in TxtBit as : decode_text bs
273−
274−cref_to_char :: [Char] -> Maybe Char
275−cref_to_char cs = case cs of
276− '#' : ds -> num_esc ds
277− "lt" -> Just '<'
278− "gt" -> Just '>'
279− "amp" -> Just '&'
280− "apos" -> Just '\''
281− "quot" -> Just '"'
282− _ -> Nothing
283−
284−num_esc :: String -> Maybe Char
285−num_esc cs = case cs of
286− 'x' : ds -> check (readHex ds)
287− _ -> check (reads cs)
288−
289− where check [(n,"")] = cvt_char n
290− check _ = Nothing
291−
292−cvt_char :: Int -> Maybe Char
293−cvt_char x
294− | fromEnum (minBound :: Char) <= x && x <= fromEnum (maxBound::Char)
295− = Just (toEnum x)
296− | otherwise = Nothing
297−
298−preprocess :: String -> String
299−preprocess ('\r' : '\n' : cs) = '\n' : preprocess cs
300−preprocess ('\r' : cs) = '\n' : preprocess cs
301−preprocess (c : cs) = c : preprocess cs
302−preprocess [] = []
303−
304−linenumber :: Line -> String -> LString
305−linenumber _ [] = []
306−linenumber n ('\n':s) = n' `seq` ((n,'\n'):linenumber n' s) where n' = n + 1
307−linenumber n (c:s) = (n,c) : linenumber n s
Text/XML/Light/Output.hsdeleted−150
@@ -1,150 +0,0 @@
1−--------------------------------------------------------------------
2−-- |
3−-- Module : Text.XML.Light.Output
4−-- Copyright : (c) Galois, Inc. 2007
5−-- License : BSD3
6−--
7−-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
8−-- Stability : provisional
9−-- Portability:
10−--
11−-- Output handling for the lightweight XML lib.
12−--
13−
14−module Text.XML.Light.Output
15− ( showTopElement, showContent, showElement, showCData, showQName, showAttr
16− , ppTopElement, ppContent, ppElement
17− , tagEnd, xml_header
18− ) where
19−
20−import Text.XML.Light.Types
21−import Data.Char
22−import Data.List ( isPrefixOf )
23−
24−-- | The XML 1.0 header
25−xml_header :: String
26−xml_header = "<?xml version='1.0' ?>"
27−
28−-- | Pretty printing renders XML documents faithfully,
29−-- with the exception that whitespace may be added\/removed
30−-- in non-verbatim character data.
31−ppTopElement :: Element -> String
32−ppTopElement e = unlines [xml_header,ppElement e]
33−
34−-- | Pretty printing elements
35−ppElement :: Element -> String
36−ppElement e = ppElementS "" e ""
37−
38−-- | Pretty printing content
39−ppContent :: Content -> String
40−ppContent x = ppContentS "" x ""
41−
42−-- | Pretty printing content using ShowS
43−ppContentS :: String -> Content -> ShowS
44−ppContentS i x xs = case x of
45− Elem e -> ppElementS i e xs
46− Text c -> ppCData i c xs
47− CRef r -> showCRefS r xs
48−
49−ppElementS :: String -> Element -> ShowS
50−ppElementS i e xs = i ++ (tagStart (elName e) (elAttribs e) $
51− case elContent e of
52− []
53− | not ("?xml" `isPrefixOf` (qName $ elName e)) -> " />" ++ xs
54− | otherwise -> " ?>" ++ xs
55− [Text t] -> ">" ++ ppCData "" t (tagEnd (elName e) xs)
56− cs -> ">\n" ++ foldr ppSub (i ++ tagEnd (elName e) xs) cs
57− where ppSub e1 = ppContentS (" " ++ i) e1 . showChar '\n'
58− )
59−
60−ppCData :: String -> CData -> ShowS
61−ppCData i c xs = i ++ if (cdVerbatim c /= CDataText )
62− then showCDataS c xs
63− else foldr cons xs (showCData c)
64−
65− where cons :: Char -> String -> String
66− cons '\n' ys = "\n" ++ i ++ ys
67− cons y ys = y : ys
68−
69−
70−
71−--------------------------------------------------------------------------------
72−-- | Adds the <?xml?> header.
73−showTopElement :: Element -> String
74−showTopElement c = xml_header ++ showElement c
75−
76−showContent :: Content -> String
77−showContent c = showContentS c ""
78−
79−showElement :: Element -> String
80−showElement c = showElementS c ""
81−
82−showCData :: CData -> String
83−showCData c = showCDataS c ""
84−
85−-- Note: crefs should not contain '&', ';', etc.
86−showCRefS :: String -> ShowS
87−showCRefS r xs = '&' : r ++ ';' : xs
88−
89−-- | Good for transmition (no extra white space etc.) but less readable.
90−showContentS :: Content -> ShowS
91−showContentS (Elem e) = showElementS e
92−showContentS (Text cs) = showCDataS cs
93−showContentS (CRef cs) = showCRefS cs
94−
95−-- | Good for transmition (no extra white space etc.) but less readable.
96−showElementS :: Element -> ShowS
97−showElementS e xs =
98− tagStart (elName e) (elAttribs e)
99− $ case elContent e of
100− [] -> " />" ++ xs
101− ch -> '>' : foldr showContentS (tagEnd (elName e) xs) ch
102−
103−-- | Convert a text element to characters.
104−showCDataS :: CData -> ShowS
105−showCDataS cd =
106− case cdVerbatim cd of
107− CDataText -> escStr (cdData cd)
108− CDataVerbatim -> showString "<![CDATA[" . escCData (cdData cd) . showString "]]>"
109− CDataRaw -> \ xs -> cdData cd ++ xs
110−
111−--------------------------------------------------------------------------------
112−escCData :: String -> ShowS
113−escCData (']' : ']' : '>' : cs) = showString "]]]]><![CDATA[>" . escCData cs
114−escCData (c : cs) = showChar c . escCData cs
115−escCData [] = id
116−
117−escChar :: Char -> ShowS
118−escChar c = case c of
119− '<' -> showString "&lt;"
120− '>' -> showString "&gt;"
121− '&' -> showString "&amp;"
122− '"' -> showString "&quot;"
123− '\'' -> showString "&apos;"
124− -- XXX: Is this really wortherd?
125− -- We could deal with these issues when we convert characters to bytes.
126− _ | (oc <= 0x7f && isPrint c) || c == '\n' || c == '\r' -> showChar c
127− | otherwise -> showString "&#" . shows oc . showChar ';'
128− where oc = ord c
129−
130−escStr :: String -> ShowS
131−escStr cs rs = foldr escChar rs cs
132−
133−tagEnd :: QName -> ShowS
134−tagEnd qn rs = '<':'/':showQName qn ++ '>':rs
135−
136−tagStart :: QName -> [Attr] -> ShowS
137−tagStart qn as rs = '<':showQName qn ++ as_str ++ rs
138− where as_str = if null as then "" else ' ' : unwords (map showAttr as)
139−
140−showAttr :: Attr -> String
141−showAttr (Attr qn v) = showQName qn ++ '=' : '"' : escStr v "\""
142−
143−showQName :: QName -> String
144−showQName q = pre ++ qName q
145− where pre = case qPrefix q of
146− Nothing -> ""
147− Just p -> p ++ ":"
148−
149−
150−
Text/XML/Light/Proc.hsdeleted−103
@@ -1,103 +0,0 @@
1−--------------------------------------------------------------------
2−-- |
3−-- Module : Text.XML.Light.Proc
4−-- Copyright : (c) Galois, Inc. 2007
5−-- License : BSD3
6−--
7−-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
8−-- Stability : provisional
9−-- Portability:
10−--
11−--------------------------------------------------------------------
12−
13−
14−module Text.XML.Light.Proc where
15−
16−import Text.XML.Light.Types
17−
18−import Data.Maybe(listToMaybe)
19−import Data.List(find)
20−
21−-- | Get the text value of an XML element. This function
22−-- ignores non-text elements, and concatenates all text elements.
23−strContent :: Element -> String
24−strContent e = concatMap cdData $ onlyText $ elContent e
25−
26−-- | Select only the elements from a list of XML content.
27−onlyElems :: [Content] -> [Element]
28−onlyElems xs = [ x | Elem x <- xs ]
29−
30−-- | Select only the elements from a parent.
31−elChildren :: Element -> [Element]
32−elChildren e = [ x | Elem x <- elContent e ]
33−
34−-- | Select only the text from a list of XML content.
35−onlyText :: [Content] -> [CData]
36−onlyText xs = [ x | Text x <- xs ]
37−
38−-- | Find all immediate children with the given name.
39−findChildren :: QName -> Element -> [Element]
40−findChildren q e = filterChildren ((q ==) . elName) e
41−
42−-- | Filter all immediate children wrt a given predicate.
43−filterChildren :: (Element -> Bool) -> Element -> [Element]
44−filterChildren p e = filter p (onlyElems (elContent e))
45−
46−
47−-- | Filter all immediate children wrt a given predicate over their names.
48−filterChildrenName :: (QName -> Bool) -> Element -> [Element]
49−filterChildrenName p e = filter (p.elName) (onlyElems (elContent e))
50−
51−
52−-- | Find an immediate child with the given name.
53−findChild :: QName -> Element -> Maybe Element
54−findChild q e = listToMaybe (findChildren q e)
55−
56−-- | Find an immediate child with the given name.
57−filterChild :: (Element -> Bool) -> Element -> Maybe Element
58−filterChild p e = listToMaybe (filterChildren p e)
59−
60−-- | Find an immediate child with name matching a predicate.
61−filterChildName :: (QName -> Bool) -> Element -> Maybe Element
62−filterChildName p e = listToMaybe (filterChildrenName p e)
63−
64−-- | Find the left-most occurrence of an element matching given name.
65−findElement :: QName -> Element -> Maybe Element
66−findElement q e = listToMaybe (findElements q e)
67−
68−-- | Filter the left-most occurrence of an element wrt. given predicate.
69−filterElement :: (Element -> Bool) -> Element -> Maybe Element
70−filterElement p e = listToMaybe (filterElements p e)
71−
72−-- | Filter the left-most occurrence of an element wrt. given predicate.
73−filterElementName :: (QName -> Bool) -> Element -> Maybe Element
74−filterElementName p e = listToMaybe (filterElementsName p e)
75−
76−-- | Find all non-nested occurances of an element.
77−-- (i.e., once we have found an element, we do not search
78−-- for more occurances among the element's children).
79−findElements :: QName -> Element -> [Element]
80−findElements qn e = filterElementsName (qn==) e
81−
82−-- | Find all non-nested occurrences of an element wrt. given predicate.
83−-- (i.e., once we have found an element, we do not search
84−-- for more occurances among the element's children).
85−filterElements :: (Element -> Bool) -> Element -> [Element]
86−filterElements p e
87− | p e = [e]
88− | otherwise = concatMap (filterElements p) $ onlyElems $ elContent e
89−
90−-- | Find all non-nested occurences of an element wrt a predicate over element names.
91−-- (i.e., once we have found an element, we do not search
92−-- for more occurances among the element's children).
93−filterElementsName :: (QName -> Bool) -> Element -> [Element]
94−filterElementsName p e = filterElements (p.elName) e
95−
96−-- | Lookup the value of an attribute.
97−findAttr :: QName -> Element -> Maybe String
98−findAttr x e = attrVal `fmap` find ((x ==) . attrKey) (elAttribs e)
99−
100−-- | Lookup attribute name from list.
101−lookupAttr :: QName -> [Attr] -> Maybe String
102−lookupAttr x as = attrVal `fmap` find ((x ==) . attrKey) as
103−
Text/XML/Light/Types.hsdeleted−91
@@ -1,91 +0,0 @@
1−--------------------------------------------------------------------
2−-- |
3−-- Module : Text.XML.Light.Types
4−-- Copyright : (c) Galois, Inc. 2007
5−-- License : BSD3
6−--
7−-- Maintainer: Iavor S. Diatchki <diatchki@galois.com>
8−-- Stability : provisional
9−-- Portability:
10−--
11−-- Basic XML types.
12−--
13−
14−module Text.XML.Light.Types where
15−
16−-- | A line is an Integer
17−type Line = Integer
18−
19−-- | XML content
20−data Content = Elem Element
21− | Text CData
22− | CRef String
23− deriving Show
24−
25−-- | XML elements
26−data Element = Element {
27− elName :: QName,
28− elAttribs :: [Attr],
29− elContent :: [Content],
30− elLine :: Maybe Line
31− } deriving Show
32−
33−-- | XML attributes
34−data Attr = Attr {
35− attrKey :: QName,
36− attrVal :: String
37− } deriving (Eq,Ord,Show)
38−
39−-- | XML CData
40−data CData = CData {
41− cdVerbatim :: CDataKind,
42− cdData :: String,
43− cdLine :: Maybe Line
44− } deriving Show
45−
46−data CDataKind
47− = CDataText -- ^ Ordinary character data; pretty printer escapes &, < etc.
48− | CDataVerbatim -- ^ Unescaped character data; pretty printer embeds it in <![CDATA[..
49− | CDataRaw -- ^ As-is character data; pretty printer passes it along without any escaping or CDATA wrap-up.
50− deriving ( Eq, Show )
51−
52−-- | XML qualified names
53−data QName = QName {
54− qName :: String,
55− qURI :: Maybe String,
56− qPrefix :: Maybe String
57− } deriving Show
58−
59−
60−instance Eq QName where
61− q1 == q2 = compare q1 q2 == EQ
62−
63−instance Ord QName where
64− compare q1 q2 =
65− case compare (qName q1) (qName q2) of
66− EQ -> case (qURI q1, qURI q2) of
67− (Nothing,Nothing) -> compare (qPrefix q1) (qPrefix q2)
68− (u1,u2) -> compare u1 u2
69− x -> x
70−
71−
72−-- blank elements --------------------------------------------------------------
73−
74−-- | Blank names
75−blank_name :: QName
76−blank_name = QName { qName = "", qURI = Nothing, qPrefix = Nothing }
77−
78−-- | Blank cdata
79−blank_cdata :: CData
80−blank_cdata = CData { cdVerbatim = CDataText, cdData = "", cdLine = Nothing }
81−
82−-- | Blank elements
83−blank_element :: Element
84−blank_element = Element
85− { elName = blank_name
86− , elAttribs = []
87− , elContent = []
88− , elLine = Nothing
89− }
90−
91−
debian/control+3−3
@@ -2,7 +2,7 @@ Source: pandoc
22Section: text
33Priority: optional
44Maintainer: Recai Oktaş <roktas@debian.org>
5−Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.12), ghc6 (>= 6.8.2-1), libghc6-xhtml-dev, libghc6-mtl-dev, libghc6-network-dev, zip
5+Build-Depends: debhelper (>= 4.0.0), haskell-devscripts (>=0.5.12), ghc6 (>= 6.8.2-1), libghc6-xhtml-dev, libghc6-mtl-dev, libghc6-network-dev
66Build-Depends-Indep: haddock
77Standards-Version: 3.7.3
88Homepage: http://johnmacfarlane.net/pandoc/
@@ -12,7 +12,7 @@ XS-Vcs-Browser: http://pandoc.googlecode.com/svn/trunk
1212Package: pandoc
1313Section: text
1414Architecture: any
15−Depends: ${shlibs:Depends}, zip, texlive-latex-recommended | tetex-extra
15+Depends: ${shlibs:Depends}, texlive-latex-recommended | tetex-extra
1616Suggests: tidy, wget | w3m
1717Description: general markup converter
1818 Pandoc is a Haskell library for converting from one markup format to
@@ -38,7 +38,7 @@ Description: general markup converter
3838Package: libghc6-pandoc-dev
3939Section: libdevel
4040Architecture: any
41−Depends: ${haskell:Depends}, libghc6-xhtml-dev, libghc6-mtl-dev, libghc6-network-dev, zip, texlive-latex-recommended | tetex-extra
41+Depends: ${haskell:Depends}, libghc6-xhtml-dev, libghc6-mtl-dev, libghc6-network-dev, texlive-latex-recommended | tetex-extra
4242Suggests: pandoc-doc
4343Description: general markup converter
4444 Pandoc is a Haskell library for converting from one markup format to
debian/copyright−62
@@ -57,68 +57,6 @@ by Eric A. Meyer
5757
5858Released under an explicit Public Domain License
5959
60−----------------------------------------------------------------------
61−System/IO/UTF8.hs and Codec/Binary/UTF8/String.hs
62−from the utf8-string package on HackageDB
63−Copyright (c) 2007, Galois Inc.
64−All rights reserved.
65−
66−Redistribution and use in source and binary forms, with or without
67−modification, are permitted provided that the following conditions are met:
68− * Redistributions of source code must retain the above copyright
69− notice, this list of conditions and the following disclaimer.
70− * Redistributions in binary form must reproduce the above copyright
71− notice, this list of conditions and the following disclaimer in the
72− documentation and/or other materials provided with the distribution.
73− * Neither the name of Galois Inc. nor the
74− names of its contributors may be used to endorse or promote products
75− derived from this software without specific prior written permission.
76−
77−THIS SOFTWARE IS PROVIDED BY Galois Inc. ``AS IS'' AND ANY
78−EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
79−WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
80−DISCLAIMED. IN NO EVENT SHALL Galois Inc. BE LIABLE FOR ANY
81−DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
82−(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
83−LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
84−ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
85−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
86−SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87−
88−----------------------------------------------------------------------
89−Text/XML/Light/*
90−from the xml package on HackageDB
91−(c) 2007 Galois Inc.
92−
93−All rights reserved.
94−
95−Redistribution and use in source and binary forms, with or without
96−modification, are permitted provided that the following conditions
97−are met:
98−
99−1. Redistributions of source code must retain the above copyright
100−notice, this list of conditions and the following disclaimer.
101−
102−2. Redistributions in binary form must reproduce the above copyright
103−notice, this list of conditions and the following disclaimer in the
104−documentation and/or other materials provided with the distribution.
105−
106−3. Neither the name of the author nor the names of his contributors
107−may be used to endorse or promote products derived from this software
108−without specific prior written permission.
109−
110−THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS
111−OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
112−WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
113−DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
114−ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
115−DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
116−OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
117−HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
118−STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
119−ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
120−POSSIBILITY OF SUCH DAMAGE.
121−
12260------------------------------------------------------------------------
12361Diff.hs in tests/
12462from the Diff package v 0.1.2 (Data.Algorithm.Diff)
odt-styles/content.xmldeleted−17
@@ -1,17 +0,0 @@
1−<?xml version="1.0" encoding="utf-8" ?>
2−
3−<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0">
4− <office:scripts />
5− <office:font-face-decls>
6− <style:font-face style:name="&amp;apos;Lucida Sans Unicode&amp;apos;" svg:font-family="Lucida Sans Unicode" />
7− <style:font-face style:name="&amp;apos;Tahoma&amp;apos;" svg:font-family="Tahoma" />
8− <style:font-face style:name="&amp;apos;Times New Roman&amp;apos;" svg:font-family="Times New Roman" />
9− </office:font-face-decls>
10− <office:automatic-styles>
11− </office:automatic-styles>
12− <office:body>
13− <office:text>
14− </office:text>
15− </office:body>
16−
17−</office:document-content>
pandoc.cabal+4−16
@@ -38,12 +38,12 @@ Extra-Source-Files:
3838 -- documentation
3939 README, INSTALL, COPYRIGHT, COPYING, changelog,
4040 -- sources for man pages
41− man/man1/pandoc.1.md,
41+ man/man1/pandoc.1.md, man/man1/markdown2pdf.1.md,
4242 man/man1/html2markdown.1.md, man/man1/hsmarkdown.1.md,
4343 -- Makefile
4444 Makefile,
4545 -- wrappers
46− html2markdown, hsmarkdown,
46+ markdown2pdf, html2markdown, hsmarkdown,
4747 -- data for DefaultHeaders.hs
4848 data/headers/ConTeXt.header,
4949 data/headers/Docbook.header,
@@ -65,13 +65,11 @@ Extra-Source-Files:
6565 data/ui/default/print.css,
6666 -- data for ODT writer
6767 odt-styles/meta.xml,
68− odt-styles/content.xml,
6968 odt-styles/settings.xml,
7069 odt-styles/META-INF/manifest.xml,
7170 odt-styles/Thumbnails/thumbnail.png,
7271 odt-styles/styles.xml,
7372 odt-styles/mimetype,
74− odt-styles/reference.odt,
7573 -- tests
7674 tests/bodybg.gif,
7775 tests/writer.latex,
@@ -151,7 +149,7 @@ Library
151149 Exposed-Modules: Text.Pandoc.Biblio
152150 cpp-options: -D_CITEPROC
153151 Build-Depends: parsec < 3, xhtml, mtl, network, filepath, process, directory,
154− template-haskell, bytestring
152+ template-haskell, bytestring, zip-archive, utf8-string, old-time
155153 Hs-Source-Dirs: .
156154 Exposed-Modules: Text.Pandoc,
157155 Text.Pandoc.Blocks,
@@ -180,17 +178,7 @@ Library
180178 Text.Pandoc.Writers.RTF,
181179 Text.Pandoc.Writers.S5
182180 Other-Modules: Text.Pandoc.XML,
183− Text.Pandoc.TH,
184− -- from xml package
185− Text.XML.Light,
186− Text.XML.Light.Types,
187− Text.XML.Light.Output,
188− Text.XML.Light.Input,
189− Text.XML.Light.Proc,
190− Text.XML.Light.Cursor,
191− -- from utf8-string package
192− System.IO.UTF8,
193− Codec.Binary.UTF8.String
181+ Text.Pandoc.TH
194182 Extensions: CPP, TemplateHaskell, FlexibleInstances
195183 Ghc-Options: -O2 -Wall -threaded
196184 Ghc-Prof-Options: -auto-all