git.iko.soy/typeable/pandoc
on master help sign in
Use System.IO.UTF8 only if ghc < 6.12.
aab574ffiddlosopher
src/Text/Pandoc.hs+4−2
@@ -36,14 +36,16 @@ inline links:
36
36
37> module Main where
37> module Main where
38> import Text.Pandoc
38> import Text.Pandoc
39+> -- include the following two lines only if you're using ghc < 6.12:
40+> import Prelude hiding (getContents, putStrLn)
39−> import qualified System.IO.UTF8 as U
41+> import System.IO.UTF8
40>
42>
41> markdownToRST :: String -> String
43> markdownToRST :: String -> String
42> markdownToRST =
44> markdownToRST =
43> (writeRST defaultWriterOptions {writerReferenceLinks = True}) .
45> (writeRST defaultWriterOptions {writerReferenceLinks = True}) .
44> readMarkdown defaultParserState
46> readMarkdown defaultParserState
45>
47>
46−> main = U.getContents >>= U.putStrLn . markdownToRST
48+> main = getContents >>= putStrLn . markdownToRST
47
49
48Note: all of the readers assume that the input text has @'\n'@
50Note: all of the readers assume that the input text has @'\n'@
49line endings. So if you get your input text from a web form,
51line endings. So if you get your input text from a web form,
src/Text/Pandoc/Shared.hs+6−1
@@ -119,8 +119,13 @@ import Data.List ( find, isPrefixOf, intercalate )
119import Network.URI ( parseURI, URI (..), isAllowedInURI )
119import Network.URI ( parseURI, URI (..), isAllowedInURI )
120import System.Directory
120import System.Directory
121import System.FilePath ( FilePath, (</>) )
121import System.FilePath ( FilePath, (</>) )
122+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
123+-- So we use System.IO.UTF8 only if we have an earlier version
124+#if MIN_VERSION_base(4,2,0)
125+#else
122−import Prelude hiding ( putStrLn, writeFile, readFile, getContents )
126+import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
123import System.IO.UTF8
127import System.IO.UTF8
128+#endif
124import Data.Generics
129import Data.Generics
125import qualified Control.Monad.State as S
130import qualified Control.Monad.State as S
126import Control.Monad (join)
131import Control.Monad (join)
src/hsmarkdown.hs+5
@@ -29,8 +29,13 @@ Wrapper around pandoc that emulates Markdown.pl as closely as possible.
29module Main where
29module Main where
30import System.Process
30import System.Process
31import System.Environment ( getArgs )
31import System.Environment ( getArgs )
32+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
33+-- So we use System.IO.UTF8 only if we have an earlier version
34+#if MIN_VERSION_base(4,2,0)
35+#else
32import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
36import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
33import System.IO.UTF8
37import System.IO.UTF8
38+#endif
34import Control.Monad (forM_)
39import Control.Monad (forM_)
35
40
36main :: IO ()
41main :: IO ()
src/markdown2pdf.hs+6
@@ -9,8 +9,14 @@ import Control.Exception (tryJust, bracket)
9import System.IO (stderr)
9import System.IO (stderr)
10import System.IO.Error (isDoesNotExistError)
10import System.IO.Error (isDoesNotExistError)
11import System.Environment ( getArgs, getProgName )
11import System.Environment ( getArgs, getProgName )
12+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
13+-- So we use System.IO.UTF8 only if we have an earlier version
14+#if MIN_VERSION_base(4,2,0)
15+#else
12import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
16import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
13import System.IO.UTF8
17import System.IO.UTF8
18+#endif
19+import System.IO (hPutStrLn)
14import System.Exit (ExitCode (..), exitWith)
20import System.Exit (ExitCode (..), exitWith)
15import System.FilePath
21import System.FilePath
16import System.Directory
22import System.Directory
src/pandoc.hs+6−1
@@ -45,9 +45,14 @@ import System.Console.GetOpt
45import Data.Maybe ( fromMaybe )
45import Data.Maybe ( fromMaybe )
46import Data.Char ( toLower )
46import Data.Char ( toLower )
47import Data.List ( intercalate, isSuffixOf )
47import Data.List ( intercalate, isSuffixOf )
48+import System.IO ( stdout, stderr, hPutStrLn, hPutStr )
49+-- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv
50+-- So we use System.IO.UTF8 only if we have an earlier version
51+#if MIN_VERSION_base(4,2,0)
52+#else
48import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
53import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents )
49−import System.IO ( stdout, stderr )
50import System.IO.UTF8
54import System.IO.UTF8
55+#endif
51#ifdef _CITEPROC
56#ifdef _CITEPROC
52import Text.CSL
57import Text.CSL
53import Text.Pandoc.Biblio
58import Text.Pandoc.Biblio