aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/App.hs34
-rw-r--r--src/Text/Pandoc/BCP47.hs12
-rw-r--r--src/Text/Pandoc/CSV.hs6
-rw-r--r--src/Text/Pandoc/Data.hs2
-rw-r--r--src/Text/Pandoc/Error.hs8
-rw-r--r--src/Text/Pandoc/Extensions.hs4
-rw-r--r--src/Text/Pandoc/Lua.hs18
-rw-r--r--src/Text/Pandoc/Lua/PandocModule.hs18
-rw-r--r--src/Text/Pandoc/Lua/StackInstances.hs11
-rw-r--r--src/Text/Pandoc/Lua/Util.hs4
-rw-r--r--src/Text/Pandoc/Options.hs4
-rw-r--r--src/Text/Pandoc/PDF.hs15
-rw-r--r--src/Text/Pandoc/Readers.hs10
-rw-r--r--src/Text/Pandoc/Readers/CommonMark.hs54
-rw-r--r--src/Text/Pandoc/Readers/Creole.hs12
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs4
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs4
-rw-r--r--src/Text/Pandoc/Readers/Haddock.hs4
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs116
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs9
-rw-r--r--src/Text/Pandoc/Readers/MediaWiki.hs8
-rw-r--r--src/Text/Pandoc/Readers/Native.hs2
-rw-r--r--src/Text/Pandoc/Readers/OPML.hs4
-rw-r--r--src/Text/Pandoc/Readers/Odt.hs36
-rw-r--r--src/Text/Pandoc/Readers/Odt/Arrows/State.hs18
-rw-r--r--src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs8
-rw-r--r--src/Text/Pandoc/Readers/Odt/Base.hs4
-rw-r--r--src/Text/Pandoc/Readers/Odt/ContentReader.hs46
-rw-r--r--src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs2
-rw-r--r--src/Text/Pandoc/Readers/Odt/Generic/Utils.hs14
-rw-r--r--src/Text/Pandoc/Readers/Odt/Namespaces.hs8
-rw-r--r--src/Text/Pandoc/Readers/Odt/StyleReader.hs51
-rw-r--r--src/Text/Pandoc/Readers/Org/ParserState.hs11
-rw-r--r--src/Text/Pandoc/Readers/RST.hs42
-rw-r--r--src/Text/Pandoc/Readers/TWiki.hs8
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs8
-rw-r--r--src/Text/Pandoc/Readers/TikiWiki.hs46
-rw-r--r--src/Text/Pandoc/Readers/Txt2Tags.hs21
-rw-r--r--src/Text/Pandoc/Readers/Vimwiki.hs73
-rw-r--r--src/Text/Pandoc/SelfContained.hs6
-rw-r--r--src/Text/Pandoc/Shared.hs130
-rw-r--r--src/Text/Pandoc/Templates.hs2
-rw-r--r--src/Text/Pandoc/Translations.hs10
-rw-r--r--src/Text/Pandoc/Writers.hs8
-rw-r--r--src/Text/Pandoc/Writers/CommonMark.hs6
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs50
-rw-r--r--src/Text/Pandoc/Writers/Custom.hs6
-rw-r--r--src/Text/Pandoc/Writers/Docbook.hs2
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs10
-rw-r--r--src/Text/Pandoc/Writers/DokuWiki.hs4
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs16
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs9
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs16
-rw-r--r--src/Text/Pandoc/Writers/Haddock.hs2
-rw-r--r--src/Text/Pandoc/Writers/JATS.hs6
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs4
-rw-r--r--src/Text/Pandoc/Writers/Man.hs2
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs6
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs2
-rw-r--r--src/Text/Pandoc/Writers/Ms.hs50
-rw-r--r--src/Text/Pandoc/Writers/Native.hs2
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs2
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs4
-rw-r--r--src/Text/Pandoc/Writers/Org.hs4
-rw-r--r--src/Text/Pandoc/Writers/RST.hs14
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs2
-rw-r--r--src/Text/Pandoc/Writers/TEI.hs4
-rw-r--r--src/Text/Pandoc/Writers/Textile.hs2
-rw-r--r--src/Text/Pandoc/Writers/ZimWiki.hs6
-rw-r--r--test/Tests/Command.hs6
-rw-r--r--test/Tests/Lua.hs16
-rw-r--r--test/Tests/Readers/Docx.hs8
-rw-r--r--test/Tests/Readers/HTML.hs2
-rw-r--r--test/Tests/Readers/LaTeX.hs4
-rw-r--r--test/Tests/Readers/Odt.hs6
-rw-r--r--test/Tests/Shared.hs2
-rw-r--r--test/Tests/Writers/Docx.hs10
-rw-r--r--test/Tests/Writers/Muse.hs2
-rw-r--r--test/test-pandoc.hs6
79 files changed, 607 insertions, 601 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 8533fe48c..ed9992911 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -42,18 +42,18 @@ module Text.Pandoc.App (
) where
import qualified Control.Exception as E
import Control.Monad
-import Control.Monad.Except (throwError, catchError)
+import Control.Monad.Except (catchError, throwError)
import Control.Monad.Trans
-import Data.Monoid
import Data.Aeson (FromJSON (..), ToJSON (..), defaultOptions, eitherDecode',
encode, genericToEncoding)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as B
import Data.Char (toLower, toUpper)
import Data.Foldable (foldrM)
-import Data.List (intercalate, isPrefixOf, isSuffixOf, sort, find)
+import Data.List (find, intercalate, isPrefixOf, isSuffixOf, sort)
import qualified Data.Map as M
import Data.Maybe (fromMaybe, isJust, isNothing)
+import Data.Monoid
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text as T
@@ -72,25 +72,25 @@ import System.Environment (getArgs, getEnvironment, getProgName)
import System.Exit (ExitCode (..), exitSuccess)
import System.FilePath
import System.IO (nativeNewline, stdout)
-import System.IO.Error (isDoesNotExistError)
import qualified System.IO as IO (Newline (..))
+import System.IO.Error (isDoesNotExistError)
import Text.Pandoc
+import Text.Pandoc.BCP47 (Lang (..), parseBCP47)
import Text.Pandoc.Builder (setMeta)
-import Text.Pandoc.Class (PandocIO, extractMedia, fillMediaBag, getLog,
- setResourcePath, setTrace, report, setRequestHeader,
- setUserDataDir, readFileStrict, readDataFile,
- readDefaultDataFile, setTranslations, openURL,
- setInputFiles, setOutputFile)
+import Text.Pandoc.Class (PandocIO, extractMedia, fillMediaBag, getLog, openURL,
+ readDataFile, readDefaultDataFile, readFileStrict,
+ report, setInputFiles, setOutputFile,
+ setRequestHeader, setResourcePath, setTrace,
+ setTranslations, setUserDataDir)
import Text.Pandoc.Highlighting (highlightingStyles)
-import Text.Pandoc.BCP47 (parseBCP47, Lang(..))
-import Text.Pandoc.Lua (runLuaFilter, LuaException(..))
-import Text.Pandoc.Writers.Math (defaultMathJaxURL, defaultKaTeXURL)
+import Text.Pandoc.Lua (LuaException (..), runLuaFilter)
import Text.Pandoc.PDF (makePDF)
import Text.Pandoc.Process (pipeProcess)
import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)
-import Text.Pandoc.Shared (headerShift, isURI, ordNub,
- safeRead, tabFilter, eastAsianLineBreakFilter)
+import Text.Pandoc.Shared (eastAsianLineBreakFilter, headerShift, isURI, ordNub,
+ safeRead, tabFilter)
import qualified Text.Pandoc.UTF8 as UTF8
+import Text.Pandoc.Writers.Math (defaultKaTeXURL, defaultMathJaxURL)
import Text.Pandoc.XML (toEntities)
import Text.Printf
#ifndef _WINDOWS
@@ -414,7 +414,7 @@ convertWithOpts opts = do
case lookup "lang" (optMetadata opts) of
Just l -> case parseBCP47 l of
- Left _ -> return ()
+ Left _ -> return ()
Right l' -> setTranslations l'
Nothing -> setTranslations $ Lang "en" "" "US" []
@@ -649,7 +649,7 @@ data Opt = Opt
, optResourcePath :: [FilePath] -- ^ Path to search for images etc
, optRequestHeaders :: [(String, String)] -- ^ Headers for HTTP requests
, optEol :: LineEnding -- ^ Style of line-endings to use
- , optStripComments :: Bool -- ^ Skip HTML comments
+ , optStripComments :: Bool -- ^ Skip HTML comments
} deriving (Generic, Show)
instance ToJSON Opt where
@@ -844,7 +844,7 @@ applyLuaFilters mbDatadir filters format d = do
let go f d' = do
res <- runLuaFilter mbDatadir f format d'
case res of
- Right x -> return x
+ Right x -> return x
Left (LuaException s) -> E.throw (PandocFilterError f s)
foldrM ($) d $ map go expandedFilters
diff --git a/src/Text/Pandoc/BCP47.hs b/src/Text/Pandoc/BCP47.hs
index 1790ccfb7..d49a0c115 100644
--- a/src/Text/Pandoc/BCP47.hs
+++ b/src/Text/Pandoc/BCP47.hs
@@ -35,18 +35,18 @@ module Text.Pandoc.BCP47 (
)
where
import Control.Monad (guard)
-import Data.Char (isAscii, isLetter, isUpper, isLower, toUpper, toLower,
- isAlphaNum)
+import Data.Char (isAlphaNum, isAscii, isLetter, isLower, isUpper, toLower,
+ toUpper)
import Data.List (intercalate)
import Text.Pandoc.Definition
import Text.Pandoc.Options
import qualified Text.Parsec as P
-- | Represents BCP 47 language/country code.
-data Lang = Lang{ langLanguage :: String
- , langScript :: String
- , langRegion :: String
- , langVariants :: [String] }
+data Lang = Lang{ langLanguage :: String
+ , langScript :: String
+ , langRegion :: String
+ , langVariants :: [String] }
deriving (Eq, Ord, Show)
-- | Render a Lang as BCP 47.
diff --git a/src/Text/Pandoc/CSV.hs b/src/Text/Pandoc/CSV.hs
index 810c58f92..ee68d988b 100644
--- a/src/Text/Pandoc/CSV.hs
+++ b/src/Text/Pandoc/CSV.hs
@@ -34,11 +34,11 @@ module Text.Pandoc.CSV (
ParseError
) where
-import Text.Parsec
-import Text.Parsec.Text (Parser)
+import Control.Monad (void)
import Data.Text (Text)
import qualified Data.Text as T
-import Control.Monad (void)
+import Text.Parsec
+import Text.Parsec.Text (Parser)
data CSVOptions = CSVOptions{
csvDelim :: Char
diff --git a/src/Text/Pandoc/Data.hs b/src/Text/Pandoc/Data.hs
index b8e189440..6bb6069ca 100644
--- a/src/Text/Pandoc/Data.hs
+++ b/src/Text/Pandoc/Data.hs
@@ -2,8 +2,8 @@
module Text.Pandoc.Data (dataFiles) where
-import Data.FileEmbed
import qualified Data.ByteString as B
+import Data.FileEmbed
import System.FilePath (splitDirectories)
import qualified System.FilePath.Posix as Posix
diff --git a/src/Text/Pandoc/Error.hs b/src/Text/Pandoc/Error.hs
index a05cdfe43..ade33e26d 100644
--- a/src/Text/Pandoc/Error.hs
+++ b/src/Text/Pandoc/Error.hs
@@ -37,12 +37,12 @@ module Text.Pandoc.Error (
import Control.Exception (Exception)
import Data.Generics (Typeable)
import GHC.Generics (Generic)
+import Network.HTTP.Client (HttpException)
+import System.Exit (ExitCode (..), exitWith)
+import System.IO (stderr)
+import qualified Text.Pandoc.UTF8 as UTF8
import Text.Parsec.Error
import Text.Parsec.Pos hiding (Line)
-import qualified Text.Pandoc.UTF8 as UTF8
-import System.Exit (exitWith, ExitCode(..))
-import System.IO (stderr)
-import Network.HTTP.Client (HttpException)
type Input = String
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
index 8c8b405be..b1b8336ef 100644
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -45,14 +45,14 @@ module Text.Pandoc.Extensions ( Extension(..)
, githubMarkdownExtensions
, multimarkdownExtensions )
where
+import Data.Aeson (FromJSON (..), ToJSON (..), defaultOptions,
+ genericToEncoding)
import Data.Bits (clearBit, setBit, testBit, (.|.))
import Data.Data (Data)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Text.Pandoc.Shared (safeRead)
import Text.Parsec
-import Data.Aeson (ToJSON(..), FromJSON(..),
- genericToEncoding, defaultOptions)
newtype Extensions = Extensions Integer
deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
diff --git a/src/Text/Pandoc/Lua.hs b/src/Text/Pandoc/Lua.hs
index 583d43a2e..091deab8c 100644
--- a/src/Text/Pandoc/Lua.hs
+++ b/src/Text/Pandoc/Lua.hs
@@ -36,19 +36,19 @@ module Text.Pandoc.Lua (LuaException (..), pushPandocModule, runLuaFilter) where
import Control.Monad (mplus, unless, when, (>=>))
import Control.Monad.Identity (Identity)
import Control.Monad.Trans (MonadIO (..))
-import Data.Data (DataType, Data, toConstr, showConstr, dataTypeOf,
- dataTypeConstrs, dataTypeName, tyconUQname)
+import Data.Data (Data, DataType, dataTypeConstrs, dataTypeName, dataTypeOf,
+ showConstr, toConstr, tyconUQname)
import Data.Foldable (foldrM)
import Data.IORef (IORef, newIORef, readIORef)
import Data.Map (Map)
import Data.Maybe (isJust)
-import Foreign.Lua (Lua, FromLuaStack (peek), LuaException (..), StackIndex,
+import Foreign.Lua (FromLuaStack (peek), Lua, LuaException (..), StackIndex,
Status (OK), ToLuaStack (push))
-import Text.Pandoc.Class (PandocIO, getMediaBag, setMediaBag,
- getCommonState, CommonState)
-import Text.Pandoc.MediaBag (MediaBag)
+import Text.Pandoc.Class (CommonState, PandocIO, getCommonState, getMediaBag,
+ setMediaBag)
import Text.Pandoc.Definition
-import Text.Pandoc.Lua.PandocModule (pushPandocModule, pushMediaBagModule)
+import Text.Pandoc.Lua.PandocModule (pushMediaBagModule, pushPandocModule)
+import Text.Pandoc.MediaBag (MediaBag)
import Text.Pandoc.Walk (walkM)
import qualified Data.Map as Map
@@ -182,7 +182,7 @@ instance FromLuaStack LuaFilter where
filterFn <- Lua.tryLua (peek (-1))
Lua.pop 1
return $ case filterFn of
- Left _ -> acc
+ Left _ -> acc
Right f -> (c, f) : acc
in LuaFilter . Map.fromList <$> foldrM fn [] constrs
@@ -209,7 +209,7 @@ elementOrList x = do
mbres <- Lua.peekEither topOfStack
case mbres of
Right res -> [res] <$ Lua.pop 1
- Left _ -> Lua.toList topOfStack <* Lua.pop 1
+ Left _ -> Lua.toList topOfStack <* Lua.pop 1
singleElement :: FromLuaStack a => a -> Lua a
singleElement x = do
diff --git a/src/Text/Pandoc/Lua/PandocModule.hs b/src/Text/Pandoc/Lua/PandocModule.hs
index 3c27ecffb..c42e180c6 100644
--- a/src/Text/Pandoc/Lua/PandocModule.hs
+++ b/src/Text/Pandoc/Lua/PandocModule.hs
@@ -34,24 +34,24 @@ module Text.Pandoc.Lua.PandocModule
import Control.Monad (unless, zipWithM_)
import Data.ByteString.Char8 (unpack)
import Data.Default (Default (..))
+import Data.Digest.Pure.SHA (sha1, showDigest)
import Data.IORef
import Data.Maybe (fromMaybe)
import Data.Text (pack)
-import Foreign.Lua (Lua, FromLuaStack, NumResults, liftIO)
+import Foreign.Lua (FromLuaStack, Lua, NumResults, liftIO)
import Foreign.Lua.FunctionCalling (ToHaskellFunction)
-import Text.Pandoc.Class (readDataFile, runIO,
- runIOorExplode, setUserDataDir, CommonState(..),
- putCommonState, fetchItem, setMediaBag)
-import Text.Pandoc.Options (ReaderOptions(readerExtensions))
+import System.Exit (ExitCode (..))
+import Text.Pandoc.Class (CommonState (..), fetchItem, putCommonState,
+ readDataFile, runIO, runIOorExplode, setMediaBag,
+ setUserDataDir)
import Text.Pandoc.Lua.StackInstances ()
-import Text.Pandoc.Readers (Reader (..), getReader)
import Text.Pandoc.MIME (MimeType)
+import Text.Pandoc.Options (ReaderOptions (readerExtensions))
import Text.Pandoc.Process (pipeProcess)
-import System.Exit (ExitCode(..))
-import Data.Digest.Pure.SHA (sha1, showDigest)
+import Text.Pandoc.Readers (Reader (..), getReader)
-import qualified Foreign.Lua as Lua
import qualified Data.ByteString.Lazy as BL
+import qualified Foreign.Lua as Lua
import qualified Text.Pandoc.MediaBag as MB
-- | Push the "pandoc" on the lua stack.
diff --git a/src/Text/Pandoc/Lua/StackInstances.hs b/src/Text/Pandoc/Lua/StackInstances.hs
index 73b04e50f..0a7b61578 100644
--- a/src/Text/Pandoc/Lua/StackInstances.hs
+++ b/src/Text/Pandoc/Lua/StackInstances.hs
@@ -33,10 +33,11 @@ StackValue instances for pandoc types.
module Text.Pandoc.Lua.StackInstances () where
import Control.Applicative ((<|>))
-import Foreign.Lua (Lua, LuaInteger, LuaNumber, Type (..), FromLuaStack (peek),
- ToLuaStack (push), StackIndex, throwLuaError, tryLua)
+import Foreign.Lua (FromLuaStack (peek), Lua, LuaInteger, LuaNumber, StackIndex,
+ ToLuaStack (push), Type (..), throwLuaError, tryLua)
import Text.Pandoc.Definition
-import Text.Pandoc.Lua.Util (addValue, adjustIndexBy, getTable, pushViaConstructor)
+import Text.Pandoc.Lua.Util (addValue, adjustIndexBy, getTable,
+ pushViaConstructor)
import Text.Pandoc.Shared (safeRead)
import qualified Foreign.Lua as Lua
@@ -139,7 +140,7 @@ instance FromLuaStack Int where
safeRead' :: Read a => String -> Lua a
safeRead' s = case safeRead s of
Nothing -> throwLuaError ("Could not read: " ++ s)
- Just x -> return x
+ Just x -> return x
-- | Push an meta value element to the top of the lua stack.
pushMetaValue :: MetaValue -> Lua ()
@@ -293,7 +294,7 @@ getTag idx = do
Lua.settop top
case r of
Left (Lua.LuaException err) -> throwLuaError err
- Right res -> return res
+ Right res -> return res
withAttr :: (Attr -> a -> b) -> (LuaAttr, a) -> b
withAttr f (attributes, x) = f (fromLuaAttr attributes) x
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs
index 6b1d51159..7960c0670 100644
--- a/src/Text/Pandoc/Lua/Util.hs
+++ b/src/Text/Pandoc/Lua/Util.hs
@@ -40,8 +40,8 @@ module Text.Pandoc.Lua.Util
, pushViaConstructor
) where
-import Foreign.Lua (Lua, FromLuaStack (..), ToLuaStack (..), NumArgs,
- StackIndex, getglobal')
+import Foreign.Lua (FromLuaStack (..), Lua, NumArgs, StackIndex,
+ ToLuaStack (..), getglobal')
import Foreign.Lua.Api (call, pop, rawget, rawgeti, rawset, rawseti)
-- | Adjust the stack index, assuming that @n@ new elements have been pushed on
diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs
index d004abca4..35c17c2ac 100644
--- a/src/Text/Pandoc/Options.hs
+++ b/src/Text/Pandoc/Options.hs
@@ -45,8 +45,8 @@ module Text.Pandoc.Options ( module Text.Pandoc.Extensions
, def
, isEnabled
) where
-import Data.Aeson (ToJSON(..), FromJSON(..),
- genericToEncoding, defaultOptions)
+import Data.Aeson (FromJSON (..), ToJSON (..), defaultOptions,
+ genericToEncoding)
import Data.Data (Data)
import Data.Default
import qualified Data.Set as Set
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index f90a4454f..028d63dcb 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -36,15 +36,15 @@ import qualified Codec.Picture as JP
import qualified Control.Exception as E
import Control.Monad (unless, when)
import Control.Monad.Trans (MonadIO (..))
-import qualified Data.Text as T
-import qualified Data.Text.IO as TextIO
-import Data.Text (Text)
import qualified Data.ByteString as BS
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.Char8 as BC
import Data.Maybe (fromMaybe)
import Data.Monoid ((<>))
+import Data.Text (Text)
+import qualified Data.Text as T
+import qualified Data.Text.IO as TextIO
import System.Directory
import System.Environment
import System.Exit (ExitCode (..))
@@ -57,7 +57,7 @@ import System.IO.Error (IOError, isDoesNotExistError)
import System.IO.Error (isDoesNotExistError)
#endif
import Text.Pandoc.Definition
-import Text.Pandoc.Error (PandocError(PandocPDFProgramNotFoundError))
+import Text.Pandoc.Error (PandocError (PandocPDFProgramNotFoundError))
import Text.Pandoc.MIME (getMimeType)
import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..))
import Text.Pandoc.Process (pipeProcess)
@@ -68,10 +68,9 @@ import Text.Pandoc.Writers.Shared (getField, metaToJSON)
#ifdef _WINDOWS
import Data.List (intercalate)
#endif
-import Text.Pandoc.Class (PandocIO, report, runIO, runIOorExplode,
- setVerbosity, getVerbosity,
- fillMediaBag, extractMedia, putCommonState,
- getCommonState)
+import Text.Pandoc.Class (PandocIO, extractMedia, fillMediaBag, getCommonState,
+ getVerbosity, putCommonState, report, runIO,
+ runIOorExplode, setVerbosity)
import Text.Pandoc.Logging
#ifdef _WINDOWS
diff --git a/src/Text/Pandoc/Readers.hs b/src/Text/Pandoc/Readers.hs
index 9fc9c3d18..d954256c8 100644
--- a/src/Text/Pandoc/Readers.hs
+++ b/src/Text/Pandoc/Readers.hs
@@ -70,7 +70,9 @@ module Text.Pandoc.Readers
import Control.Monad.Except (throwError)
import Data.Aeson
+import qualified Data.ByteString.Lazy as BL
import Data.List (intercalate)
+import Data.Text (Text)
import Text.Pandoc.Class
import Text.Pandoc.Definition
import Text.Pandoc.Error
@@ -86,7 +88,6 @@ import Text.Pandoc.Readers.HTML
import Text.Pandoc.Readers.LaTeX
import Text.Pandoc.Readers.Markdown
import Text.Pandoc.Readers.MediaWiki
-import Text.Pandoc.Readers.Vimwiki
import Text.Pandoc.Readers.Muse
import Text.Pandoc.Readers.Native
import Text.Pandoc.Readers.Odt
@@ -94,14 +95,13 @@ import Text.Pandoc.Readers.OPML
import Text.Pandoc.Readers.Org
import Text.Pandoc.Readers.RST
import Text.Pandoc.Readers.Textile
-import Text.Pandoc.Readers.TWiki
import Text.Pandoc.Readers.TikiWiki
+import Text.Pandoc.Readers.TWiki
import Text.Pandoc.Readers.Txt2Tags
+import Text.Pandoc.Readers.Vimwiki
import Text.Pandoc.Shared (mapLeft)
-import Text.Parsec.Error
import qualified Text.Pandoc.UTF8 as UTF8
-import qualified Data.ByteString.Lazy as BL
-import Data.Text (Text)
+import Text.Parsec.Error
data Reader m = TextReader (ReaderOptions -> Text -> m Pandoc)
| ByteStringReader (ReaderOptions -> BL.ByteString -> m Pandoc)
diff --git a/src/Text/Pandoc/Readers/CommonMark.hs b/src/Text/Pandoc/Readers/CommonMark.hs
index 62a7f4119..8189e7760 100644
--- a/src/Text/Pandoc/Readers/CommonMark.hs
+++ b/src/Text/Pandoc/Readers/CommonMark.hs
@@ -34,10 +34,10 @@ where
import CMarkGFM
import Control.Monad.State
-import Data.Char (isLetter, isAlphaNum, isSpace, toLower)
+import Data.Char (isAlphaNum, isLetter, isSpace, toLower)
import Data.List (groupBy)
-import Data.Text (Text, unpack)
import qualified Data.Map as Map
+import Data.Text (Text, unpack)
import Text.Pandoc.Class (PandocMonad)
import Text.Pandoc.Definition
import Text.Pandoc.Emoji (emojis)
@@ -153,9 +153,9 @@ addBlock opts (Node _ (TABLE alignments) nodes) = do
(h:rs) -> (h, rs)
[] -> ([], [])
isRow (Node _ TABLE_ROW _) = True
- isRow _ = False
+ isRow _ = False
isCell (Node _ TABLE_CELL _) = True
- isCell _ = False
+ isCell _ = False
toRow (Node _ TABLE_ROW ns) = map toCell $ filter isCell ns
toRow (Node _ t _) = error $ "toRow encountered non-row " ++ show t
toCell (Node _ TABLE_CELL []) = []
@@ -170,30 +170,30 @@ addBlock _ _ = id
isBlockNode :: Node -> Bool
isBlockNode (Node _ nodetype _) =
case nodetype of
- DOCUMENT -> True
- THEMATIC_BREAK -> True
- PARAGRAPH -> True
- BLOCK_QUOTE -> True
- HTML_BLOCK _ -> True
- CUSTOM_BLOCK _ _ -> True
- CODE_BLOCK _ _ -> True
- HEADING _ -> True
- LIST _ -> True
- ITEM -> True
- TEXT _ -> False
- SOFTBREAK -> False
- LINEBREAK -> False
- HTML_INLINE _ -> False
+ DOCUMENT -> True
+ THEMATIC_BREAK -> True
+ PARAGRAPH -> True
+ BLOCK_QUOTE -> True
+ HTML_BLOCK _ -> True
+ CUSTOM_BLOCK _ _ -> True
+ CODE_BLOCK _ _ -> True
+ HEADING _ -> True
+ LIST _ -> True
+ ITEM -> True
+ TEXT _ -> False
+ SOFTBREAK -> False
+ LINEBREAK -> False
+ HTML_INLINE _ -> False
CUSTOM_INLINE _ _ -> False
- CODE _ -> False
- EMPH -> False
- STRONG -> False
- LINK _ _ -> False
- IMAGE _ _ -> False
- STRIKETHROUGH -> False
- TABLE _ -> False
- TABLE_ROW -> False
- TABLE_CELL -> False
+ CODE _ -> False
+ EMPH -> False
+ STRONG -> False
+ LINK _ _ -> False
+ IMAGE _ _ -> False
+ STRIKETHROUGH -> False
+ TABLE _ -> False
+ TABLE_ROW -> False
+ TABLE_CELL -> False
children :: Node -> [Node]
children (Node _ _ ns) = ns
diff --git a/src/Text/Pandoc/Readers/Creole.hs b/src/Text/Pandoc/Readers/Creole.hs
index ab90772ef..9886394a7 100644
--- a/src/Text/Pandoc/Readers/Creole.hs
+++ b/src/Text/Pandoc/Readers/Creole.hs
@@ -35,18 +35,18 @@ Conversion of creole text to 'Pandoc' document.
module Text.Pandoc.Readers.Creole ( readCreole
) where
-import Control.Monad.Except (liftM2, throwError, guard)
+import Control.Monad.Except (guard, liftM2, throwError)
import qualified Data.Foldable as F
+import Data.Maybe (fromMaybe)
+import Data.Monoid
+import Data.Text (Text)
+import qualified Data.Text as T
import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Class (PandocMonad(..))
+import Text.Pandoc.Class (PandocMonad (..))
import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (enclosed)
import Text.Pandoc.Shared (crFilter)
-import Data.Maybe (fromMaybe)
-import Data.Monoid
-import Data.Text (Text)
-import qualified Data.Text as T
-- | Read creole from an input string and return a Pandoc document.
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index 2448d24e5..465c3abec 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -472,10 +472,10 @@ rowToBlocksList (Row cells) = do
-- like trimInlines, but also take out linebreaks
trimSps :: Inlines -> Inlines
trimSps (Many ils) = Many $ Seq.dropWhileL isSp $ Seq.dropWhileR isSp $ ils
- where isSp Space = True
+ where isSp Space = True
isSp SoftBreak = True
isSp LineBreak = True
- isSp _ = False
+ isSp _ = False
parStyleToTransform :: ParagraphStyle -> (Blocks -> Blocks)
parStyleToTransform pPr
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index c0d8029dc..d38a40c8d 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -13,12 +13,12 @@ import Control.DeepSeq (NFData, deepseq)
import Control.Monad (guard, liftM)
import Control.Monad.Except (throwError)
import qualified Data.ByteString.Lazy as BL (ByteString)
-import qualified Data.Text.Lazy.Encoding as TL
-import qualified Data.Text.Lazy as TL
import Data.List (isInfixOf, isPrefixOf)
import qualified Data.Map as M (Map, elems, fromList, lookup)
import Data.Maybe (fromMaybe, mapMaybe)
import Data.Monoid ((<>))
+import qualified Data.Text.Lazy as TL
+import qualified Data.Text.Lazy.Encoding as TL
import Network.URI (unEscapeString)
import System.FilePath (dropFileName, dropFileName, normalise, splitFileName,
takeFileName, (</>))
diff --git a/src/Text/Pandoc/Readers/Haddock.hs b/src/Text/Pandoc/Readers/Haddock.hs
index a09ed8be9..9d0610e01 100644
--- a/src/Text/Pandoc/Readers/Haddock.hs
+++ b/src/Text/Pandoc/Readers/Haddock.hs
@@ -16,9 +16,9 @@ module Text.Pandoc.Readers.Haddock
import Control.Monad.Except (throwError)
import Data.List (intersperse, stripPrefix)
-import Data.Text (Text, unpack)
import Data.Maybe (fromMaybe)
import Data.Monoid ((<>))
+import Data.Text (Text, unpack)
import Documentation.Haddock.Parser
import Documentation.Haddock.Types
import Text.Pandoc.Builder (Blocks, Inlines)
@@ -27,7 +27,7 @@ import Text.Pandoc.Class (PandocMonad)
import Text.Pandoc.Definition
import Text.Pandoc.Error
import Text.Pandoc.Options
-import Text.Pandoc.Shared (splitBy, trim, crFilter)
+import Text.Pandoc.Shared (crFilter, splitBy, trim)
-- | Parse Haddock markup and return a 'Pandoc' document.
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index a37c152d3..665ed6548 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1,8 +1,8 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE PatternGuards #-}
-{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE ScopedTypeVariables #-}
{-
Copyright (C) 2006-2017 John MacFarlane <jgm@berkeley.edu>
@@ -44,35 +44,33 @@ import Control.Applicative (many, optional, (<|>))
import Control.Monad
import Control.Monad.Except (throwError)
import Control.Monad.Trans (lift)
-import Data.Char (chr, isAlphaNum, isLetter, ord, isDigit, toLower)
+import Data.Char (chr, isAlphaNum, isDigit, isLetter, ord, toLower)
import Data.Default
-import Data.Text (Text)
-import qualified Data.Text as T
import Data.List (intercalate, isPrefixOf)
import qualified Data.Map as M
-import qualified Data.Set as Set
import Data.Maybe (fromMaybe, maybeToList)
+import qualified Data.Set as Set
+import Data.Text (Text)
+import qualified Data.Text as T
import Safe (minimumDef)
import System.FilePath (addExtension, replaceExtension, takeExtension)
+import Text.Pandoc.BCP47 (Lang (..), renderLang)
import Text.Pandoc.Builder
-import Text.Pandoc.Class (PandocMonad, PandocPure, lookupEnv,
+import Text.Pandoc.Class (PandocMonad, PandocPure, getResourcePath, lookupEnv,
readFileFromDirs, report, setResourcePath,
- getResourcePath, setTranslations, translateTerm)
-import qualified Text.Pandoc.Translations as Translations
-import Text.Pandoc.BCP47 (Lang(..), renderLang)
+ setTranslations, translateTerm)
+import Text.Pandoc.Error (PandocError (PandocMacroLoop, PandocParseError, PandocParsecError))
import Text.Pandoc.Highlighting (fromListingsLanguage, languagesByExtension)
import Text.Pandoc.ImageSize (numUnit, showFl)
import Text.Pandoc.Logging
import Text.Pandoc.Options
-import Text.Pandoc.Parsing hiding (many, optional, withRaw,
- mathInline, mathDisplay,
- space, (<|>), spaces, blankline)
+import Text.Pandoc.Parsing hiding (blankline, many, mathDisplay, mathInline,
+ optional, space, spaces, withRaw, (<|>))
+import Text.Pandoc.Readers.LaTeX.Types (ExpansionPoint (..), Macro (..),
+ Tok (..), TokType (..))
import Text.Pandoc.Shared
-import Text.Pandoc.Readers.LaTeX.Types (Macro(..), ExpansionPoint(..), Tok(..),
- TokType(..))
+import qualified Text.Pandoc.Translations as Translations
import Text.Pandoc.Walk
-import Text.Pandoc.Error
- (PandocError(PandocParsecError, PandocParseError, PandocMacroLoop))
import Text.Parsec.Pos
-- for debugging:
@@ -100,10 +98,10 @@ parseLaTeX = do
let meta = sMeta st
let doc' = doc bs
let headerLevel (Header n _ _) = [n]
- headerLevel _ = []
+ headerLevel _ = []
let bottomLevel = minimumDef 1 $ query headerLevel doc'
let adjustHeaders m (Header n attr ils) = Header (n+m) attr ils
- adjustHeaders _ x = x
+ adjustHeaders _ x = x
let (Pandoc _ bs') =
-- handle the case where you have \part or \chapter
(if bottomLevel < 1
@@ -261,7 +259,7 @@ applyMacros s = (guardDisabled Ext_latex_macros >> return s) <|>
, sMacros = extractMacros pstate }
res <- runParserT retokenize lstate "math" (tokenize "math" (T.pack s))
case res of
- Left e -> fail (show e)
+ Left e -> fail (show e)
Right s' -> return s'
rawLaTeXBlock :: (PandocMonad m, HasMacros s, HasReaderOptions s)
@@ -378,8 +376,8 @@ isSpaceOrTab '\t' = True
isSpaceOrTab _ = False
isLetterOrAt :: Char -> Bool
-isLetterOrAt '@' = True
-isLetterOrAt c = isLetter c
+isLetterOrAt '@' = True
+isLetterOrAt c = isLetter c
isLowerHex :: Char -> Bool
isLowerHex x = x >= '0' && x <= '9' || x >= 'a' && x <= 'f'
@@ -400,7 +398,7 @@ satisfyTok f =
| otherwise = Nothing
updatePos :: SourcePos -> Tok -> [Tok] -> SourcePos
updatePos _spos _ (Tok pos _ _ : _) = pos
- updatePos spos _ [] = spos
+ updatePos spos _ [] = spos
doMacros :: PandocMonad m => Int -> LP m ()
doMacros n = do
@@ -477,20 +475,20 @@ tokTypeIn toktypes (Tok _ tt _) = tt `elem` toktypes
controlSeq :: PandocMonad m => Text -> LP m Tok
controlSeq name = satisfyTok isNamed
where isNamed (Tok _ (CtrlSeq n) _) = n == name
- isNamed _ = False
+ isNamed _ = False
symbol :: PandocMonad m => Char -> LP m Tok
symbol c = satisfyTok isc
where isc (Tok _ Symbol d) = case T.uncons d of
Just (c',_) -> c == c'
- _ -> False
+ _ -> False
isc _ = False
symbolIn :: PandocMonad m => [Char] -> LP m Tok
symbolIn cs = satisfyTok isInCs
where isInCs (Tok _ Symbol d) = case T.uncons d of
Just (c,_) -> c `elem` cs
- _ -> False
+ _ -> False
isInCs _ = False
sp :: PandocMonad m => LP m ()
@@ -499,19 +497,19 @@ sp = whitespace <|> endline
whitespace :: PandocMonad m => LP m ()
whitespace = () <$ satisfyTok isSpaceTok
where isSpaceTok (Tok _ Spaces _) = True
- isSpaceTok _ = False
+ isSpaceTok _ = False
newlineTok :: PandocMonad m => LP m ()
newlineTok = () <$ satisfyTok isNewlineTok
isNewlineTok :: Tok -> Bool
isNewlineTok (Tok _ Newline _) = True
-isNewlineTok _ = False
+isNewlineTok _ = False
comment :: PandocMonad m => LP m ()
comment = () <$ satisfyTok isCommentTok
where isCommentTok (Tok _ Comment _) = True
- isCommentTok _ = False
+ isCommentTok _ = False
anyTok :: PandocMonad m => LP m Tok
anyTok = satisfyTok (const True)
@@ -535,7 +533,7 @@ primEscape = do
| otherwise -> return (chr (ord c + 64))
Nothing -> fail "Empty content of Esc1"
Esc2 -> case safeRead ('0':'x':T.unpack (T.drop 2 t)) of
- Just x -> return (chr x)
+ Just x -> return (chr x)
Nothing -> fail $ "Could not read: " ++ T.unpack t
_ -> fail "Expected an Esc1 or Esc2 token" -- should not happen
@@ -594,7 +592,7 @@ word = (str . T.unpack . untoken) <$> satisfyTok isWordTok
regularSymbol :: PandocMonad m => LP m Inlines
regularSymbol = (str . T.unpack . untoken) <$> satisfyTok isRegularSymbol
where isRegularSymbol (Tok _ Symbol t) = not $ T.any isSpecial t
- isRegularSymbol _ = False
+ isRegularSymbol _ = False
isSpecial c = c `Set.member` specialChars
specialChars :: Set.Set Char
@@ -602,7 +600,7 @@ specialChars = Set.fromList "#$%&~_^\\{}"
isWordTok :: Tok -> Bool
isWordTok (Tok _ Word _) = True
-isWordTok _ = False
+isWordTok _ = False
inlineGroup :: PandocMonad m => LP m Inlines
inlineGroup = do
@@ -623,7 +621,7 @@ mkImage options src = do
let replaceTextwidth (k,v) =
case numUnit v of
Just (num, "\\textwidth") -> (k, showFl (num * 100) ++ "%")
- _ -> (k, v)
+ _ -> (k, v)
let kvs = map replaceTextwidth
$ filter (\(k,_) -> k `elem` ["width", "height"]) options
let attr = ("",[], kvs)
@@ -640,7 +638,7 @@ doxspace = do
where startsWithLetter (Tok _ Word t) =
case T.uncons t of
Just (c, _) | isLetter c -> True
- _ -> False
+ _ -> False
startsWithLetter _ = False
@@ -686,7 +684,7 @@ singleQuote = do
where startsWithLetter (Tok _ Word t) =
case T.uncons t of
Just (c, _) | isLetter c -> True
- _ -> False
+ _ -> False
startsWithLetter _ = False
quoted' :: PandocMonad m
@@ -736,7 +734,7 @@ doverb = do
Tok _ Symbol t <- anySymbol
marker <- case T.uncons t of
Just (c, ts) | T.null ts -> return c
- _ -> mzero
+ _ -> mzero
withVerbatimMode $
(code . T.unpack . untokenize) <$>
manyTill (verbTok marker) (symbol marker)
@@ -760,7 +758,7 @@ dolstinline = do
Tok _ Symbol t <- anySymbol
marker <- case T.uncons t of
Just (c, ts) | T.null ts -> return c
- _ -> mzero
+ _ -> mzero
let stopchar = if marker == '{' then '}' else marker
withVerbatimMode $
(codeWith ("",classes,[]) . T.unpack . untokenize) <$>
@@ -770,7 +768,7 @@ keyval :: PandocMonad m => LP m (String, String)
keyval = try $ do
Tok _ Word key <- satisfyTok isWordTok
let isSpecSym (Tok _ Symbol t) = t /= "]" && t /= ","
- isSpecSym _ = False
+ isSpecSym _ = False
optional sp
val <- option [] $ do
symbol '='
@@ -1504,7 +1502,7 @@ hypertargetBlock = try $ do
bs <- grouped block
case toList bs of
[Header 1 (ident,_,_) _] | ident == ref -> return bs
- _ -> return $ divWith (ref, [], []) bs
+ _ -> return $ divWith (ref, [], []) bs
hypertargetInline :: PandocMonad m => LP m Inlines
hypertargetInline = try $ do
@@ -1846,7 +1844,7 @@ argSeq n = do
isArgTok :: Tok -> Bool
isArgTok (Tok _ (Arg _) _) = True
-isArgTok _ = False
+isArgTok _ = False
newcommand :: PandocMonad m => LP m (Text, Macro)
newcommand = do
@@ -1869,7 +1867,7 @@ newcommand = do
when (mtype == "newcommand") $ do
macros <- sMacros <$> getState
case M.lookup name macros of
- Just _ -> report $ MacroAlreadyDefined (T.unpack txt) pos
+ Just _ -> report $ MacroAlreadyDefined (T.unpack txt) pos
Nothing -> return ()
return (name, Macro ExpandWhenUsed numargs optarg contents)
@@ -1893,7 +1891,7 @@ newenvironment = do
when (mtype == "newenvironment") $ do
macros <- sMacros <$> getState
case M.lookup name macros of
- Just _ -> report $ MacroAlreadyDefined (T.unpack name) pos
+ Just _ -> report $ MacroAlreadyDefined (T.unpack name) pos
Nothing -> return ()
return (name, Macro ExpandWhenUsed numargs optarg startcontents,
Macro ExpandWhenUsed 0 Nothing endcontents)
@@ -2186,8 +2184,8 @@ obeylines = do
softBreakToHard x = x
removeLeadingTrailingBreaks = reverse . dropWhile isLineBreak .
reverse . dropWhile isLineBreak
- isLineBreak LineBreak = True
- isLineBreak _ = False
+ isLineBreak LineBreak = True
+ isLineBreak _ = False
minted :: PandocMonad m => LP m Blocks
minted = do
@@ -2521,13 +2519,13 @@ setDefaultLanguage = do
polyglossiaLangToBCP47 :: M.Map String (String -> Lang)
polyglossiaLangToBCP47 = M.fromList
[ ("arabic", \o -> case filter (/=' ') o of
- "locale=algeria" -> Lang "ar" "" "DZ" []
- "locale=mashriq" -> Lang "ar" "" "SY" []
- "locale=libya" -> Lang "ar" "" "LY" []
- "locale=morocco" -> Lang "ar" "" "MA" []
+ "locale=algeria" -> Lang "ar" "" "DZ" []
+ "locale=mashriq" -> Lang "ar" "" "SY" []
+ "locale=libya" -> Lang "ar" "" "LY" []
+ "locale=morocco" -> Lang "ar" "" "MA" []
"locale=mauritania" -> Lang "ar" "" "MR" []
- "locale=tunisia" -> Lang "ar" "" "TN" []
- _ -> Lang "ar" "" "" [])
+ "locale=tunisia" -> Lang "ar" "" "TN" []
+ _ -> Lang "ar" "" "" [])
, ("german", \o -> case filter (/=' ') o of
"spelling=old" -> Lang "de" "" "DE" ["1901"]
"variant=austrian,spelling=old"
@@ -2539,20 +2537,20 @@ polyglossiaLangToBCP47 = M.fromList
_ -> Lang "de" "" "" [])
, ("lsorbian", \_ -> Lang "dsb" "" "" [])
, ("greek", \o -> case filter (/=' ') o of
- "variant=poly" -> Lang "el" "" "polyton" []
+ "variant=poly" -> Lang "el" "" "polyton" []
"variant=ancient" -> Lang "grc" "" "" []
- _ -> Lang "el" "" "" [])
+ _ -> Lang "el" "" "" [])
, ("english", \o -> case filter (/=' ') o of
"variant=australian" -> Lang "en" "" "AU" []
- "variant=canadian" -> Lang "en" "" "CA" []
- "variant=british" -> Lang "en" "" "GB" []
+ "variant=canadian" -> Lang "en" "" "CA" []
+ "variant=british" -> Lang "en" "" "GB" []
"variant=newzealand" -> Lang "en" "" "NZ" []
- "variant=american" -> Lang "en" "" "US" []
- _ -> Lang "en" "" "" [])
+ "variant=american" -> Lang "en" "" "US" []
+ _ -> Lang "en" "" "" [])
, ("usorbian", \_ -> Lang "hsb" "" "" [])
, ("latin", \o -> case filter (/=' ') o of
"variant=classic" -> Lang "la" "" "" ["x-classic"]
- _ -> Lang "la" "" "" [])
+ _ -> Lang "la" "" "" [])
, ("slovenian", \_ -> Lang "sl" "" "" [])
, ("serbianc", \_ -> Lang "sr" "cyrl" "" [])
, ("pinyin", \_ -> Lang "zh" "Latn" "" ["pinyin"])
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index a27e05fed..48719a678 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -52,7 +52,7 @@ import System.FilePath (addExtension, takeExtension)
import Text.HTML.TagSoup
import Text.Pandoc.Builder (Blocks, Inlines)
import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Class (PandocMonad(..), report)
+import Text.Pandoc.Class (PandocMonad (..), report)
import Text.Pandoc.Definition
import Text.Pandoc.Emoji (emojis)
import Text.Pandoc.Error
@@ -61,8 +61,7 @@ import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (tableWith)
import Text.Pandoc.Readers.HTML (htmlInBalanced, htmlTag, isBlockTag,
isCommentTag, isInlineTag, isTextTag)
-import Text.Pandoc.Readers.LaTeX (rawLaTeXBlock,
- rawLaTeXInline, applyMacros)
+import Text.Pandoc.Readers.LaTeX (applyMacros, rawLaTeXBlock, rawLaTeXInline)
import Text.Pandoc.Shared
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.XML (fromEntities)
@@ -1506,8 +1505,8 @@ escapedChar :: PandocMonad m => MarkdownParser m (F Inlines)
escapedChar = do
result <- escapedChar'
case result of
- ' ' -> return $ return $ B.str "\160" -- "\ " is a nonbreaking space
- _ -> return $ return $ B.str [result]
+ ' ' -> return $ return $ B.str "\160" -- "\ " is a nonbreaking space
+ _ -> return $ return $ B.str [result]
ltSign :: PandocMonad m => MarkdownParser m (F Inlines)
ltSign = do
diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs
index a7f073d50..01a6c74b6 100644
--- a/src/Text/Pandoc/Readers/MediaWiki.hs
+++ b/src/Text/Pandoc/Readers/MediaWiki.hs
@@ -41,7 +41,6 @@ module Text.Pandoc.Readers.MediaWiki ( readMediaWiki ) where
import Control.Monad
import Control.Monad.Except (throwError)
import Data.Char (isDigit, isSpace)
-import Data.Text (Text, unpack)
import qualified Data.Foldable as F
import Data.List (intercalate, intersperse, isPrefixOf)
import qualified Data.Map as M
@@ -49,17 +48,18 @@ import Data.Maybe (fromMaybe)
import Data.Monoid ((<>))
import Data.Sequence (ViewL (..), viewl, (<|))
import qualified Data.Set as Set
+import Data.Text (Text, unpack)
import Text.HTML.TagSoup
import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Class (PandocMonad(..))
+import Text.Pandoc.Class (PandocMonad (..))
import Text.Pandoc.Definition
import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (nested)
import Text.Pandoc.Readers.HTML (htmlTag, isBlockTag, isCommentTag)
-import Text.Pandoc.Shared (safeRead, stringify, stripTrailingNewlines, trim,
- crFilter)
+import Text.Pandoc.Shared (crFilter, safeRead, stringify, stripTrailingNewlines,
+ trim)
import Text.Pandoc.Walk (walk)
import Text.Pandoc.XML (fromEntities)
diff --git a/src/Text/Pandoc/Readers/Native.hs b/src/Text/Pandoc/Readers/Native.hs
index abc2ed38a..d065bff8d 100644
--- a/src/Text/Pandoc/Readers/Native.hs
+++ b/src/Text/Pandoc/Readers/Native.hs
@@ -35,9 +35,9 @@ import Text.Pandoc.Options (ReaderOptions)
import Text.Pandoc.Shared (safeRead)
import Control.Monad.Except (throwError)
+import Data.Text (Text, unpack)
import Text.Pandoc.Class
import Text.Pandoc.Error
-import Data.Text (Text, unpack)
-- | Read native formatted text and return a Pandoc document.
-- The input may be a full pandoc document, a block list, a block,
diff --git a/src/Text/Pandoc/Readers/OPML.hs b/src/Text/Pandoc/Readers/OPML.hs
index c25ace800..167ad6d4e 100644
--- a/src/Text/Pandoc/Readers/OPML.hs
+++ b/src/Text/Pandoc/Readers/OPML.hs
@@ -2,16 +2,16 @@
module Text.Pandoc.Readers.OPML ( readOPML ) where
import Control.Monad.State.Strict
import Data.Char (toUpper)
-import Data.Text (Text, unpack, pack)
import Data.Default
import Data.Generics
+import Data.Text (Text, pack, unpack)
import Text.HTML.TagSoup.Entity (lookupEntity)
import Text.Pandoc.Builder
import Text.Pandoc.Class (PandocMonad)
import Text.Pandoc.Options
-import Text.Pandoc.Shared (crFilter)
import Text.Pandoc.Readers.HTML (readHtml)
import Text.Pandoc.Readers.Markdown (readMarkdown)
+import Text.Pandoc.Shared (crFilter)
import Text.XML.Light
type OPML m = StateT OPMLState m
diff --git a/src/Text/Pandoc/Readers/Odt.hs b/src/Text/Pandoc/Readers/Odt.hs
index ac22f2c09..875c18a85 100644
--- a/src/Text/Pandoc/Readers/Odt.hs
+++ b/src/Text/Pandoc/Readers/Odt.hs
@@ -32,29 +32,29 @@ Entry point to the odt reader.
module Text.Pandoc.Readers.Odt ( readOdt ) where
-import Codec.Archive.Zip
-import qualified Text.XML.Light as XML
+import Codec.Archive.Zip
+import qualified Text.XML.Light as XML
-import qualified Data.ByteString.Lazy as B
+import qualified Data.ByteString.Lazy as B
-import System.FilePath
+import System.FilePath
-import Control.Monad.Except (throwError)
+import Control.Monad.Except (throwError)
-import Text.Pandoc.Class (PandocMonad)
+import Text.Pandoc.Class (PandocMonad)
import qualified Text.Pandoc.Class as P
-import Text.Pandoc.Definition
-import Text.Pandoc.Error
-import Text.Pandoc.Options
-import Text.Pandoc.MediaBag
-import qualified Text.Pandoc.UTF8 as UTF8
-
-import Text.Pandoc.Readers.Odt.ContentReader
-import Text.Pandoc.Readers.Odt.StyleReader
-
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Shared (filteredFilesFromArchive)
+import Text.Pandoc.Definition
+import Text.Pandoc.Error
+import Text.Pandoc.MediaBag
+import Text.Pandoc.Options
+import qualified Text.Pandoc.UTF8 as UTF8
+
+import Text.Pandoc.Readers.Odt.ContentReader
+import Text.Pandoc.Readers.Odt.StyleReader
+
+import Text.Pandoc.Readers.Odt.Generic.Fallible
+import Text.Pandoc.Readers.Odt.Generic.XMLConverter
+import Text.Pandoc.Shared (filteredFilesFromArchive)
readOdt :: PandocMonad m
=> ReaderOptions
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs b/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
index 3d716ba19..0f7483431 100644
--- a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
+++ b/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE Arrows #-}
-{-# LANGUAGE TupleSections #-}
{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE TupleSections #-}
{-
Copyright (C) 2015 Martin Linnemann <theCodingMarlin@googlemail.com>
@@ -38,17 +38,17 @@ faster and easier to implement this way.
module Text.Pandoc.Readers.Odt.Arrows.State where
-import Prelude hiding ( foldr, foldl )
+import Prelude hiding (foldl, foldr)
-import qualified Control.Category as Cat
-import Control.Arrow
-import Control.Monad
+import Control.Arrow
+import qualified Control.Category as Cat
+import Control.Monad
-import Data.Foldable
-import Data.Monoid
+import Data.Foldable
+import Data.Monoid
-import Text.Pandoc.Readers.Odt.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.Fallible
+import Text.Pandoc.Readers.Odt.Arrows.Utils
+import Text.Pandoc.Readers.Odt.Generic.Fallible
newtype ArrowState state a b = ArrowState
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs b/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
index ecef8b6e3..cdfa8f8df 100644
--- a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
+++ b/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
@@ -39,11 +39,11 @@ with an equivalent return value.
-- We export everything
module Text.Pandoc.Readers.Odt.Arrows.Utils where
-import Control.Arrow
-import Control.Monad ( join )
+import Control.Arrow
+import Control.Monad (join)
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Readers.Odt.Generic.Utils
+import Text.Pandoc.Readers.Odt.Generic.Fallible
+import Text.Pandoc.Readers.Odt.Generic.Utils
and2 :: (Arrow a) => a b c -> a b c' -> a b (c,c')
and2 = (&&&)
diff --git a/src/Text/Pandoc/Readers/Odt/Base.hs b/src/Text/Pandoc/Readers/Odt/Base.hs
index 1f095bade..f8a0b86e7 100644
--- a/src/Text/Pandoc/Readers/Odt/Base.hs
+++ b/src/Text/Pandoc/Readers/Odt/Base.hs
@@ -32,8 +32,8 @@ Core types of the odt reader.
module Text.Pandoc.Readers.Odt.Base where
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
-import Text.Pandoc.Readers.Odt.Namespaces
+import Text.Pandoc.Readers.Odt.Generic.XMLConverter
+import Text.Pandoc.Readers.Odt.Namespaces
type OdtConverterState s = XMLConverterState Namespace s
diff --git a/src/Text/Pandoc/Readers/Odt/ContentReader.hs b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
index 777c10df5..69eececc8 100644
--- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/ContentReader.hs
@@ -1,8 +1,8 @@
{-# LANGUAGE Arrows #-}
-{-# LANGUAGE TupleSections #-}
{-# LANGUAGE PatternGuards #-}
-{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE TupleSections #-}
+{-# LANGUAGE ViewPatterns #-}
{-
Copyright (C) 2015 Martin Linnemann <theCodingMarlin@googlemail.com>
@@ -39,29 +39,29 @@ module Text.Pandoc.Readers.Odt.ContentReader
, read_body
) where
-import Control.Arrow
-import Control.Applicative hiding ( liftA, liftA2, liftA3 )
+import Control.Applicative hiding (liftA, liftA2, liftA3)
+import Control.Arrow
-import qualified Data.ByteString.Lazy as B
-import qualified Data.Map as M
-import Data.List ( find, intercalate )
-import Data.Maybe
+import qualified Data.ByteString.Lazy as B
+import Data.List (find, intercalate)
+import qualified Data.Map as M
+import Data.Maybe
-import qualified Text.XML.Light as XML
+import qualified Text.XML.Light as XML
-import Text.Pandoc.Definition
-import Text.Pandoc.Builder
-import Text.Pandoc.MediaBag (insertMedia, MediaBag)
-import Text.Pandoc.Shared
+import Text.Pandoc.Definition
+import Text.Pandoc.Builder
+import Text.Pandoc.MediaBag (MediaBag, insertMedia)
+import Text.Pandoc.Shared
-import Text.Pandoc.Readers.Odt.Base
-import Text.Pandoc.Readers.Odt.Namespaces
-import Text.Pandoc.Readers.Odt.StyleReader
+import Text.Pandoc.Readers.Odt.Base
+import Text.Pandoc.Readers.Odt.Namespaces
+import Text.Pandoc.Readers.Odt.StyleReader
-import Text.Pandoc.Readers.Odt.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Readers.Odt.Generic.Utils
+import Text.Pandoc.Readers.Odt.Arrows.Utils
+import Text.Pandoc.Readers.Odt.Generic.Fallible
+import Text.Pandoc.Readers.Odt.Generic.Utils
+import Text.Pandoc.Readers.Odt.Generic.XMLConverter
import qualified Data.Set as Set
@@ -342,9 +342,9 @@ modifierFromStyleDiff propertyTriple =
Just oldVPos -> getVPosModifier' (oldVPos, verticalPosition textProps)
getVPosModifier' (oldVPos , newVPos ) | oldVPos == newVPos = ignore
- getVPosModifier' ( _ , VPosSub ) = subscript
- getVPosModifier' ( _ , VPosSuper ) = superscript
- getVPosModifier' ( _ , _ ) = ignore
+ getVPosModifier' ( _ , VPosSub ) = subscript
+ getVPosModifier' ( _ , VPosSuper ) = superscript
+ getVPosModifier' ( _ , _ ) = ignore
hasEmphChanged :: PropertyTriple -> Bool
hasEmphChanged = swing any [ hasChanged isEmphasised
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
index 8c47cdaf5..72509e591 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
+++ b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
@@ -39,7 +39,7 @@ compatible instances of "ArrowChoice".
-- We export everything
module Text.Pandoc.Readers.Odt.Generic.Fallible where
-import Data.Monoid ((<>))
+import Data.Monoid ((<>))
-- | Default for now. Will probably become a class at some point.
type Failure = ()
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Utils.hs b/src/Text/Pandoc/Readers/Odt/Generic/Utils.hs
index 4af4242b6..f492ec944 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/Utils.hs
+++ b/src/Text/Pandoc/Readers/Odt/Generic/Utils.hs
@@ -1,6 +1,6 @@
-{-# LANGUAGE TypeOperators #-}
-{-# LANGUAGE TupleSections #-}
{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE TupleSections #-}
+{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ViewPatterns #-}
{-
@@ -51,12 +51,12 @@ module Text.Pandoc.Readers.Odt.Generic.Utils
, composition
) where
-import Control.Category ( Category, (>>>), (<<<) )
-import qualified Control.Category as Cat ( id )
-import Control.Monad ( msum )
+import Control.Category (Category, (<<<), (>>>))
+import qualified Control.Category as Cat (id)
+import Control.Monad (msum)
-import qualified Data.Foldable as F ( Foldable, foldr )
-import Data.Maybe
+import qualified Data.Foldable as F (Foldable, foldr)
+import Data.Maybe
-- | Aequivalent to
diff --git a/src/Text/Pandoc/Readers/Odt/Namespaces.hs b/src/Text/Pandoc/Readers/Odt/Namespaces.hs
index deb009998..3c11aeb8e 100644
--- a/src/Text/Pandoc/Readers/Odt/Namespaces.hs
+++ b/src/Text/Pandoc/Readers/Odt/Namespaces.hs
@@ -31,11 +31,11 @@ Namespaces used in odt files.
module Text.Pandoc.Readers.Odt.Namespaces ( Namespace (..)
) where
-import Data.List ( isPrefixOf )
-import Data.Maybe ( fromMaybe, listToMaybe )
-import qualified Data.Map as M ( empty, insert )
+import Data.List (isPrefixOf)
+import qualified Data.Map as M (empty, insert)
+import Data.Maybe (fromMaybe, listToMaybe)
-import Text.Pandoc.Readers.Odt.Generic.Namespaces
+import Text.Pandoc.Readers.Odt.Generic.Namespaces
instance NameSpaceID Namespace where
diff --git a/src/Text/Pandoc/Readers/Odt/StyleReader.hs b/src/Text/Pandoc/Readers/Odt/StyleReader.hs
index 87a6dc91c..abb131983 100644
--- a/src/Text/Pandoc/Readers/Odt/StyleReader.hs
+++ b/src/Text/Pandoc/Readers/Odt/StyleReader.hs
@@ -1,8 +1,7 @@
-{-# LANGUAGE TupleSections #-}
+{-# LANGUAGE Arrows #-}
{-# LANGUAGE PatternGuards #-}
-{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE Arrows #-}
+{-# LANGUAGE TupleSections #-}
{-
Copyright (C) 2015 Martin Linnemann <theCodingMarlin@googlemail.com>
@@ -58,28 +57,28 @@ module Text.Pandoc.Readers.Odt.StyleReader
, readStylesAt
) where
-import Control.Arrow
-import Control.Applicative hiding ( liftA, liftA2, liftA3 )
+import Control.Applicative hiding (liftA, liftA2, liftA3)
+import Control.Arrow
-import qualified Data.Foldable as F
-import qualified Data.Map as M
-import qualified Data.Set as S
-import Data.Char ( isDigit )
-import Data.Default
-import Data.List ( unfoldr )
-import Data.Maybe
+import Data.Char (isDigit)
+import Data.Default
+import qualified Data.Foldable as F
+import Data.List (unfoldr)
+import qualified Data.Map as M
+import Data.Maybe
+import qualified Data.Set as S
-import qualified Text.XML.Light as XML
+import qualified Text.XML.Light as XML
-import Text.Pandoc.Readers.Odt.Arrows.Utils
+import Text.Pandoc.Readers.Odt.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.Utils
-import qualified Text.Pandoc.Readers.Odt.Generic.SetMap as SM
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
+import Text.Pandoc.Readers.Odt.Generic.Fallible
+import qualified Text.Pandoc.Readers.Odt.Generic.SetMap as SM
+import Text.Pandoc.Readers.Odt.Generic.Utils
+import Text.Pandoc.Readers.Odt.Generic.XMLConverter
-import Text.Pandoc.Readers.Odt.Namespaces
-import Text.Pandoc.Readers.Odt.Base
+import Text.Pandoc.Readers.Odt.Base
+import Text.Pandoc.Readers.Odt.Namespaces
readStylesAt :: XML.Element -> Fallible Styles
@@ -217,15 +216,15 @@ instance Lookupable StyleFamily where
]
-- | A named style
-data Style = Style { styleFamily :: Maybe StyleFamily
- , styleParentName :: Maybe StyleName
- , listStyle :: Maybe StyleName
- , styleProperties :: StyleProperties
+data Style = Style { styleFamily :: Maybe StyleFamily
+ , styleParentName :: Maybe StyleName
+ , listStyle :: Maybe StyleName
+ , styleProperties :: StyleProperties
}
deriving ( Eq, Show )
-data StyleProperties = SProps { textProperties :: Maybe TextProperties
- , paraProperties :: Maybe ParaProperties
+data StyleProperties = SProps { textProperties :: Maybe TextProperties
+ , paraProperties :: Maybe ParaProperties
-- , tableColProperties :: Maybe TColProperties
-- , tableRowProperties :: Maybe TRowProperties
-- , tableCellProperties :: Maybe TCellProperties
diff --git a/src/Text/Pandoc/Readers/Org/ParserState.hs b/src/Text/Pandoc/Readers/Org/ParserState.hs
index 0349f7617..e0045fcd5 100644
--- a/src/Text/Pandoc/Readers/Org/ParserState.hs
+++ b/src/Text/Pandoc/Readers/Org/ParserState.hs
@@ -64,14 +64,13 @@ import Text.Pandoc.Builder (Blocks, Inlines)
import Text.Pandoc.Definition (Meta (..), nullMeta)
import Text.Pandoc.Logging
import Text.Pandoc.Options (ReaderOptions (..))
-import Text.Pandoc.Readers.LaTeX.Types (Macro)
import Text.Pandoc.Parsing (Future, HasHeaderMap (..), HasIdentifierList (..),
HasIncludeFiles (..), HasLastStrPosition (..),
- HasLogMessages (..), HasQuoteContext (..),
- HasMacros (..),
- HasReaderOptions (..), ParserContext (..),
- QuoteContext (..), SourcePos, askF, asksF, returnF,
- runF, trimInlinesF)
+ HasLogMessages (..), HasMacros (..),
+ HasQuoteContext (..), HasReaderOptions (..),
+ ParserContext (..), QuoteContext (..), SourcePos,
+ askF, asksF, returnF, runF, trimInlinesF)
+import Text.Pandoc.Readers.LaTeX.Types (Macro)
-- | This is used to delay evaluation until all relevant information has been
-- parsed and made available in the parser state.
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 2d6bb979f..dae9fe40a 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -31,21 +31,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Conversion from reStructuredText to 'Pandoc' document.
-}
module Text.Pandoc.Readers.RST ( readRST ) where
-import Control.Monad (guard, liftM, mzero, when, forM_, mplus)
-import Control.Monad.Identity (Identity(..))
+import Control.Monad (forM_, guard, liftM, mplus, mzero, when)
import Control.Monad.Except (throwError)
+import Control.Monad.Identity (Identity (..))
import Data.Char (isHexDigit, isSpace, toLower, toUpper)
-import Data.List (deleteFirstsBy, findIndex, intercalate, isInfixOf,
- isSuffixOf, nub, sort, transpose, union)
+import Data.List (deleteFirstsBy, findIndex, intercalate, isInfixOf, isSuffixOf,
+ nub, sort, transpose, union)
import qualified Data.Map as M
import Data.Maybe (fromMaybe, isJust)
import Data.Monoid ((<>))
import Data.Sequence (ViewR (..), viewr)
+import Data.Text (Text)
+import qualified Data.Text as T
import Text.Pandoc.Builder (fromList, setMeta)
import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Class (PandocMonad, readFileFromDirs, fetchItem)
-import Text.Pandoc.CSV (CSVOptions(..), defaultCSVOptions, parseCSV)
+import Text.Pandoc.Class (PandocMonad, fetchItem, readFileFromDirs)
+import Text.Pandoc.CSV (CSVOptions (..), defaultCSVOptions, parseCSV)
import Text.Pandoc.Definition
import Text.Pandoc.Error
import Text.Pandoc.ImageSize (lengthToDim, scaleDimension)
@@ -55,8 +57,6 @@ import Text.Pandoc.Parsing
import Text.Pandoc.Shared
import qualified Text.Pandoc.UTF8 as UTF8
import Text.Printf (printf)
-import Data.Text (Text)
-import qualified Data.Text as T
-- TODO:
-- [ ] .. parsed-literal
@@ -149,10 +149,10 @@ metaFromDefList ds meta = adjustAuthors $ foldr f meta ds
splitOnSemi . concatMap factorSemi
normalizeSpaces = reverse . dropWhile isSp . reverse .
dropWhile isSp
- isSp Space = True
- isSp SoftBreak = True
- isSp LineBreak = True
- isSp _ = False
+ isSp Space = True
+ isSp SoftBreak = True
+ isSp LineBreak = True
+ isSp _ = False
splitOnSemi = splitBy (==Str ";")
factorSemi (Str []) = []
factorSemi (Str s) = case break (==';') s of
@@ -817,9 +817,9 @@ listTableDirective top fields body = do
headerRow
bodyRows
where takeRows [BulletList rows] = map takeCells rows
- takeRows _ = []
+ takeRows _ = []
takeCells [BulletList cells] = map B.fromList cells
- takeCells _ = []
+ takeCells _ = []
normWidths ws = map (/ max 1 (sum ws)) ws
csvTableDirective :: PandocMonad m
@@ -829,19 +829,19 @@ csvTableDirective top fields rawcsv = do
let explicitHeader = trim <$> lookup "header" fields
let opts = defaultCSVOptions{
csvDelim = case trim <$> lookup "delim" fields of
- Just "tab" -> '\t'
+ Just "tab" -> '\t'
Just "space" -> ' '
- Just [c] -> c
- _ -> ','
+ Just [c] -> c
+ _ -> ','
, csvQuote = case trim <$> lookup "quote" fields of
Just [c] -> c
- _ -> '"'
+ _ -> '"'
, csvEscape = case trim <$> lookup "escape" fields of
Just [c] -> Just c
- _ -> Nothing
+ _ -> Nothing
, csvKeepSpace = case trim <$> lookup "keepspace" fields of
Just "true" -> True
- _ -> False
+ _ -> False
}
let headerRowsNum = fromMaybe (case explicitHeader of
Just _ -> 1 :: Int
@@ -854,7 +854,7 @@ csvTableDirective top fields rawcsv = do
return $ UTF8.toString bs
Nothing -> return rawcsv
let res = parseCSV opts (T.pack $ case explicitHeader of
- Just h -> h ++ "\n" ++ rawcsv'
+ Just h -> h ++ "\n" ++ rawcsv'
Nothing -> rawcsv')
case res of
Left e -> do
diff --git a/src/Text/Pandoc/Readers/TWiki.hs b/src/Text/Pandoc/Readers/TWiki.hs
index d41152de5..75e3f89eb 100644
--- a/src/Text/Pandoc/Readers/TWiki.hs
+++ b/src/Text/Pandoc/Readers/TWiki.hs
@@ -40,17 +40,17 @@ import Control.Monad.Except (throwError)
import Data.Char (isAlphaNum)
import qualified Data.Foldable as F
import Data.Maybe (fromMaybe)
+import Data.Text (Text)
+import qualified Data.Text as T
import Text.HTML.TagSoup
import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Class (PandocMonad(..))
+import Text.Pandoc.Class (PandocMonad (..))
import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (enclosed, nested)
import Text.Pandoc.Readers.HTML (htmlTag, isCommentTag)
-import Text.Pandoc.XML (fromEntities)
import Text.Pandoc.Shared (crFilter)
-import Data.Text (Text)
-import qualified Data.Text as T
+import Text.Pandoc.XML (fromEntities)
-- | Read twiki from an input string and return a Pandoc document.
readTWiki :: PandocMonad m
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 90567ef23..a57ab93d7 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -57,20 +57,20 @@ import Control.Monad.Except (throwError)
import Data.Char (digitToInt, isUpper)
import Data.List (intercalate, intersperse, transpose)
import Data.Monoid ((<>))
+import Data.Text (Text)
+import qualified Data.Text as T
import Text.HTML.TagSoup (Tag (..), fromAttrib)
import Text.HTML.TagSoup.Match
import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Class (PandocMonad(..))
+import Text.Pandoc.Class (PandocMonad (..))
import Text.Pandoc.CSS
import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Pandoc.Parsing
import Text.Pandoc.Readers.HTML (htmlTag, isBlockTag, isInlineTag)
import Text.Pandoc.Readers.LaTeX (rawLaTeXBlock, rawLaTeXInline)
-import Text.Pandoc.Shared (trim, crFilter, underlineSpan)
-import Data.Text (Text)
-import qualified Data.Text as T
+import Text.Pandoc.Shared (crFilter, trim, underlineSpan)
-- | Parse a Textile text and return a Pandoc document.
readTextile :: PandocMonad m
diff --git a/src/Text/Pandoc/Readers/TikiWiki.hs b/src/Text/Pandoc/Readers/TikiWiki.hs
index 4acbaa30b..16d6e633b 100644
--- a/src/Text/Pandoc/Readers/TikiWiki.hs
+++ b/src/Text/Pandoc/Readers/TikiWiki.hs
@@ -1,6 +1,8 @@
-{-# LANGUAGE RelaxedPolyRec, FlexibleInstances, TypeSynonymInstances #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RelaxedPolyRec #-}
+{-# LANGUAGE TypeSynonymInstances #-}
{- |
Module : Text.Pandoc.Readers.TikiWiki
@@ -19,20 +21,20 @@ module Text.Pandoc.Readers.TikiWiki ( readTikiWiki
import Control.Monad
import Control.Monad.Except (throwError)
-import Text.Pandoc.Definition
+import qualified Data.Foldable as F
+import Data.List (intercalate)
+import Data.Maybe (fromMaybe)
+import Data.Text (Text)
+import qualified Data.Text as T
import qualified Text.Pandoc.Builder as B
+import Text.Pandoc.Class (CommonState (..), PandocMonad (..))
+import Text.Pandoc.Definition
+import Text.Pandoc.Logging (Verbosity (..))
import Text.Pandoc.Options
import Text.Pandoc.Parsing hiding (enclosed, nested)
-import Text.Printf (printf)
-import Text.Pandoc.XML (fromEntities)
-import Text.Pandoc.Class (PandocMonad(..), CommonState(..))
import Text.Pandoc.Shared (crFilter)
-import Text.Pandoc.Logging (Verbosity(..))
-import Data.Maybe (fromMaybe)
-import Data.List (intercalate)
-import qualified Data.Foldable as F
-import Data.Text (Text)
-import qualified Data.Text as T
+import Text.Pandoc.XML (fromEntities)
+import Text.Printf (printf)
-- | Read TikiWiki from an input string and return a Pandoc document.
readTikiWiki :: PandocMonad m
@@ -129,9 +131,9 @@ header = tryMsg "header" $ do
tableRow :: PandocMonad m => TikiWikiParser m [B.Blocks]
tableRow = try $ do
--- row <- sepBy1 (many1Till inline $ oneOf "\n|") (try $ string "|" <* notFollowedBy (oneOf "|\n"))
+-- row <- sepBy1 (many1Till inline $ oneOf "\n|") (try $ string "|" <* notFollowedBy (oneOf "|\n"))
-- return $ map (B.plain . mconcat) row
- row <- sepBy1 ((many1 $ noneOf "\n|") >>= parseColumn) (try $ string "|" <* notFollowedBy (oneOf "|\n"))
+ row <- sepBy1 ((many1 $ noneOf "\n|") >>= parseColumn) (try $ string "|" <* notFollowedBy (oneOf "|\n"))
return $ map B.plain row
where
parseColumn x = do
@@ -155,7 +157,7 @@ tableRow = try $ do
-- || Orange | Apple | more
-- Bread | Pie | more
-- Butter | Ice cream | and more ||
---
+--
table :: PandocMonad m => TikiWikiParser m B.Blocks
table = try $ do
string "||"
@@ -233,8 +235,8 @@ fixListNesting :: [B.Blocks] -> [B.Blocks]
fixListNesting [] = []
fixListNesting (first:[]) = [recurseOnList first]
-- fixListNesting nestall | trace ("\n\nfixListNesting: " ++ (show nestall)) False = undefined
--- fixListNesting nestall@(first:second:rest) =
-fixListNesting (first:second:rest) =
+-- fixListNesting nestall@(first:second:rest) =
+fixListNesting (first:second:rest) =
let secondBlock = head $ B.toList second in
case secondBlock of
BulletList _ -> fixListNesting $ [(mappend (recurseOnList first) (recurseOnList second))] ++ rest
@@ -300,8 +302,8 @@ listWrap upperLN curLN retTree =
retTree
else
case lntype curLN of
- None -> []
- Bullet -> [B.bulletList retTree]
+ None -> []
+ Bullet -> [B.bulletList retTree]
Numbered -> [B.orderedList retTree]
listItem :: PandocMonad m => TikiWikiParser m (ListNesting, B.Blocks)
@@ -418,7 +420,7 @@ whitespace = (lb <|> regsp) >>= return
-- for this
nbsp :: PandocMonad m => TikiWikiParser m B.Inlines
nbsp = try $ do
- string "~hs~"
+ string "~hs~"
return $ B.str " NOT SUPPORTED BEGIN: ~hs~ (non-breaking space) :END "
-- UNSUPPORTED, as the desired behaviour (that the data be
@@ -426,7 +428,7 @@ nbsp = try $ do
-- silently throwing data out seemed bad.
htmlComment :: PandocMonad m => TikiWikiParser m B.Inlines
htmlComment = try $ do
- string "~hc~"
+ string "~hc~"
inner <- many1 $ noneOf "~"
string "~/hc~"
return $ B.str $ " NOT SUPPORTED: ~hc~ (html comment opener) BEGIN: " ++ inner ++ " ~/hc~ :END "
diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs
index 0e68cdfb7..fdf7a827a 100644
--- a/src/Text/Pandoc/Readers/Txt2Tags.hs
+++ b/src/Text/Pandoc/Readers/Txt2Tags.hs
@@ -32,26 +32,27 @@ module Text.Pandoc.Readers.Txt2Tags ( readTxt2Tags
)
where
+import Control.Monad (guard, void, when)
+import Control.Monad.Except (catchError, throwError)
+import Control.Monad.Reader (Reader, asks, runReader)
import Data.Char (toLower)
+import Data.Default
import Data.List (intercalate, intersperse, transpose)
import Data.Maybe (fromMaybe)
import Data.Monoid ((<>))
-import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
-import qualified Text.Pandoc.Builder as B
-import Text.Pandoc.Definition
-import Text.Pandoc.Options
-import Text.Pandoc.Parsing hiding (space, spaces, uri)
-import Text.Pandoc.Shared (compactify, compactifyDL, escapeURI, crFilter, underlineSpan)
-import Control.Monad (guard, void, when)
-import Control.Monad.Reader (Reader, asks, runReader)
-import Data.Default
import Data.Text (Text)
import qualified Data.Text as T
-import Control.Monad.Except (catchError, throwError)
import Data.Time.Format (formatTime)
+import Text.Pandoc.Builder (Blocks, Inlines, trimInlines)
+import qualified Text.Pandoc.Builder as B
import Text.Pandoc.Class (PandocMonad)
import qualified Text.Pandoc.Class as P
import Text.Pandoc.Compat.Time (defaultTimeLocale)
+import Text.Pandoc.Definition
+import Text.Pandoc.Options
+import Text.Pandoc.Parsing hiding (space, spaces, uri)
+import Text.Pandoc.Shared (compactify, compactifyDL, crFilter, escapeURI,
+ underlineSpan)
type T2T = ParserT String ParserState (Reader T2TMeta)
diff --git a/src/Text/Pandoc/Readers/Vimwiki.hs b/src/Text/Pandoc/Readers/Vimwiki.hs
index 52bf37d35..37c8c32d0 100644
--- a/src/Text/Pandoc/Readers/Vimwiki.hs
+++ b/src/Text/Pandoc/Readers/Vimwiki.hs
@@ -63,36 +63,41 @@ Conversion of vimwiki text to 'Pandoc' document.
module Text.Pandoc.Readers.Vimwiki ( readVimwiki
) where
-import Control.Monad.Except (throwError)
import Control.Monad (guard)
+import Control.Monad.Except (throwError)
import Data.Default
+import Data.List (isInfixOf, isPrefixOf)
import Data.Maybe
import Data.Monoid ((<>))
-import Data.List (isInfixOf, isPrefixOf)
import Data.Text (Text, unpack)
-import Text.Pandoc.Builder (Blocks, Inlines, trimInlines, fromList, toList)
-import qualified Text.Pandoc.Builder
- as B (headerWith, str, space, strong, emph, strikeout, code, link, image,
- spanWith, para, horizontalRule, blockQuote, bulletList, plain,
- orderedList, simpleTable, softbreak, codeBlockWith, imageWith, divWith,
- setMeta, definitionList, superscript, subscript, displayMath,
- math)
-import Text.Pandoc.Class (PandocMonad(..))
-import Text.Pandoc.Definition (Pandoc(..), Inline(Space),
- Block(BulletList, OrderedList), Attr, nullMeta, Meta, ListNumberStyle(..),
- ListNumberDelim(..))
+import Text.Pandoc.Builder (Blocks, Inlines, fromList, toList, trimInlines)
+import qualified Text.Pandoc.Builder as B (blockQuote, bulletList, code,
+ codeBlockWith, definitionList,
+ displayMath, divWith, emph,
+ headerWith, horizontalRule, image,
+ imageWith, link, math, orderedList,
+ para, plain, setMeta, simpleTable,
+ softbreak, space, spanWith, str,
+ strikeout, strong, subscript,
+ superscript)
+import Text.Pandoc.Class (PandocMonad (..))
+import Text.Pandoc.Definition (Attr, Block (BulletList, OrderedList),
+ Inline (Space), ListNumberDelim (..),
+ ListNumberStyle (..), Meta, Pandoc (..),
+ nullMeta)
import Text.Pandoc.Options (ReaderOptions)
-import Text.Pandoc.Parsing (readWithM, ParserT, stateOptions, ParserState,
- stateMeta', blanklines, registerHeader, spaceChar, emailAddress, uri, F, runF,
- orderedListMarker, many1Till)
-import Text.Pandoc.Shared (splitBy, stripFirstAndLast, stringify, crFilter)
-import Text.Parsec.Char (spaces, char, anyChar, newline, string, noneOf,
- alphaNum)
-import Text.Parsec.Combinator (eof, choice, many1, manyTill, count, skipMany1,
- notFollowedBy, option)
-import Text.Parsec.Prim (many, try, updateState, getState)
+import Text.Pandoc.Parsing (F, ParserState, ParserT, blanklines, emailAddress,
+ many1Till, orderedListMarker, readWithM,
+ registerHeader, runF, spaceChar, stateMeta',
+ stateOptions, uri)
+import Text.Pandoc.Shared (crFilter, splitBy, stringify, stripFirstAndLast)
+import Text.Parsec.Char (alphaNum, anyChar, char, newline, noneOf, spaces,
+ string)
import Text.Parsec.Char (oneOf, space)
-import Text.Parsec.Combinator (lookAhead, between)
+import Text.Parsec.Combinator (choice, count, eof, many1, manyTill,
+ notFollowedBy, option, skipMany1)
+import Text.Parsec.Combinator (between, lookAhead)
+import Text.Parsec.Prim (getState, many, try, updateState)
import Text.Parsec.Prim ((<|>))
readVimwiki :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
@@ -100,7 +105,7 @@ readVimwiki opts s = do
res <- readWithM parseVimwiki def{ stateOptions = opts }
(unpack (crFilter s))
case res of
- Left e -> throwError e
+ Left e -> throwError e
Right result -> return result
type VwParser = ParserT [Char] ParserState
@@ -278,19 +283,19 @@ displayMath = try $ do
mathTagLaTeX :: String -> String
mathTagLaTeX s = case s of
- "equation" -> ""
+ "equation" -> ""
"equation*" -> ""
- "gather" -> "gathered"
- "gather*" -> "gathered"
- "multline" -> "gathered"
+ "gather" -> "gathered"
+ "gather*" -> "gathered"
+ "multline" -> "gathered"
"multline*" -> "gathered"
- "eqnarray" -> "aligned"
+ "eqnarray" -> "aligned"
"eqnarray*" -> "aligned"
- "align" -> "aligned"
- "align*" -> "aligned"
- "alignat" -> "aligned"
- "alignat*" -> "aligned"
- _ -> s
+ "align" -> "aligned"
+ "align*" -> "aligned"
+ "alignat" -> "aligned"
+ "alignat*" -> "aligned"
+ _ -> s
mixedList :: PandocMonad m => VwParser m Blocks
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index ae44cd8cb..b599eb62b 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -35,18 +35,18 @@ import Codec.Compression.GZip as Gzip
import Control.Applicative ((<|>))
import Control.Monad.Except (throwError)
import Control.Monad.Trans (lift)
-import Data.Monoid ((<>))
import Data.ByteString (ByteString)
import Data.ByteString.Base64
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy as L
import Data.Char (isAlphaNum, isAscii, toLower)
import Data.List (isPrefixOf)
+import Data.Monoid ((<>))
import Network.URI (escapeURIString)
import System.FilePath (takeDirectory, takeExtension, (</>))
import Text.HTML.TagSoup
-import Text.Pandoc.Class (PandocMonad (..), fetchItem, report,
- getInputFiles, setInputFiles)
+import Text.Pandoc.Class (PandocMonad (..), fetchItem, getInputFiles, report,
+ setInputFiles)
import Text.Pandoc.Error
import Text.Pandoc.Logging
import Text.Pandoc.MIME (MimeType)
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 2307470a1..49b41b534 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -1,6 +1,10 @@
-{-# LANGUAGE DeriveDataTypeable, CPP, MultiParamTypeClasses,
- FlexibleContexts, ScopedTypeVariables, PatternGuards,
- ViewPatterns #-}
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE ViewPatterns #-}
{-
Copyright (C) 2006-2017 John MacFarlane <jgm@berkeley.edu>
@@ -94,37 +98,37 @@ module Text.Pandoc.Shared (
pandocVersion
) where
-import Text.Pandoc.Definition
-import Text.Pandoc.Walk
-import Text.Pandoc.Builder (Inlines, Blocks, ToMetaValue(..))
-import qualified Text.Pandoc.Builder as B
-import Data.Char ( toLower, isLower, isUpper, isAlpha,
- isLetter, isDigit, isSpace )
-import Data.List ( find, stripPrefix, intercalate )
-import Data.Maybe (mapMaybe)
-import Data.Version ( showVersion )
+import Codec.Archive.Zip
+import qualified Control.Exception as E
+import Control.Monad (MonadPlus (..), msum, unless)
+import qualified Control.Monad.State.Strict as S
+import qualified Data.ByteString.Lazy as BL
+import Data.Char (isAlpha, isDigit, isLetter, isLower, isSpace, isUpper,
+ toLower)
+import Data.Generics (Data, Typeable)
+import Data.List (find, intercalate, stripPrefix)
import qualified Data.Map as M
-import Network.URI ( URI(uriScheme), escapeURIString, parseURI )
+import Data.Maybe (mapMaybe)
+import Data.Monoid ((<>))
+import Data.Sequence (ViewL (..), ViewR (..), viewl, viewr)
import qualified Data.Set as Set
+import qualified Data.Text as T
+import Data.Version (showVersion)
+import Network.URI (URI (uriScheme), escapeURIString, parseURI)
+import Paths_pandoc (version)
import System.Directory
-import System.FilePath (splitDirectories, isPathSeparator)
+import System.FilePath (isPathSeparator, splitDirectories)
import qualified System.FilePath.Posix as Posix
-import Data.Generics (Typeable, Data)
-import qualified Control.Monad.State.Strict as S
-import qualified Control.Exception as E
-import Control.Monad (msum, unless, MonadPlus(..))
-import Text.Pandoc.Pretty (charWidth)
-import Text.Pandoc.Generic (bottomUp)
-import Text.Pandoc.Compat.Time
import System.IO.Temp
-import Text.HTML.TagSoup (renderTagsOptions, RenderOptions(..), Tag(..),
- renderOptions)
-import Data.Monoid ((<>))
-import Data.Sequence (ViewR(..), ViewL(..), viewl, viewr)
-import qualified Data.Text as T
-import qualified Data.ByteString.Lazy as BL
-import Paths_pandoc (version)
-import Codec.Archive.Zip
+import Text.HTML.TagSoup (RenderOptions (..), Tag (..), renderOptions,
+ renderTagsOptions)
+import Text.Pandoc.Builder (Blocks, Inlines, ToMetaValue (..))
+import qualified Text.Pandoc.Builder as B
+import Text.Pandoc.Compat.Time
+import Text.Pandoc.Definition
+import Text.Pandoc.Generic (bottomUp)
+import Text.Pandoc.Pretty (charWidth)
+import Text.Pandoc.Walk
-- | Version number of pandoc library.
pandocVersion :: String
@@ -192,8 +196,8 @@ escapeStringUsing :: [(Char, String)] -> String -> String
escapeStringUsing _ [] = ""
escapeStringUsing escapeTable (x:xs) =
case (lookup x escapeTable) of
- Just str -> str ++ rest
- Nothing -> x:rest
+ Just str -> str ++ rest
+ Nothing -> x:rest
where rest = escapeStringUsing escapeTable xs
-- | Strip trailing newlines from string.
@@ -279,7 +283,7 @@ normalizeDate s = fmap (formatTime defaultTimeLocale "%F")
(msum $ map (\fs -> parsetimeWith fs s >>= rejectBadYear) formats :: Maybe Day)
where rejectBadYear day = case toGregorian day of
(y, _, _) | y >= 1601 && y <= 9999 -> Just day
- _ -> Nothing
+ _ -> Nothing
parsetimeWith =
#if MIN_VERSION_time(1,5,0)
parseTimeM True defaultTimeLocale
@@ -336,13 +340,13 @@ extractSpaces f is =
removeFormatting :: Walkable Inline a => a -> [Inline]
removeFormatting = query go . walk (deNote . deQuote)
where go :: Inline -> [Inline]
- go (Str xs) = [Str xs]
- go Space = [Space]
- go SoftBreak = [SoftBreak]
- go (Code _ x) = [Str x]
- go (Math _ x) = [Str x]
- go LineBreak = [Space]
- go _ = []
+ go (Str xs) = [Str xs]
+ go Space = [Space]
+ go SoftBreak = [SoftBreak]
+ go (Code _ x) = [Str x]
+ go (Math _ x) = [Str x]
+ go LineBreak = [Space]
+ go _ = []
deNote :: Inline -> Inline
deNote (Note _) = Str ""
@@ -361,14 +365,14 @@ deQuote x = x
stringify :: Walkable Inline a => a -> String
stringify = query go . walk (deNote . deQuote)
where go :: Inline -> [Char]
- go Space = " "
- go SoftBreak = " "
- go (Str x) = x
- go (Code _ x) = x
- go (Math _ x) = x
+ go Space = " "
+ go SoftBreak = " "
+ go (Str x) = x
+ go (Code _ x) = x
+ go (Math _ x) = x
go (RawInline (Format "html") ('<':'b':'r':_)) = " " -- see #2105
- go LineBreak = " "
- go _ = ""
+ go LineBreak = " "
+ go _ = ""
-- | Bring all regular text in a pandoc structure to uppercase.
--
@@ -440,7 +444,7 @@ instance Walkable Inline Element where
ils' <- walkM f ils
elts' <- walkM f elts
return $ Sec lev nums attr ils' elts'
- query f (Blk x) = query f x
+ query f (Blk x) = query f x
query f (Sec _ _ _ ils elts) = query f ils <> query f elts
instance Walkable Block Element where
@@ -451,7 +455,7 @@ instance Walkable Block Element where
ils' <- walkM f ils
elts' <- walkM f elts
return $ Sec lev nums attr ils' elts'
- query f (Blk x) = query f x
+ query f (Blk x) = query f x
query f (Sec _ _ _ ils elts) = query f ils <> query f elts
@@ -464,8 +468,8 @@ inlineListToIdentifier =
map (nbspToSp . toLower) .
filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") .
stringify
- where nbspToSp '\160' = ' '
- nbspToSp x = x
+ where nbspToSp '\160' = ' '
+ nbspToSp x = x
-- | Convert list of Pandoc blocks into (hierarchical) list of Elements
hierarchicalize :: [Block] -> [Element]
@@ -495,17 +499,17 @@ hierarchicalizeWithIds (x:rest) = do
return $ (Blk x) : rest'
headerLtEq :: Int -> Block -> Bool
-headerLtEq level (Header l _ _) = l <= level
-headerLtEq level (Div ("",["references"],[]) (Header l _ _ : _)) = l <= level
-headerLtEq _ _ = False
+headerLtEq level (Header l _ _) = l <= level
+headerLtEq level (Div ("",["references"],[]) (Header l _ _ : _)) = l <= level
+headerLtEq _ _ = False
-- | Generate a unique identifier from a list of inlines.
-- Second argument is a list of already used identifiers.
uniqueIdent :: [Inline] -> Set.Set String -> String
uniqueIdent title' usedIdents
= let baseIdent = case inlineListToIdentifier title' of
- "" -> "section"
- x -> x
+ "" -> "section"
+ x -> x
numIdent n = baseIdent ++ "-" ++ show n
in if baseIdent `Set.member` usedIdents
then case find (\x -> not $ numIdent x `Set.member` usedIdents) ([1..60000] :: [Int]) of
@@ -516,7 +520,7 @@ uniqueIdent title' usedIdents
-- | True if block is a Header block.
isHeaderBlock :: Block -> Bool
isHeaderBlock (Header _ _ _) = True
-isHeaderBlock _ = False
+isHeaderBlock _ = False
-- | Shift header levels up or down.
headerShift :: Int -> Pandoc -> Pandoc
@@ -542,8 +546,8 @@ addMetaField key val (Meta meta) =
Meta $ M.insertWith combine key (toMetaValue val) meta
where combine newval (MetaList xs) = MetaList (xs ++ tolist newval)
combine newval x = MetaList [x, newval]
- tolist (MetaList ys) = ys
- tolist y = [y]
+ tolist (MetaList ys) = ys
+ tolist y = [y]
-- | Create 'Meta' from old-style title, authors, date. This is
-- provided to ease the transition from the old API.
@@ -599,7 +603,7 @@ inDirectory path action = E.bracket
--
mapLeft :: (a -> b) -> Either a c -> Either b c
-mapLeft f (Left x) = Left (f x)
+mapLeft f (Left x) = Left (f x)
mapLeft _ (Right x) = Right x
-- | Remove intermediate "." and ".." directories from a path.
@@ -616,14 +620,14 @@ collapseFilePath = Posix.joinPath . reverse . foldl go [] . splitDirectories
where
go rs "." = rs
go r@(p:rs) ".." = case p of
- ".." -> ("..":r)
+ ".." -> ("..":r)
(checkPathSeperator -> Just True) -> ("..":r)
- _ -> rs
+ _ -> rs
go _ (checkPathSeperator -> Just True) = [[Posix.pathSeparator]]
go rs x = x:rs
- isSingleton [] = Nothing
+ isSingleton [] = Nothing
isSingleton [x] = Just x
- isSingleton _ = Nothing
+ isSingleton _ = Nothing
checkPathSeperator = fmap isPathSeparator . isSingleton
--
diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs
index 7914c35f8..9f3781259 100644
--- a/src/Text/Pandoc/Templates.hs
+++ b/src/Text/Pandoc/Templates.hs
@@ -44,7 +44,7 @@ import qualified Data.Text as T
import System.FilePath ((<.>), (</>))
import Text.DocTemplates (Template, TemplateTarget, applyTemplate,
compileTemplate, renderTemplate, varListToJSON)
-import Text.Pandoc.Class (readDataFile, PandocMonad)
+import Text.Pandoc.Class (PandocMonad, readDataFile)
import Text.Pandoc.Error
import qualified Text.Pandoc.UTF8 as UTF8
diff --git a/src/Text/Pandoc/Translations.hs b/src/Text/Pandoc/Translations.hs
index d9e7e05e2..00529c1de 100644
--- a/src/Text/Pandoc/Translations.hs
+++ b/src/Text/Pandoc/Translations.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-
Copyright (C) 2017 John MacFarlane <jgm@berkeley.edu>
@@ -45,14 +45,14 @@ module Text.Pandoc.Translations (
, readTranslations
)
where
+import Data.Aeson.Types (typeMismatch)
import qualified Data.HashMap.Strict as HM
import qualified Data.Map as M
-import GHC.Generics (Generic)
-import qualified Text.Pandoc.UTF8 as UTF8
import Data.Text as T
-import Text.Pandoc.Shared (safeRead)
import Data.Yaml as Yaml
-import Data.Aeson.Types (typeMismatch)
+import GHC.Generics (Generic)
+import Text.Pandoc.Shared (safeRead)
+import qualified Text.Pandoc.UTF8 as UTF8
data Term =
Preface
diff --git a/src/Text/Pandoc/Writers.hs b/src/Text/Pandoc/Writers.hs
index 3e8729eb9..046022b09 100644
--- a/src/Text/Pandoc/Writers.hs
+++ b/src/Text/Pandoc/Writers.hs
@@ -82,11 +82,13 @@ module Text.Pandoc.Writers
) where
import Data.Aeson
+import qualified Data.ByteString.Lazy as BL
import Data.List (intercalate)
import Data.Text (Text)
import Text.Pandoc.Class
import Text.Pandoc.Definition
import Text.Pandoc.Options
+import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.Writers.AsciiDoc
import Text.Pandoc.Writers.CommonMark
import Text.Pandoc.Writers.ConTeXt
@@ -96,8 +98,8 @@ import Text.Pandoc.Writers.Docx
import Text.Pandoc.Writers.DokuWiki
import Text.Pandoc.Writers.EPUB
import Text.Pandoc.Writers.FB2
-import Text.Pandoc.Writers.HTML
import Text.Pandoc.Writers.Haddock
+import Text.Pandoc.Writers.HTML
import Text.Pandoc.Writers.ICML
import Text.Pandoc.Writers.JATS
import Text.Pandoc.Writers.LaTeX
@@ -108,8 +110,8 @@ import Text.Pandoc.Writers.Ms
import Text.Pandoc.Writers.Muse
import Text.Pandoc.Writers.Native
import Text.Pandoc.Writers.ODT
-import Text.Pandoc.Writers.OPML
import Text.Pandoc.Writers.OpenDocument
+import Text.Pandoc.Writers.OPML
import Text.Pandoc.Writers.Org
import Text.Pandoc.Writers.RST
import Text.Pandoc.Writers.RTF
@@ -118,8 +120,6 @@ import Text.Pandoc.Writers.Texinfo
import Text.Pandoc.Writers.Textile
import Text.Pandoc.Writers.ZimWiki
import Text.Parsec.Error
-import qualified Text.Pandoc.UTF8 as UTF8
-import qualified Data.ByteString.Lazy as BL
data Writer m = TextWriter (WriterOptions -> Pandoc -> m Text)
| ByteStringWriter (WriterOptions -> Pandoc -> m BL.ByteString)
diff --git a/src/Text/Pandoc/Writers/CommonMark.hs b/src/Text/Pandoc/Writers/CommonMark.hs
index 9dc7158fe..9bd9f25bc 100644
--- a/src/Text/Pandoc/Writers/CommonMark.hs
+++ b/src/Text/Pandoc/Writers/CommonMark.hs
@@ -35,8 +35,8 @@ module Text.Pandoc.Writers.CommonMark (writeCommonMark) where
import CMarkGFM
import Control.Monad.State.Strict (State, get, modify, runState)
import Data.Foldable (foldrM)
-import Data.Monoid (Any (..), (<>))
import Data.List (transpose)
+import Data.Monoid (Any (..), (<>))
import Data.Text (Text)
import qualified Data.Text as T
import Text.Pandoc.Class (PandocMonad)
@@ -44,7 +44,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Pandoc.Shared (isTightList, linesToPara, substitute)
import Text.Pandoc.Templates (renderTemplate')
-import Text.Pandoc.Walk (walkM, walk, query)
+import Text.Pandoc.Walk (query, walk, walkM)
import Text.Pandoc.Writers.HTML (writeHtml5String)
import Text.Pandoc.Writers.Shared
@@ -67,7 +67,7 @@ writeCommonMark opts (Pandoc meta blocks) = do
softBreakToSpace :: Inline -> Inline
softBreakToSpace SoftBreak = Space
-softBreakToSpace x = x
+softBreakToSpace x = x
processNotes :: Inline -> State [[Block]] Inline
processNotes (Note bs) = do
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 0a399197d..101be3fc0 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-
Copyright (C) 2007-2017 John MacFarlane <jgm@berkeley.edu>
@@ -38,9 +38,9 @@ import Data.Text (Text)
import Network.URI (unEscapeString)
import Text.Pandoc.BCP47
import Text.Pandoc.Class (PandocMonad, report, toLang)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty
import Text.Pandoc.Shared
@@ -475,26 +475,26 @@ fromBCP47 mbs = fromBCP47' <$> toLang mbs
-- https://tools.ietf.org/html/bcp47#section-2.1
-- http://wiki.contextgarden.net/Language_Codes
fromBCP47' :: Maybe Lang -> Maybe String
-fromBCP47' (Just (Lang "ar" _ "SY" _) ) = Just "ar-sy"
-fromBCP47' (Just (Lang "ar" _ "IQ" _) ) = Just "ar-iq"
-fromBCP47' (Just (Lang "ar" _ "JO" _) ) = Just "ar-jo"
-fromBCP47' (Just (Lang "ar" _ "LB" _) ) = Just "ar-lb"
-fromBCP47' (Just (Lang "ar" _ "DZ" _) ) = Just "ar-dz"
-fromBCP47' (Just (Lang "ar" _ "MA" _) ) = Just "ar-ma"
-fromBCP47' (Just (Lang "de" _ _ ["1901"]) ) = Just "deo"
-fromBCP47' (Just (Lang "de" _ "DE" _) ) = Just "de-de"
-fromBCP47' (Just (Lang "de" _ "AT" _) ) = Just "de-at"
-fromBCP47' (Just (Lang "de" _ "CH" _) ) = Just "de-ch"
-fromBCP47' (Just (Lang "el" _ _ ["poly"]) ) = Just "agr"
-fromBCP47' (Just (Lang "en" _ "US" _) ) = Just "en-us"
-fromBCP47' (Just (Lang "en" _ "GB" _) ) = Just "en-gb"
-fromBCP47' (Just (Lang "grc"_ _ _) ) = Just "agr"
-fromBCP47' (Just (Lang "el" _ _ _) ) = Just "gr"
-fromBCP47' (Just (Lang "eu" _ _ _) ) = Just "ba"
-fromBCP47' (Just (Lang "he" _ _ _) ) = Just "il"
-fromBCP47' (Just (Lang "jp" _ _ _) ) = Just "ja"
-fromBCP47' (Just (Lang "uk" _ _ _) ) = Just "ua"
-fromBCP47' (Just (Lang "vi" _ _ _) ) = Just "vn"
-fromBCP47' (Just (Lang "zh" _ _ _) ) = Just "cn"
-fromBCP47' (Just (Lang l _ _ _) ) = Just l
-fromBCP47' Nothing = Nothing
+fromBCP47' (Just (Lang "ar" _ "SY" _) ) = Just "ar-sy"
+fromBCP47' (Just (Lang "ar" _ "IQ" _) ) = Just "ar-iq"
+fromBCP47' (Just (Lang "ar" _ "JO" _) ) = Just "ar-jo"
+fromBCP47' (Just (Lang "ar" _ "LB" _) ) = Just "ar-lb"
+fromBCP47' (Just (Lang "ar" _ "DZ" _) ) = Just "ar-dz"
+fromBCP47' (Just (Lang "ar" _ "MA" _) ) = Just "ar-ma"
+fromBCP47' (Just (Lang "de" _ _ ["1901"]) ) = Just "deo"
+fromBCP47' (Just (Lang "de" _ "DE" _) ) = Just "de-de"
+fromBCP47' (Just (Lang "de" _ "AT" _) ) = Just "de-at"
+fromBCP47' (Just (Lang "de" _ "CH" _) ) = Just "de-ch"
+fromBCP47' (Just (Lang "el" _ _ ["poly"]) ) = Just "agr"
+fromBCP47' (Just (Lang "en" _ "US" _) ) = Just "en-us"
+fromBCP47' (Just (Lang "en" _ "GB" _) ) = Just "en-gb"
+fromBCP47' (Just (Lang "grc"_ _ _) ) = Just "agr"
+fromBCP47' (Just (Lang "el" _ _ _) ) = Just "gr"
+fromBCP47' (Just (Lang "eu" _ _ _) ) = Just "ba"
+fromBCP47' (Just (Lang "he" _ _ _) ) = Just "il"
+fromBCP47' (Just (Lang "jp" _ _ _) ) = Just "ja"
+fromBCP47' (Just (Lang "uk" _ _ _) ) = Just "ua"
+fromBCP47' (Just (Lang "vi" _ _ _) ) = Just "vn"
+fromBCP47' (Just (Lang "zh" _ _ _) ) = Just "cn"
+fromBCP47' (Just (Lang l _ _ _) ) = Just l
+fromBCP47' Nothing = Nothing
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
index d7dff6d19..09cf3fac8 100644
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -43,12 +43,12 @@ import Data.List (intersperse)
import qualified Data.Map as M
import Data.Text (Text, pack)
import Data.Typeable
-import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8)
import Foreign.Lua (Lua, ToLuaStack (..), callFunc, runLua)
import Foreign.Lua.Api
-import Text.Pandoc.Error
-import Text.Pandoc.Lua.Util ( addValue )
+import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8)
import Text.Pandoc.Definition
+import Text.Pandoc.Error
+import Text.Pandoc.Lua.Util (addValue)
import Text.Pandoc.Options
import Text.Pandoc.Templates
import qualified Text.Pandoc.UTF8 as UTF8
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
index 9db9a0102..d6b7f7cad 100644
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -32,10 +32,10 @@ Conversion of 'Pandoc' documents to Docbook XML.
module Text.Pandoc.Writers.Docbook ( writeDocbook4, writeDocbook5 ) where
import Control.Monad.Reader
import Data.Char (toLower)
-import Data.Text (Text)
import Data.Generics (everywhere, mkT)
import Data.List (intercalate, isPrefixOf, isSuffixOf, stripPrefix)
import Data.Monoid (Any (..))
+import Data.Text (Text)
import qualified Text.Pandoc.Builder as B
import Text.Pandoc.Class (PandocMonad, report)
import Text.Pandoc.Definition
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index f19621744..3ab4548a2 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -51,6 +51,7 @@ import qualified Data.Text as T
import Data.Time.Clock.POSIX
import Skylighting
import System.Random (randomR)
+import Text.Pandoc.BCP47 (getLang, renderLang)
import Text.Pandoc.Class (PandocMonad, report, toLang)
import qualified Text.Pandoc.Class as P
import Text.Pandoc.Compat.Time
@@ -68,7 +69,6 @@ import qualified Text.Pandoc.UTF8 as UTF8
import Text.Pandoc.Walk
import Text.Pandoc.Writers.Math
import Text.Pandoc.Writers.Shared (fixDisplayMath)
-import Text.Pandoc.BCP47 (getLang, renderLang)
import Text.Printf (printf)
import Text.TeXMath
import Text.XML.Light as XML
@@ -276,9 +276,9 @@ writeDocx opts doc@(Pandoc meta _) = do
setval _ x = x
setvalattr :: String -> XML.Attr -> XML.Attr
setvalattr l (XML.Attr qn@(QName "val" _ _) _) = XML.Attr qn l
- setvalattr _ x = x
+ setvalattr _ x = x
isLangElt (Elem e') = qName (elName e') == "lang"
- isLangElt _ = False
+ isLangElt _ = False
let stylepath = "word/styles.xml"
styledoc <- addLang <$> parseXml refArchive distArchive stylepath
@@ -508,8 +508,8 @@ writeDocx opts doc@(Pandoc meta _) = do
, qName (elName e) == "num" ] }
let keywords = case lookupMeta "keywords" meta of
- Just (MetaList xs) -> map stringify xs
- _ -> []
+ Just (MetaList xs) -> map stringify xs
+ _ -> []
let docPropsPath = "docProps/core.xml"
let docProps = mknode "cp:coreProperties"
diff --git a/src/Text/Pandoc/Writers/DokuWiki.hs b/src/Text/Pandoc/Writers/DokuWiki.hs
index 279475a21..43e2952de 100644
--- a/src/Text/Pandoc/Writers/DokuWiki.hs
+++ b/src/Text/Pandoc/Writers/DokuWiki.hs
@@ -46,9 +46,9 @@ import Data.Default (Default (..))
import Data.List (intercalate, intersect, isPrefixOf, transpose)
import Data.Text (Text, pack)
import Text.Pandoc.Class (PandocMonad, report)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options (WrapOption (..), WriterOptions (writerTableOfContents, writerTemplate, writerWrapText))
import Text.Pandoc.Shared (camelCaseToHyphenated, escapeURI, isURI, linesToPara,
removeFormatting, substitute, trimr)
@@ -291,7 +291,7 @@ listItemToDokuWiki opts items = do
bs <- mapM (blockToDokuWiki opts) items
let contents = case items of
[_, CodeBlock _ _] -> concat bs
- _ -> vcat bs
+ _ -> vcat bs
indent <- stIndent <$> ask
backSlash <- stBackSlashLB <$> ask
let indent' = if backSlash then (drop 2 indent) else indent
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index c75845fa9..d28187bf0 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -34,19 +34,19 @@ Conversion of 'Pandoc' documents to EPUB.
module Text.Pandoc.Writers.EPUB ( writeEPUB2, writeEPUB3 ) where
import Codec.Archive.Zip (Entry, addEntryToArchive, eRelativePath, emptyArchive,
fromArchive, fromEntry, toEntry)
-import Control.Monad (mplus, when, unless, zipWithM)
+import Control.Monad (mplus, unless, when, zipWithM)
import Control.Monad.Except (catchError, throwError)
-import Control.Monad.State.Strict (State, StateT, evalState, evalStateT, get, gets,
- lift, modify, put)
+import Control.Monad.State.Strict (State, StateT, evalState, evalStateT, get,
+ gets, lift, modify, put)
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Lazy.Char8 as B8
-import qualified Data.Text.Lazy as TL
-import qualified Data.Text as TS
-import Data.Char (isAlphaNum, isDigit, toLower, isAscii)
+import Data.Char (isAlphaNum, isAscii, isDigit, toLower)
import Data.List (intercalate, isInfixOf, isPrefixOf)
import qualified Data.Map as M
import Data.Maybe (catMaybes, fromMaybe)
import qualified Data.Set as Set
+import qualified Data.Text as TS
+import qualified Data.Text.Lazy as TL
import Network.HTTP (urlEncode)
import System.FilePath (takeExtension, takeFileName)
import Text.HTML.TagSoup (Tag (TagOpen), fromAttrib, parseTags)
@@ -71,7 +71,7 @@ import Text.Pandoc.Writers.HTML (writeHtmlStringForEPUB)
import Text.Printf (printf)
import Text.XML.Light (Attr (..), Element (..), Node (..), QName (..),
add_attrs, lookupAttr, node, onlyElems, parseXML,
- ppElement, strContent, unode, unqual, showElement)
+ ppElement, showElement, strContent, unode, unqual)
-- A Chapter includes a list of blocks and maybe a section
-- number offset. Note, some chapters are unnumbered. The section
@@ -709,7 +709,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do
Right x -> x
-- can't have a element inside a...
delink (Link _ ils _) = Span ("", [], []) ils
- delink x = x
+ delink x = x
let navtag = if epub3 then "nav" else "div"
tocBlocks <- lift $ evalStateT (mapM (navPointNode navXhtmlFormatter) secs) 1
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 9cb9098de..b7dc43685 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -37,15 +37,15 @@ FictionBook is an XML-based e-book format. For more information see:
-}
module Text.Pandoc.Writers.FB2 (writeFB2) where
-import Control.Monad.Except (catchError)
-import Control.Monad.State.Strict (StateT, evalStateT, get, lift, modify, liftM)
import Control.Monad (zipWithM)
+import Control.Monad.Except (catchError)
+import Control.Monad.State.Strict (StateT, evalStateT, get, lift, liftM, modify)
import Data.ByteString.Base64 (encode)
import qualified Data.ByteString.Char8 as B8
import Data.Char (isAscii, isControl, isSpace, toLower)
import Data.Either (lefts, rights)
-import Data.Text (Text, pack)
import Data.List (intercalate, intersperse, isPrefixOf, stripPrefix)
+import Data.Text (Text, pack)
import Network.HTTP (urlEncode)
import Text.XML.Light
import qualified Text.XML.Light as X
@@ -56,8 +56,7 @@ import qualified Text.Pandoc.Class as P
import Text.Pandoc.Definition
import Text.Pandoc.Logging
import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..), def)
-import Text.Pandoc.Shared (capitalize, isHeaderBlock, isURI,
- orderedListMarkers)
+import Text.Pandoc.Shared (capitalize, isHeaderBlock, isURI, orderedListMarkers)
-- | Data to be written at the end of the document:
-- (foot)notes, URLs, references, images.
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index f197bceb2..9cb3aced8 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -45,13 +45,13 @@ module Text.Pandoc.Writers.HTML (
) where
import Control.Monad.State.Strict
import Data.Char (ord, toLower)
-import Data.Text (Text)
-import qualified Data.Text.Lazy as TL
-import Data.List (intersperse, isPrefixOf, partition, intercalate)
+import Data.List (intercalate, intersperse, isPrefixOf, partition)
import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing)
import Data.Monoid ((<>))
import qualified Data.Set as Set
import Data.String (fromString)
+import Data.Text (Text)
+import qualified Data.Text.Lazy as TL
import Network.HTTP (urlEncode)
import Network.URI (URI (..), parseURIReference, unEscapeString)
import Numeric (showHex)
@@ -79,7 +79,7 @@ import qualified Text.Blaze.Html5 as H5
#endif
import Control.Monad.Except (throwError)
import Data.Aeson (Value)
-import System.FilePath (takeExtension, takeBaseName)
+import System.FilePath (takeBaseName, takeExtension)
import Text.Blaze.Html.Renderer.Text (renderHtml)
import qualified Text.Blaze.XHtml1.Transitional as H
import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
@@ -582,14 +582,14 @@ dimensionsToAttrList attr = consolidateStyles $ go Width ++ go Height
consolidateStyles :: [(String, String)] -> [(String, String)]
consolidateStyles xs =
case partition isStyle xs of
- ([], _) -> xs
+ ([], _) -> xs
(ss, rest) -> ("style", intercalate ";" $ map snd ss) : rest
isStyle ("style", _) = True
isStyle _ = False
go dir = case (dimension dir attr) of
- (Just (Pixel a)) -> [(show dir, show a)]
- (Just x) -> [("style", show dir ++ ":" ++ show x)]
- Nothing -> []
+ (Just (Pixel a)) -> [(show dir, show a)]
+ (Just x) -> [("style", show dir ++ ":" ++ show x)]
+ Nothing -> []
imageExts :: [String]
imageExts = [ "art", "bmp", "cdr", "cdt", "cpt", "cr2", "crw", "djvu", "erf",
diff --git a/src/Text/Pandoc/Writers/Haddock.hs b/src/Text/Pandoc/Writers/Haddock.hs
index d1146ca73..c964ddf74 100644
--- a/src/Text/Pandoc/Writers/Haddock.hs
+++ b/src/Text/Pandoc/Writers/Haddock.hs
@@ -35,8 +35,8 @@ Haddock: <http://www.haskell.org/haddock/doc/html/>
module Text.Pandoc.Writers.Haddock (writeHaddock) where
import Control.Monad.State.Strict
import Data.Default
-import Data.Text (Text)
import Data.List (intersperse, transpose)
+import Data.Text (Text)
import Text.Pandoc.Class (PandocMonad, report)
import Text.Pandoc.Definition
import Text.Pandoc.Logging
diff --git a/src/Text/Pandoc/Writers/JATS.hs b/src/Text/Pandoc/Writers/JATS.hs
index 012ff8416..4efd00ee5 100644
--- a/src/Text/Pandoc/Writers/JATS.hs
+++ b/src/Text/Pandoc/Writers/JATS.hs
@@ -33,15 +33,16 @@ https://jats.nlm.nih.gov/publishing/tag-library/1.1d3/element/mml-math.html
module Text.Pandoc.Writers.JATS ( writeJATS ) where
import Control.Monad.Reader
import Data.Char (toLower)
-import Data.Text (Text)
import Data.Generics (everywhere, mkT)
import Data.List (intercalate, isSuffixOf, partition)
import Data.Maybe (fromMaybe)
+import Data.Text (Text)
import qualified Text.Pandoc.Builder as B
import Text.Pandoc.Class (PandocMonad, report)
import Text.Pandoc.Definition
import Text.Pandoc.Highlighting (languages, languagesByExtension)
import Text.Pandoc.Logging
+import Text.Pandoc.MIME (getMimeType)
import Text.Pandoc.Options
import Text.Pandoc.Pretty
import Text.Pandoc.Shared
@@ -49,7 +50,6 @@ import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Writers.Math
import Text.Pandoc.Writers.Shared
import Text.Pandoc.XML
-import Text.Pandoc.MIME (getMimeType)
import Text.TeXMath
import qualified Text.XML.Light as Xml
@@ -90,7 +90,7 @@ writeJATS opts d =
docToJATS :: PandocMonad m => WriterOptions -> Pandoc -> DB m Text
docToJATS opts (Pandoc meta blocks) = do
let isBackBlock (Div ("refs",_,_) _) = True
- isBackBlock _ = False
+ isBackBlock _ = False
let (backblocks, bodyblocks) = partition isBackBlock blocks
let elements = hierarchicalize bodyblocks
let backElements = hierarchicalize backblocks
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 282910ee5..1a36f987b 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -45,7 +45,7 @@ import Data.Maybe (catMaybes, fromMaybe, isJust)
import Data.Text (Text)
import qualified Data.Text as T
import Network.URI (unEscapeString)
-import Text.Pandoc.BCP47 (Lang(..), getLang, renderLang)
+import Text.Pandoc.BCP47 (Lang (..), getLang, renderLang)
import Text.Pandoc.Class (PandocMonad, report, toLang)
import Text.Pandoc.Definition
import Text.Pandoc.Highlighting (formatLaTeXBlock, formatLaTeXInline, highlight,
@@ -1001,7 +1001,7 @@ inlineToLaTeX (Code (_,classes,_) str) = do
inItem <- gets stInItem
let listingsCode = do
let listingsopt = case getListingsLanguage classes of
- Just l -> "[language=" ++ mbBraced l ++ "]"
+ Just l -> "[language=" ++ mbBraced l ++ "]"
Nothing -> ""
inNote <- gets stInNote
when inNote $ modify $ \s -> s{ stVerbInNote = True }
diff --git a/src/Text/Pandoc/Writers/Man.hs b/src/Text/Pandoc/Writers/Man.hs
index 8adb3e7eb..40c0dd815 100644
--- a/src/Text/Pandoc/Writers/Man.hs
+++ b/src/Text/Pandoc/Writers/Man.hs
@@ -31,7 +31,7 @@ Conversion of 'Pandoc' documents to groff man page format.
-}
module Text.Pandoc.Writers.Man ( writeMan) where
import Control.Monad.State.Strict
-import Data.List (intercalate, intersperse, stripPrefix, sort)
+import Data.List (intercalate, intersperse, sort, stripPrefix)
import qualified Data.Map as Map
import Data.Maybe (fromMaybe)
import Data.Text (Text)
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index a54f4eb85..5d812b169 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -39,8 +39,8 @@ import Control.Monad.State.Strict
import Data.Char (chr, isPunctuation, isSpace, ord)
import Data.Default
import qualified Data.HashMap.Strict as H
-import qualified Data.Map as M
import Data.List (find, group, intersperse, sortBy, stripPrefix, transpose)
+import qualified Data.Map as M
import Data.Maybe (fromMaybe)
import Data.Monoid (Any (..))
import Data.Ord (comparing)
@@ -994,7 +994,7 @@ inlineToMarkdown opts (Superscript lst) =
else
let rendered = render Nothing contents
in case mapM toSuperscript rendered of
- Just r -> text r
+ Just r -> text r
Nothing -> text $ "^(" ++ rendered ++ ")"
inlineToMarkdown _ (Subscript []) = return empty
inlineToMarkdown opts (Subscript lst) =
@@ -1007,7 +1007,7 @@ inlineToMarkdown opts (Subscript lst) =
else
let rendered = render Nothing contents
in case mapM toSubscript rendered of
- Just r -> text r
+ Just r -> text r
Nothing -> text $ "_(" ++ rendered ++ ")"
inlineToMarkdown opts (SmallCaps lst) = do
plain <- asks envPlain
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index 58d1b0707..839f16cea 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -36,9 +36,9 @@ import Data.List (intercalate)
import qualified Data.Set as Set
import Data.Text (Text, pack)
import Text.Pandoc.Class (PandocMonad, report)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty (render)
import Text.Pandoc.Shared
diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs
index 493da1545..68c0d6096 100644
--- a/src/Text/Pandoc/Writers/Ms.hs
+++ b/src/Text/Pandoc/Writers/Ms.hs
@@ -36,29 +36,29 @@ TODO:
-}
module Text.Pandoc.Writers.Ms ( writeMs ) where
-import Text.Pandoc.Definition
-import Text.Pandoc.Templates
-import Text.Pandoc.Shared
-import Text.Pandoc.Writers.Shared
-import Text.Pandoc.Options
-import Text.Pandoc.Writers.Math
-import Text.Printf ( printf )
-import qualified Data.Text as T
-import Data.Text (Text)
+import Control.Monad.State.Strict
+import Data.Char (isLower, isUpper, toUpper)
+import Data.List (intercalate, intersperse, sort)
import qualified Data.Map as Map
-import Data.Maybe ( catMaybes, fromMaybe )
-import Data.List ( intersperse, intercalate, sort )
-import Text.Pandoc.Pretty
+import Data.Maybe (catMaybes, fromMaybe)
+import Data.Text (Text)
+import qualified Data.Text as T
+import Network.URI (escapeURIString, isAllowedInURI)
+import Skylighting
+import System.FilePath (takeExtension)
import Text.Pandoc.Class (PandocMonad, report)
+import Text.Pandoc.Definition
+import Text.Pandoc.Highlighting
import Text.Pandoc.ImageSize
import Text.Pandoc.Logging
-import Control.Monad.State.Strict
-import Data.Char ( isLower, isUpper, toUpper )
+import Text.Pandoc.Options
+import Text.Pandoc.Pretty
+import Text.Pandoc.Shared
+import Text.Pandoc.Templates
+import Text.Pandoc.Writers.Math
+import Text.Pandoc.Writers.Shared
+import Text.Printf (printf)
import Text.TeXMath (writeEqn)
-import System.FilePath (takeExtension)
-import Skylighting
-import Text.Pandoc.Highlighting
-import Network.URI (escapeURIString, isAllowedInURI)
data WriterState = WriterState { stHasInlineMath :: Bool
, stFirstPara :: Bool
@@ -147,7 +147,7 @@ msEscapes = Map.fromList $
escapeChar :: Char -> String
escapeChar c = case Map.lookup c msEscapes of
- Just s -> s
+ Just s -> s
Nothing -> [c]
-- | Escape | character, used to mark inline math, inside math.
@@ -176,13 +176,13 @@ toSmallCaps (c:cs)
-- | Escape a literal (code) section for Ms.
escapeCode :: String -> String
escapeCode = concat . intersperse "\n" . map escapeLine . lines
- where escapeCodeChar ' ' = "\\ "
+ where escapeCodeChar ' ' = "\\ "
escapeCodeChar '\t' = "\\\t"
- escapeCodeChar c = escapeChar c
+ escapeCodeChar c = escapeChar c
escapeLine codeline =
case concatMap escapeCodeChar codeline of
a@('.':_) -> "\\&" ++ a
- b -> b
+ b -> b
-- We split inline lists into sentences, and print one sentence per
-- line. groff/troff treats the line-ending period differently.
@@ -194,8 +194,8 @@ breakSentence [] = ([],[])
breakSentence xs =
let isSentenceEndInline (Str ys@(_:_)) | last ys == '.' = True
isSentenceEndInline (Str ys@(_:_)) | last ys == '?' = True
- isSentenceEndInline (LineBreak) = True
- isSentenceEndInline _ = False
+ isSentenceEndInline (LineBreak) = True
+ isSentenceEndInline _ = False
(as, bs) = break isSentenceEndInline xs
in case bs of
[] -> (as, [])
@@ -548,7 +548,7 @@ handleNote opts bs = do
-- line after the note ref:
let bs' = case bs of
(Para ils : rest) -> Plain ils : rest
- _ -> bs
+ _ -> bs
contents <- blockListToMs opts bs'
return $ cr <> text ".FS" $$ contents $$ text ".FE" <> cr
diff --git a/src/Text/Pandoc/Writers/Native.hs b/src/Text/Pandoc/Writers/Native.hs
index 3ef33f05c..c934fe4d9 100644
--- a/src/Text/Pandoc/Writers/Native.hs
+++ b/src/Text/Pandoc/Writers/Native.hs
@@ -30,8 +30,8 @@ Conversion of a 'Pandoc' document to a string representation.
-}
module Text.Pandoc.Writers.Native ( writeNative )
where
-import Data.Text (Text)
import Data.List (intersperse)
+import Data.Text (Text)
import Text.Pandoc.Class (PandocMonad)
import Text.Pandoc.Definition
import Text.Pandoc.Options (WrapOption (..), WriterOptions (..))
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index 90b7c3501..32fcb0292 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -38,6 +38,7 @@ import Data.List (isPrefixOf)
import Data.Maybe (fromMaybe)
import qualified Data.Text.Lazy as TL
import System.FilePath (takeDirectory, takeExtension, (<.>))
+import Text.Pandoc.BCP47 (Lang (..), getLang, renderLang)
import Text.Pandoc.Class (PandocMonad, report, toLang)
import qualified Text.Pandoc.Class as P
import Text.Pandoc.Definition
@@ -51,7 +52,6 @@ import Text.Pandoc.UTF8 (fromStringLazy, fromTextLazy, toStringLazy)
import Text.Pandoc.Walk
import Text.Pandoc.Writers.OpenDocument (writeOpenDocument)
import Text.Pandoc.Writers.Shared (fixDisplayMath)
-import Text.Pandoc.BCP47 (getLang, Lang(..), renderLang)
import Text.Pandoc.XML
import Text.TeXMath
import Text.XML.Light
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index ed3dabb87..04cae0b4b 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -36,10 +36,11 @@ import Control.Arrow ((***), (>>>))
import Control.Monad.State.Strict hiding (when)
import Data.Char (chr)
import Data.List (sortBy)
-import Data.Text (Text)
import qualified Data.Map as Map
import Data.Ord (comparing)
import qualified Data.Set as Set
+import Data.Text (Text)
+import Text.Pandoc.BCP47 (Lang (..), parseBCP47)
import Text.Pandoc.Class (PandocMonad, report)
import Text.Pandoc.Definition
import Text.Pandoc.Logging
@@ -50,7 +51,6 @@ import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Writers.Math
import Text.Pandoc.Writers.Shared
import Text.Pandoc.XML
-import Text.Pandoc.BCP47 (parseBCP47, Lang(..))
import Text.Printf (printf)
-- | Auxiliary function to convert Plain block to Para.
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 88f42acd4..f73822b86 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -37,14 +37,14 @@ Org-Mode: <http://orgmode.org>
module Text.Pandoc.Writers.Org (writeOrg) where
import Control.Monad.State.Strict
import Data.Char (isAlphaNum, toLower)
-import Data.Text (Text)
import Data.List (intersect, intersperse, isPrefixOf, partition, transpose)
+import Data.Text (Text)
import Text.Pandoc.Class (PandocMonad, report)
import Text.Pandoc.Definition
+import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty
import Text.Pandoc.Shared
-import Text.Pandoc.Logging
import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Writers.Shared
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 8599680cf..cfbacdaed 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -38,9 +38,9 @@ import Data.Maybe (fromMaybe)
import Data.Text (Text, stripEnd)
import qualified Text.Pandoc.Builder as B
import Text.Pandoc.Class (PandocMonad, report)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty
import Text.Pandoc.Shared
@@ -371,12 +371,12 @@ blockToRST' x = do
modify (\s -> s{stLastNested =
case x of
Para [Image _ _ (_,'f':'i':'g':':':_)] -> True
- Para{} -> False
- Plain{} -> False
- Header{} -> False
- LineBlock{} -> False
- HorizontalRule -> False
- _ -> True
+ Para{} -> False
+ Plain{} -> False
+ Header{} -> False
+ LineBlock{} -> False
+ HorizontalRule -> False
+ _ -> True
})
blockToRST x
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index d4de3112c..2b05f2f7e 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -34,9 +34,9 @@ import Control.Monad.Except (catchError, throwError)
import qualified Data.ByteString as B
import Data.Char (chr, isDigit, ord)
import Data.List (intercalate, isSuffixOf)
+import qualified Data.Map as M
import Data.Text (Text)
import qualified Data.Text as T
-import qualified Data.Map as M
import Text.Pandoc.Class (PandocMonad, report)
import qualified Text.Pandoc.Class as P
import Text.Pandoc.Definition
diff --git a/src/Text/Pandoc/Writers/TEI.hs b/src/Text/Pandoc/Writers/TEI.hs
index 26070966e..dfdb443a2 100644
--- a/src/Text/Pandoc/Writers/TEI.hs
+++ b/src/Text/Pandoc/Writers/TEI.hs
@@ -31,14 +31,14 @@ Conversion of 'Pandoc' documents to Docbook XML.
-}
module Text.Pandoc.Writers.TEI (writeTEI) where
import Data.Char (toLower)
-import Data.Text (Text)
import Data.List (isPrefixOf, stripPrefix)
+import Data.Text (Text)
import qualified Text.Pandoc.Builder as B
import Text.Pandoc.Class (PandocMonad, report)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.Highlighting (languages, languagesByExtension)
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty
import Text.Pandoc.Shared
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
index acc9eaa0f..5ee9d3250 100644
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -35,9 +35,9 @@ import Data.Char (isSpace)
import Data.List (intercalate)
import Data.Text (Text, pack)
import Text.Pandoc.Class (PandocMonad, report)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options
import Text.Pandoc.Pretty (render)
import Text.Pandoc.Shared
diff --git a/src/Text/Pandoc/Writers/ZimWiki.hs b/src/Text/Pandoc/Writers/ZimWiki.hs
index ced02d4be..67dcd72d1 100644
--- a/src/Text/Pandoc/Writers/ZimWiki.hs
+++ b/src/Text/Pandoc/Writers/ZimWiki.hs
@@ -37,13 +37,13 @@ import Control.Monad.State.Strict (StateT, evalStateT, gets, modify)
import Data.Default (Default (..))
import Data.List (intercalate, isInfixOf, isPrefixOf, transpose)
import qualified Data.Map as Map
-import Data.Text (breakOnAll, pack, Text)
+import Data.Text (Text, breakOnAll, pack)
import Text.Pandoc.Class (PandocMonad, report)
-import Text.Pandoc.Logging
import Text.Pandoc.Definition
import Text.Pandoc.ImageSize
+import Text.Pandoc.Logging
import Text.Pandoc.Options (WrapOption (..), WriterOptions (writerTableOfContents, writerTemplate, writerWrapText))
-import Text.Pandoc.Shared (isURI, escapeURI, linesToPara, removeFormatting,
+import Text.Pandoc.Shared (escapeURI, isURI, linesToPara, removeFormatting,
substitute, trimr)
import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Writers.Shared (defField, metaToJSON)
diff --git a/test/Tests/Command.hs b/test/Tests/Command.hs
index 608b00b18..4999ff45a 100644
--- a/test/Tests/Command.hs
+++ b/test/Tests/Command.hs
@@ -2,20 +2,20 @@ module Tests.Command (findPandoc, runTest, tests)
where
import Data.Algorithm.Diff
+import qualified Data.ByteString as BS
import Data.List (isSuffixOf)
import Prelude hiding (readFile)
import System.Directory
import System.Exit
import System.FilePath (joinPath, splitDirectories, takeDirectory, (</>))
+import System.IO (hPutStr, stderr)
+import System.IO.Unsafe (unsafePerformIO)
import System.Process
-import System.IO (stderr, hPutStr)
import Test.Tasty
import Test.Tasty.HUnit
import Tests.Helpers
import Text.Pandoc
-import qualified Data.ByteString as BS
import qualified Text.Pandoc.UTF8 as UTF8
-import System.IO.Unsafe (unsafePerformIO) -- TODO temporary
-- | Run a test with normalize function, return True if test passed.
runTest :: String -- ^ Title of test
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index ba6196ccb..f9f0e9753 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -1,15 +1,15 @@
-{-# Language OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings #-}
module Tests.Lua ( tests ) where
import Control.Monad (when)
import System.FilePath ((</>))
import Test.Tasty (TestTree, localOption)
import Test.Tasty.HUnit (Assertion, assertEqual, testCase)
-import Test.Tasty.QuickCheck (ioProperty, testProperty, QuickCheckTests(..))
+import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty)
import Text.Pandoc.Arbitrary ()
-import Text.Pandoc.Builder ( (<>), bulletList, doc, doubleQuoted, emph
- , linebreak, rawBlock, singleQuoted, para, plain
- , space, str, strong)
+import Text.Pandoc.Builder (bulletList, doc, doubleQuoted, emph, linebreak,
+ para, plain, rawBlock, singleQuoted, space, str,
+ strong, (<>))
import Text.Pandoc.Class (runIOorExplode)
import Text.Pandoc.Definition (Block, Inline, Meta, Pandoc)
import Text.Pandoc.Lua
@@ -84,7 +84,7 @@ assertFilterConversion msg filterPath docIn docExpected = do
docEither <- runIOorExplode $
runLuaFilter (Just "../data") ("lua" </> filterPath) [] docIn
case docEither of
- Left _ -> fail "lua filter failed"
+ Left _ -> fail "lua filter failed"
Right docRes -> assertEqual msg docExpected docRes
roundtripEqual :: (Eq a, FromLuaStack a, ToLuaStack a) => a -> IO Bool
@@ -102,5 +102,5 @@ roundtripEqual x = (x ==) <$> roundtripped
error ("not exactly one additional element on the stack: " ++ show size)
res <- peekEither (-1)
case res of
- Left _ -> error "could not read from stack"
- Right y -> return y
+ Left _ -> error "could not read from stack"
+ Right y -> return y
diff --git a/test/Tests/Readers/Docx.hs b/test/Tests/Readers/Docx.hs
index 71ebb6cce..421acaa8b 100644
--- a/test/Tests/Readers/Docx.hs
+++ b/test/Tests/Readers/Docx.hs
@@ -1,18 +1,18 @@
module Tests.Readers.Docx (tests) where
import Codec.Archive.Zip
-import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString as BS
-import qualified Data.Text as T
+import qualified Data.ByteString.Lazy as B
import qualified Data.Map as M
+import qualified Data.Text as T
+import System.IO.Unsafe
import Test.Tasty
import Test.Tasty.HUnit
import Tests.Helpers
import Text.Pandoc
-import Text.Pandoc.UTF8 as UTF8
import qualified Text.Pandoc.Class as P
import Text.Pandoc.MediaBag (MediaBag, lookupMedia, mediaDirectory)
-import System.IO.Unsafe -- TODO temporary
+import Text.Pandoc.UTF8 as UTF8
-- We define a wrapper around pandoc that doesn't normalize in the
-- tests. Since we do our own normalization, we want to make sure
diff --git a/test/Tests/Readers/HTML.hs b/test/Tests/Readers/HTML.hs
index 00a8cfc90..70f33d2b2 100644
--- a/test/Tests/Readers/HTML.hs
+++ b/test/Tests/Readers/HTML.hs
@@ -1,12 +1,12 @@
{-# LANGUAGE OverloadedStrings #-}
module Tests.Readers.HTML (tests) where
+import Data.Text (Text)
import Test.Tasty
import Tests.Helpers
import Text.Pandoc
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
-import Data.Text (Text)
html :: Text -> Pandoc
html = purely $ readHtml def
diff --git a/test/Tests/Readers/LaTeX.hs b/test/Tests/Readers/LaTeX.hs
index ba9b8e289..99b49fd45 100644
--- a/test/Tests/Readers/LaTeX.hs
+++ b/test/Tests/Readers/LaTeX.hs
@@ -1,13 +1,13 @@
{-# LANGUAGE OverloadedStrings #-}
module Tests.Readers.LaTeX (tests) where
+import Data.Text (Text)
+import qualified Data.Text as T
import Test.Tasty
import Tests.Helpers
import Text.Pandoc
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
-import Data.Text (Text)
-import qualified Data.Text as T
latex :: Text -> Pandoc
latex = purely $ readLaTeX def{
diff --git a/test/Tests/Readers/Odt.hs b/test/Tests/Readers/Odt.hs
index eed3a33b0..4b7058cf9 100644
--- a/test/Tests/Readers/Odt.hs
+++ b/test/Tests/Readers/Odt.hs
@@ -1,15 +1,15 @@
module Tests.Readers.Odt (tests) where
import Control.Monad (liftM)
-import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString as BS
-import qualified Text.Pandoc.UTF8 as UTF8
+import qualified Data.ByteString.Lazy as B
import qualified Data.Map as M
import Data.Text (unpack)
+import System.IO.Unsafe (unsafePerformIO)
import Test.Tasty
import Tests.Helpers
import Text.Pandoc
-import System.IO.Unsafe (unsafePerformIO) -- TODO temporary
+import qualified Text.Pandoc.UTF8 as UTF8
defopts :: ReaderOptions
defopts = def{ readerExtensions = getDefaultExtensions "odt" }
diff --git a/test/Tests/Shared.hs b/test/Tests/Shared.hs
index 5ea8d7ee4..6fdbda3dd 100644
--- a/test/Tests/Shared.hs
+++ b/test/Tests/Shared.hs
@@ -2,7 +2,7 @@ module Tests.Shared (tests) where
import System.FilePath.Posix (joinPath)
import Test.Tasty
-import Test.Tasty.HUnit (assertBool, (@?=), testCase)
+import Test.Tasty.HUnit (assertBool, testCase, (@?=))
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
import Text.Pandoc.Shared
diff --git a/test/Tests/Writers/Docx.hs b/test/Tests/Writers/Docx.hs
index 9e6150abc..1537ea85d 100644
--- a/test/Tests/Writers/Docx.hs
+++ b/test/Tests/Writers/Docx.hs
@@ -1,18 +1,18 @@
module Tests.Writers.Docx (tests) where
+import qualified Data.ByteString as BS
import System.FilePath ((</>))
+import System.IO.Unsafe (unsafePerformIO)
import Test.Tasty
import Tests.Helpers
import Text.Pandoc.Class (runIOorExplode, setUserDataDir)
import Text.Pandoc.Definition
import Text.Pandoc.Options
-import Text.Pandoc.Walk
import Text.Pandoc.Readers.Docx
import Text.Pandoc.Readers.Native
-import Text.Pandoc.Writers.Docx
-import System.IO.Unsafe (unsafePerformIO) -- TODO temporary
-import qualified Data.ByteString as BS
import qualified Text.Pandoc.UTF8 as UTF8
+import Text.Pandoc.Walk
+import Text.Pandoc.Writers.Docx
type Options = (WriterOptions, ReaderOptions)
@@ -35,7 +35,7 @@ compareOutput (wopts, ropts) nativeFileIn nativeFileOut = do
-- different ghc versions...
fixImages :: Inline -> Inline
fixImages (Image attr alt (_,tit)) = Image attr alt ("image",tit)
-fixImages x = x
+fixImages x = x
testCompareWithOptsIO :: Options -> String -> FilePath -> FilePath -> IO TestTree
testCompareWithOptsIO opts name nativeFileIn nativeFileOut = do
diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs
index 5291a5ef0..e5c19c7bc 100644
--- a/test/Tests/Writers/Muse.hs
+++ b/test/Tests/Writers/Muse.hs
@@ -4,7 +4,7 @@ import Data.Text (unpack)
import Test.Tasty
import Tests.Helpers
import Text.Pandoc
-import Text.Pandoc.Arbitrary()
+import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
muse :: (ToPandoc a) => a -> String
diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs
index acfc4c5cd..358354e42 100644
--- a/test/test-pandoc.hs
+++ b/test/test-pandoc.hs
@@ -7,17 +7,17 @@ import Test.Tasty
import qualified Tests.Command
import qualified Tests.Lua
import qualified Tests.Old
+import qualified Tests.Readers.Creole
import qualified Tests.Readers.Docx
import qualified Tests.Readers.EPUB
import qualified Tests.Readers.HTML
import qualified Tests.Readers.LaTeX
import qualified Tests.Readers.Markdown
+import qualified Tests.Readers.Muse
import qualified Tests.Readers.Odt
import qualified Tests.Readers.Org
import qualified Tests.Readers.RST
import qualified Tests.Readers.Txt2Tags
-import qualified Tests.Readers.Muse
-import qualified Tests.Readers.Creole
import qualified Tests.Shared
import qualified Tests.Writers.AsciiDoc
import qualified Tests.Writers.ConTeXt
@@ -26,12 +26,12 @@ import qualified Tests.Writers.Docx
import qualified Tests.Writers.HTML
import qualified Tests.Writers.LaTeX
import qualified Tests.Writers.Markdown
+import qualified Tests.Writers.Muse
import qualified Tests.Writers.Native
import qualified Tests.Writers.Org
import qualified Tests.Writers.Plain
import qualified Tests.Writers.RST
import qualified Tests.Writers.TEI
-import qualified Tests.Writers.Muse
import Text.Pandoc.Shared (inDirectory)
tests :: TestTree