git.iko.soy/typeable/pandoc
on master help sign in
Simplified and improved UTF8 handling:
d00da31fiddlosopher
Codec/Binary/UTF8/String.hsnew file+97
@@ -0,0 +1,97 @@
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+
INSTALL−5
@@ -24,10 +24,6 @@ GHC and the required libraries using `apt-get`:
24
24
25 sudo apt-get install ghc6 libghc6-xhtml-dev libghc6-mtl-dev libghc6-network-dev
25 sudo apt-get install ghc6 libghc6-xhtml-dev libghc6-mtl-dev libghc6-network-dev
26
26
27−Pandoc will use the [utf8-string] library if it is installed; otherwise, it
28−will use its own internal module for UTF-8 I/O. The utf8-string library is
29−not a required dependency, but it may improve performance slightly.
30−
31[GHC]: http://www.haskell.org/ghc/
27[GHC]: http://www.haskell.org/ghc/
32[GHC Download]: http://www.haskell.org/ghc/download.html
28[GHC Download]: http://www.haskell.org/ghc/download.html
33[Cabal]: http://www.haskell.org/cabal/
29[Cabal]: http://www.haskell.org/cabal/
@@ -36,7 +32,6 @@ not a required dependency, but it may improve performance slightly.
36[Fink]: http://finkproject.org
32[Fink]: http://finkproject.org
37[Ubuntu]: http://www.ubuntu.com
33[Ubuntu]: http://www.ubuntu.com
38[debian]: http://www.debian.org/
34[debian]: http://www.debian.org/
39−[utf8-string]: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string
40
35
41Getting the source
36Getting the source
42------------------
37------------------
Main.hs−9
@@ -43,11 +43,7 @@ import Data.Maybe ( fromMaybe )
43import Data.Char ( toLower )
43import Data.Char ( toLower )
44import Prelude hiding ( putStrLn, writeFile, readFile, getContents )
44import Prelude hiding ( putStrLn, writeFile, readFile, getContents )
45import System.IO ( stdout, stderr )
45import System.IO ( stdout, stderr )
46−#ifdef _UTF8STRING
47import System.IO.UTF8
46import System.IO.UTF8
48−#else
49−import Text.Pandoc.UTF8
50−#endif
51#ifdef _CITEPROC
47#ifdef _CITEPROC
52import Text.CSL
48import Text.CSL
53import Text.Pandoc.Biblio
49import Text.Pandoc.Biblio
@@ -61,11 +57,6 @@ copyrightMessage = "\nCopyright (C) 2006-7 John MacFarlane\n" ++
61
57
62compileInfo :: String
58compileInfo :: String
63compileInfo =
59compileInfo =
64−#ifdef _UTF8STRING
65− " +utf8-string" ++
66−#else
67− " -utf8-string" ++
68−#endif
69#ifdef _CITEPROC
60#ifdef _CITEPROC
70 " +citeproc" ++
61 " +citeproc" ++
71#else
62#else
Setup.hs+1−1
@@ -17,7 +17,7 @@ main = defaultMainWithHooks $
17
17
18-- | Run test suite.
18-- | Run test suite.
19runTestSuite _ _ _ _ = do
19runTestSuite _ _ _ _ = do
20− inDirectory "tests" $ runCommand "runhaskell RunTests.hs" >>= waitForProcess
20+ inDirectory "tests" $ runCommand "runhaskell -i.. RunTests.hs" >>= waitForProcess
21 return ()
21 return ()
22
22
23-- | If reference.odt needs rebuilding, build it.
23-- | If reference.odt needs rebuilding, build it.
System/IO/UTF8.hsnew file+118
@@ -0,0 +1,118 @@
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+1−5
@@ -1,4 +1,4 @@
1−{-# LANGUAGE TemplateHaskell, CPP #-}
1+{-# LANGUAGE TemplateHaskell #-}
2{-
2{-
3Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
3Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
4
4
@@ -44,11 +44,7 @@ import qualified Data.ByteString as B ( writeFile, pack )
44import Data.ByteString.Internal ( c2w )
44import Data.ByteString.Internal ( c2w )
45import Prelude hiding ( writeFile, readFile )
45import Prelude hiding ( writeFile, readFile )
46import System.IO ( stderr )
46import System.IO ( stderr )
47−#ifdef _UTF8STRING
48import System.IO.UTF8
47import System.IO.UTF8
49−#else
50−import Text.Pandoc.UTF8
51−#endif
52
48
53-- | Produce an ODT file from OpenDocument XML.
49-- | Produce an ODT file from OpenDocument XML.
54saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
50saveOpenDocumentAsODT :: FilePath -- ^ Pathname of ODT file to be produced.
Text/Pandoc/PDF.hs−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-
1{-
3Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
2Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
4
3
@@ -38,11 +37,7 @@ import System.Environment ( getEnvironment )
38import Text.Pandoc.Shared ( withTempDir )
37import Text.Pandoc.Shared ( withTempDir )
39import Prelude hiding ( writeFile, readFile, putStrLn )
38import Prelude hiding ( writeFile, readFile, putStrLn )
40import System.IO ( stderr, openFile, IOMode (..), hClose )
39import System.IO ( stderr, openFile, IOMode (..), hClose )
41−#ifdef _UTF8STRING
42import System.IO.UTF8
40import System.IO.UTF8
43−#else
44−import Text.Pandoc.UTF8
45−#endif
46
41
47-- | Produce an PDF file from LaTeX.
42-- | Produce an PDF file from LaTeX.
48saveLaTeXAsPDF :: FilePath -- ^ Pathname of PDF file to be produced.
43saveLaTeXAsPDF :: FilePath -- ^ Pathname of PDF file to be produced.
Text/Pandoc/Shared.hs−4
@@ -118,11 +118,7 @@ import System.FilePath ( (</>), (<.>) )
118import System.IO.Error ( catch, ioError, isAlreadyExistsError )
118import System.IO.Error ( catch, ioError, isAlreadyExistsError )
119import System.Directory
119import System.Directory
120import Prelude hiding ( putStrLn, writeFile, readFile, getContents )
120import Prelude hiding ( putStrLn, writeFile, readFile, getContents )
121−#ifdef _UTF8STRING
122import System.IO.UTF8
121import System.IO.UTF8
123−#else
124−import Text.Pandoc.UTF8
125−#endif
126
122
127--
123--
128-- List processing
124-- List processing
Text/Pandoc/TH.hs−5
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
2{-# OPTIONS_GHC -fno-warn-orphans #-}
1{-# OPTIONS_GHC -fno-warn-orphans #-}
3{-
2{-
4Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
3Copyright (C) 2008 John MacFarlane <jgm@berkeley.edu>
@@ -39,11 +38,7 @@ import Language.Haskell.TH.Syntax (Lift (..))
39import qualified Data.ByteString as B
38import qualified Data.ByteString as B
40import Data.ByteString.Internal ( w2c )
39import Data.ByteString.Internal ( w2c )
41import Prelude hiding ( readFile )
40import Prelude hiding ( readFile )
42−#ifdef _UTF8STRING
43import System.IO.UTF8
41import System.IO.UTF8
44−#else
45−import Text.Pandoc.UTF8
46−#endif
47
42
48-- | Insert contents of text file into a template.
43-- | Insert contents of text file into a template.
49contentsOf :: FilePath -> ExpQ
44contentsOf :: FilePath -> ExpQ
Text/Pandoc/UTF8.hsdeleted−76
@@ -1,76 +0,0 @@
1−-- | Functions for IO using UTF-8 encoding.
2−--
3−-- The basic encoding and decoding functions are taken from
4−-- <http://www.cse.ogi.edu/~hallgren/Talks/LHiH/base/lib/UTF8.hs>.
5−-- (c) 2003, OGI School of Science & Engineering, Oregon Health and
6−-- Science University.
7−--
8−-- From the Char module supplied with HBC.
9−-- Modified by Martin Norbaeck to pass illegal UTF-8 sequences unchanged.
10−-- Modified by John MacFarlane to use [Word8] and export IO functions.
11−
12−module Text.Pandoc.UTF8 (
13− putStrLn
14− , putStr
15− , hPutStrLn
16− , hPutStr
17− , getContents
18− , readFile
19− , writeFile
20− ) where
21−import Data.Word
22−import System.IO ( Handle )
23−import qualified Data.ByteString.Lazy as BS
24−import Prelude hiding ( putStrLn, putStr, getContents, readFile, writeFile )
25−
26−putStrLn :: String -> IO ()
27−putStrLn = BS.putStrLn . BS.pack . toUTF8
28−
29−putStr :: String -> IO ()
30−putStr = BS.putStr . BS.pack . toUTF8
31−
32−hPutStrLn :: Handle -> String -> IO ()
33−hPutStrLn h = BS.hPut h . BS.pack . toUTF8 . (++ "\n")
34−
35−hPutStr :: Handle -> String -> IO ()
36−hPutStr h = BS.hPut h . BS.pack . toUTF8
37−
38−readFile :: FilePath -> IO String
39−readFile p = BS.readFile p >>= return . fromUTF8 . BS.unpack
40−
41−writeFile :: FilePath -> String -> IO ()
42−writeFile p = BS.writeFile p . BS.pack . toUTF8
43−
44−getContents :: IO String
45−getContents = BS.getContents >>= return . fromUTF8 . BS.unpack
46−
47−-- | Take a list of bytes in UTF-8 encoding and decode it into a Unicode string.
48−fromUTF8 :: [Word8] -> String
49−fromUTF8 [] = ""
50−fromUTF8 (0xef : 0xbb : 0xbf :cs) = fromUTF8 cs -- skip BOM (byte order marker)
51−fromUTF8 (c:c':cs) | 0xc0 <= c && c <= 0xdf &&
52− 0x80 <= c' && c' <= 0xbf =
53− toEnum ((fromEnum c `mod` 0x20) * 0x40 + fromEnum c' `mod` 0x40) : fromUTF8 cs
54−fromUTF8 (c:c':c'':cs) | 0xe0 <= c && c <= 0xef &&
55− 0x80 <= c' && c' <= 0xbf &&
56− 0x80 <= c'' && c'' <= 0xbf =
57− toEnum ((fromEnum c `mod` 0x10 * 0x1000) + (fromEnum c' `mod` 0x40) * 0x40 + fromEnum c'' `mod` 0x40) : fromUTF8 cs
58−fromUTF8 (c:cs) = toEnum (fromEnum c) : fromUTF8 cs
59−
60−-- | Take a Unicode string and encode it as a list of bytes in UTF-8 encoding.
61−toUTF8 :: String -> [Word8]
62−toUTF8 "" = []
63−toUTF8 (c:cs) =
64− if c > '\x0000' && c < '\x0080' then
65− toEnum (fromEnum c) : toUTF8 cs
66− else if c < toEnum 0x0800 then
67− let i = fromEnum c
68− in toEnum (0xc0 + i `div` 0x40) :
69− toEnum (0x80 + i `mod` 0x40) :
70− toUTF8 cs
71− else
72− let i = fromEnum c
73− in toEnum (0xe0 + i `div` 0x1000) :
74− toEnum (0x80 + (i `mod` 0x1000) `div` 0x40) :
75− toEnum (0x80 + i `mod` 0x40) :
76− toUTF8 cs
debian/copyright+24−30
@@ -58,42 +58,36 @@ by Eric A. Meyer
58Released under an explicit Public Domain License
58Released under an explicit Public Domain License
59
59
60----------------------------------------------------------------------
60----------------------------------------------------------------------
61−UTF8.hs
61+System/IO/UTF8.hs and Codec/Binary/UTF8/String.hs
62−Copyright (c) 2003, OGI School of Science & Engineering, Oregon Health &
62+from the utf8-string package on HackageDB
63+Copyright (c) 2007, Galois Inc.
63−Science University, All rights reserved.
64+All rights reserved.
64−Modified by Martin Norbäck, to pass illegal utf-8 sequences through unchanged.
65−Modified 2006-8 John MacFarlane.
66
65
67Redistribution and use in source and binary forms, with or without
66Redistribution and use in source and binary forms, with or without
68−modification, are permitted provided that the following conditions
67+modification, are permitted provided that the following conditions are met:
69−are met:
70−
71−- Redistributions of source code must retain the above copyright
68+ * Redistributions of source code must retain the above copyright
72− notice, this list of conditions and the following disclaimer.
69+ notice, this list of conditions and the following disclaimer.
73−
74−- Redistributions in binary form must reproduce the above
70+ * Redistributions in binary form must reproduce the above copyright
75− copyright notice, this list of conditions and the following
71+ notice, this list of conditions and the following disclaimer in the
76− disclaimer in the documentation and/or other materials provided
72+ documentation and/or other materials provided with the distribution.
77− with the distribution.
78−
79−- Neither the name of OGI or OHSU nor the names of its
73+ * Neither the name of Galois Inc. nor the
80− contributors may be used to endorse or promote products derived
74+ names of its contributors may be used to endorse or promote products
81− from this software without specific prior written permission.
75+ derived from this software without specific prior written permission.
82−
76+
83−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
77+THIS SOFTWARE IS PROVIDED BY Galois Inc. ``AS IS'' AND ANY
84−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
78+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
85−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
79+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
86−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
80+DISCLAIMED. IN NO EVENT SHALL Galois Inc. BE LIABLE FOR ANY
87−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
88−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
81+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
89−TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
82+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
90−PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
83+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
91−LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
84+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
92−NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
85+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
93SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
94
87
95----------------------------------------------------------------------
88----------------------------------------------------------------------
96Text/XML/Light/*
89Text/XML/Light/*
90+from the xml package on HackageDB
97(c) 2007 Galois Inc.
91(c) 2007 Galois Inc.
98
92
99All rights reserved.
93All rights reserved.
pandoc.cabal+5−14
@@ -134,9 +134,6 @@ Flag executable
134Flag library
134Flag library
135 Description: Build the pandoc library.
135 Description: Build the pandoc library.
136 Default: True
136 Default: True
137−Flag utf8-string
138− Description: Use utf8-string library for UTF-8 I/O.
139− Default: True
140Flag citeproc
137Flag citeproc
141 Description: Compile in support for citeproc-hs bibliographic formatting.
138 Description: Compile in support for citeproc-hs bibliographic formatting.
142 Default: False
139 Default: False
@@ -149,11 +146,6 @@ Library
149 if flag(highlighting)
146 if flag(highlighting)
150 Build-depends: highlighting-kate
147 Build-depends: highlighting-kate
151 cpp-options: -D_HIGHLIGHTING
148 cpp-options: -D_HIGHLIGHTING
152− if flag(utf8-string)
153− Build-depends: utf8-string
154− cpp-options: -D_UTF8STRING
155− else
156− Other-Modules: Text.Pandoc.UTF8
157 if flag(citeproc)
149 if flag(citeproc)
158 Build-depends: citeproc-hs
150 Build-depends: citeproc-hs
159 Exposed-Modules: Text.Pandoc.Biblio
151 Exposed-Modules: Text.Pandoc.Biblio
@@ -190,12 +182,16 @@ Library
190 Text.Pandoc.Writers.S5
182 Text.Pandoc.Writers.S5
191 Other-Modules: Text.Pandoc.XML,
183 Other-Modules: Text.Pandoc.XML,
192 Text.Pandoc.TH,
184 Text.Pandoc.TH,
185+ -- from xml package
193 Text.XML.Light,
186 Text.XML.Light,
194 Text.XML.Light.Types,
187 Text.XML.Light.Types,
195 Text.XML.Light.Output,
188 Text.XML.Light.Output,
196 Text.XML.Light.Input,
189 Text.XML.Light.Input,
197 Text.XML.Light.Proc,
190 Text.XML.Light.Proc,
198− Text.XML.Light.Cursor
191+ Text.XML.Light.Cursor,
192+ -- from utf8-string package
193+ System.IO.UTF8,
194+ Codec.Binary.UTF8.String
199 Extensions: CPP, TemplateHaskell, FlexibleInstances
195 Extensions: CPP, TemplateHaskell, FlexibleInstances
200 Ghc-Options: -O2 -Wall -threaded
196 Ghc-Options: -O2 -Wall -threaded
201 Ghc-Prof-Options: -auto-all
197 Ghc-Prof-Options: -auto-all
@@ -214,11 +210,6 @@ Executable pandoc
214
210
215 if flag(highlighting)
211 if flag(highlighting)
216 cpp-options: -D_HIGHLIGHTING
212 cpp-options: -D_HIGHLIGHTING
217− if flag(utf8-string)
218− Build-depends: utf8-string
219− cpp-options: -D_UTF8STRING
220− else
221− Other-Modules: Text.Pandoc.UTF8
222 if flag(citeproc)
213 if flag(citeproc)
223 Build-depends: citeproc-hs
214 Build-depends: citeproc-hs
224 cpp-options: -D_CITEPROC
215 cpp-options: -D_CITEPROC