git.iko.soy/typeable/pandoc
on master help sign in
hlint code improvements.
commitb8ffd834cff717fe424f22e506351f2ecec4655a authorJohn MacFarlane <jgm@berkeley.edu> dateFri 19 Jan 2018, 21:25 (9 years ago) parent8b3707d
66 files changed+349−381
data/templates/default.ms+1−1 src/Text/Pandoc/Class.hs+3−3 src/Text/Pandoc/Filter.hs+1−1 src/Text/Pandoc/Lua.hs+1−1 src/Text/Pandoc/Lua/Packages.hs−1 src/Text/Pandoc/Lua/StackInstances.hs−1 src/Text/Pandoc/Parsing.hs+10−14 src/Text/Pandoc/Readers/Docx.hs+7−9 src/Text/Pandoc/Readers/Docx/Fields.hs+4−4 src/Text/Pandoc/Readers/Docx/Lists.hs+4−4 src/Text/Pandoc/Readers/Docx/Parse.hs+4−7 src/Text/Pandoc/Readers/HTML.hs+4−4 src/Text/Pandoc/Readers/JATS.hs−1 src/Text/Pandoc/Readers/LaTeX.hs+10−10 src/Text/Pandoc/Readers/Markdown.hs+28−30 src/Text/Pandoc/Readers/Muse.hs+1−1 src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs+2−2 src/Text/Pandoc/Readers/Odt/ContentReader.hs+9−10 src/Text/Pandoc/Readers/Odt/Namespaces.hs+1−1 src/Text/Pandoc/Readers/Odt/StyleReader.hs+20−23 src/Text/Pandoc/Readers/Org/Blocks.hs+1−1 src/Text/Pandoc/Readers/RST.hs+4−4 src/Text/Pandoc/Readers/Textile.hs+7−6 src/Text/Pandoc/Readers/TikiWiki.hs+7−7 src/Text/Pandoc/Readers/Txt2Tags.hs+2−2 src/Text/Pandoc/Readers/Vimwiki.hs+1−3 src/Text/Pandoc/Shared.hs+1−1 src/Text/Pandoc/Writers/AsciiDoc.hs+2−3 src/Text/Pandoc/Writers/Docx.hs+5−8 src/Text/Pandoc/Writers/FB2.hs+1−2 src/Text/Pandoc/Writers/HTML.hs+7−6 src/Text/Pandoc/Writers/Haddock.hs+1−2 src/Text/Pandoc/Writers/ICML.hs+2−2 src/Text/Pandoc/Writers/LaTeX.hs+4−4 src/Text/Pandoc/Writers/Man.hs+1−1 src/Text/Pandoc/Writers/Muse.hs+1−1 src/Text/Pandoc/Writers/OOXML.hs+1−1 src/Text/Pandoc/Writers/OpenDocument.hs+1−1 src/Text/Pandoc/Writers/Powerpoint.hs+1−1 src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+36−38 src/Text/Pandoc/Writers/RST.hs+7−8 src/Text/Pandoc/Writers/RTF.hs+4−4 src/Text/Pandoc/Writers/Texinfo.hs+1−1 test/Tests/Command.hs+3−3 test/Tests/Readers/Creole.hs+1−1 test/Tests/Readers/Docx.hs+5−6 test/Tests/Readers/EPUB.hs+1−1 test/Tests/Readers/Muse.hs+3−3 test/Tests/Readers/Org/Block/Header.hs+1−1 test/Tests/Readers/Org/Block/List.hs+9−9 test/Tests/Readers/Org/Directive.hs+2−2 test/Tests/Readers/Org/Inline.hs+30−29 test/Tests/Readers/Org/Inline/Note.hs−1 test/Tests/Readers/Org/Inline/Smart.hs+2−2 test/Tests/Readers/Org/Meta.hs+14−14 test/Tests/Readers/RST.hs+14−15 test/Tests/Readers/Txt2Tags.hs+4−4 test/Tests/Shared.hs+18−18 test/Tests/Writers/ConTeXt.hs+3−4 test/Tests/Writers/Docbook.hs+1−1 test/Tests/Writers/FB2.hs+1−1 test/Tests/Writers/JATS.hs−2 test/Tests/Writers/Markdown.hs+21−21 test/Tests/Writers/Native.hs+1−1 test/Tests/Writers/Powerpoint.hs+6−6 test/Tests/Writers/TEI.hs+1−1
data/templates/default.ms+1−1
@@ -40,8 +40,8 @@ $endif$
4040.nr FL \n[LL]
4141.\" footnote point size
4242.nr FPS (\n[PS] - 2000)
43−.\" paper size
4443$if(papersize)$
44+.\" paper size
4545.ds paper $papersize$
4646$endif$
4747.\" color used for strikeout
src/Text/Pandoc/Class.hs+3−3
@@ -142,11 +142,11 @@ import qualified System.Environment as IO (lookupEnv)
142142import System.FilePath.Glob (match, compile)
143143import System.Directory (createDirectoryIfMissing, getDirectoryContents,
144144 doesDirectoryExist)
145−import System.FilePath ((</>), (<.>), takeDirectory,
146− takeExtension, dropExtension, isRelative, normalise)
145+import System.FilePath
146+ ((</>), (<.>), takeDirectory, takeExtension, dropExtension,
147+ isRelative, normalise, splitDirectories)
147148import qualified System.FilePath.Glob as IO (glob)
148149import qualified System.FilePath.Posix as Posix
149−import System.FilePath (splitDirectories)
150150import qualified System.Directory as IO (getModificationTime)
151151import Control.Monad as M (fail)
152152import Control.Monad.State.Strict
src/Text/Pandoc/Filter.hs+1−1
@@ -51,7 +51,7 @@ applyFilters :: ReaderOptions
5151 -> [String]
5252 -> Pandoc
5353 -> PandocIO Pandoc
54−applyFilters ropts filters args d = do
54+applyFilters ropts filters args d =
5555 foldrM ($) d $ map applyFilter filters
5656 where
5757 applyFilter (JSONFilter f) = JSONFilter.apply ropts args f
src/Text/Pandoc/Lua.hs+1−1
@@ -65,7 +65,7 @@ runLuaFilter' ropts filterPath format pd = do
6565 newtop <- Lua.gettop
6666 -- Use the returned filters, or the implicitly defined global filter if
6767 -- nothing was returned.
68− luaFilters <- if (newtop - top >= 1)
68+ luaFilters <- if newtop - top >= 1
6969 then peek (-1)
7070 else Lua.getglobal "_G" *> fmap (:[]) popValue
7171 runAll luaFilters pd
src/Text/Pandoc/Lua/Packages.hs−1
@@ -113,4 +113,3 @@ dataDirScript datadir moduleFile = do
113113 return $ case res of
114114 Left _ -> Nothing
115115 Right s -> Just (unpack s)
116−
src/Text/Pandoc/Lua/StackInstances.hs−1
@@ -383,4 +383,3 @@ instance ToLuaStack ReaderOptions where
383383 LuaUtil.addValue "defaultImageExtension" defaultImageExtension
384384 LuaUtil.addValue "trackChanges" trackChanges
385385 LuaUtil.addValue "stripComments" stripComments
386−
src/Text/Pandoc/Parsing.hs+10−14
@@ -189,12 +189,12 @@ where
189189
190190import Control.Monad.Identity
191191import Control.Monad.Reader
192−import Data.Char (chr, isAlphaNum, isAscii, isAsciiUpper, isHexDigit, isPunctuation, isSpace,
193− ord, toLower, toUpper)
192+import Data.Char (chr, isAlphaNum, isAscii, isAsciiUpper, isHexDigit,
193+ isPunctuation, isSpace, ord, toLower, toUpper)
194194import Data.Default
195195import Data.List (intercalate, isSuffixOf, transpose)
196196import qualified Data.Map as M
197−import Data.Maybe (mapMaybe)
197+import Data.Maybe (mapMaybe, fromMaybe)
198198import Data.Monoid ((<>))
199199import qualified Data.Set as Set
200200import Data.Text (Text)
@@ -304,7 +304,7 @@ indentWith :: Stream s m Char
304304 => Int -> ParserT s st m [Char]
305305indentWith num = do
306306 tabStop <- getOption readerTabStop
307− if (num < tabStop)
307+ if num < tabStop
308308 then count num (char ' ')
309309 else choice [ try (count num (char ' '))
310310 , try (char '\t' >> indentWith (num - tabStop)) ]
@@ -573,7 +573,7 @@ uri = try $ do
573573 let uriChunk = skipMany1 wordChar
574574 <|> percentEscaped
575575 <|> entity
576− <|> (try $ punct >>
576+ <|> try (punct >>
577577 lookAhead (void (satisfy isWordChar) <|> percentEscaped))
578578 str <- snd <$> withRaw (skipMany1 ( () <$
579579 (enclosed (char '(') (char ')') uriChunk
@@ -755,7 +755,7 @@ romanOne = (char 'i' >> return (LowerRoman, 1)) <|>
755755
756756-- | Parses an ordered list marker and returns list attributes.
757757anyOrderedListMarker :: Stream s m Char => ParserT s ParserState m ListAttributes
758−anyOrderedListMarker = choice $
758+anyOrderedListMarker = choice
759759 [delimParser numParser | delimParser <- [inPeriod, inOneParen, inTwoParens],
760760 numParser <- [decimal, exampleNum, defaultNum, romanOne,
761761 lowerAlpha, lowerRoman, upperAlpha, upperRoman]]
@@ -896,7 +896,7 @@ widthsFromIndices numColumns' indices =
896896 quotient = if totLength > numColumns
897897 then fromIntegral totLength
898898 else fromIntegral numColumns
899− fracs = map (\l -> (fromIntegral l) / quotient) lengths in
899+ fracs = map (\l -> fromIntegral l / quotient) lengths in
900900 tail fracs
901901
902902---
@@ -977,7 +977,7 @@ gridTableHeader headless blocks = try $ do
977977 then replicate (length underDashes) ""
978978 else map (unlines . map trim) $ transpose
979979 $ map (gridTableSplitLine indices) rawContent
980− heads <- fmap sequence $ mapM (parseFromString blocks . trim) rawHeads
980+ heads <- sequence <$> mapM (parseFromString blocks . trim) rawHeads
981981 return (heads, aligns, indices)
982982
983983gridTableRawLine :: Stream s m Char => [Int] -> ParserT s st m [String]
@@ -1323,9 +1323,7 @@ failIfInQuoteContext :: (HasQuoteContext st m, Stream s m t)
13231323 -> ParserT s st m ()
13241324failIfInQuoteContext context = do
13251325 context' <- getQuoteContext
1326− if context' == context
1327− then fail "already inside quotes"
1328− else return ()
1326+ when (context' == context) $ fail "already inside quotes"
13291327
13301328charOrRef :: Stream s m Char => String -> ParserT s st m Char
13311329charOrRef cs =
@@ -1418,9 +1416,7 @@ a <+?> b = a >>= flip fmap (try b <|> return mempty) . (<>)
14181416extractIdClass :: Attr -> Attr
14191417extractIdClass (ident, cls, kvs) = (ident', cls', kvs')
14201418 where
1421− ident' = case lookup "id" kvs of
1422− Just v -> v
1423− Nothing -> ident
1419+ ident' = fromMaybe ident (lookup "id" kvs)
14241420 cls' = case lookup "class" kvs of
14251421 Just cl -> words cl
14261422 Nothing -> cls
src/Text/Pandoc/Readers/Docx.hs+7−9
@@ -81,7 +81,7 @@ import qualified Data.ByteString.Lazy as B
8181import Data.Default (Default)
8282import Data.List (delete, intersect)
8383import qualified Data.Map as M
84−import Data.Maybe (isJust)
84+import Data.Maybe (isJust, fromMaybe)
8585import Data.Sequence (ViewL (..), viewl)
8686import qualified Data.Sequence as Seq
8787import qualified Data.Set as Set
@@ -187,7 +187,7 @@ bodyPartsToMeta' :: PandocMonad m => [BodyPart] -> DocxContext m (M.Map String M
187187bodyPartsToMeta' [] = return M.empty
188188bodyPartsToMeta' (bp : bps)
189189 | (Paragraph pPr parParts) <- bp
190− , (c : _)<- intersect (pStyle pPr) (M.keys metaStyles)
190+ , (c : _)<- (pStyle pPr) `intersect` (M.keys metaStyles)
191191 , (Just metaField) <- M.lookup c metaStyles = do
192192 inlines <- smushInlines <$> mapM parPartToInlines parParts
193193 remaining <- bodyPartsToMeta' bps
@@ -340,7 +340,7 @@ blocksToInlinesWarn cmtId blks = do
340340 notParaOrPlain (Para _) = False
341341 notParaOrPlain (Plain _) = False
342342 notParaOrPlain _ = True
343− unless (null $ filter notParaOrPlain blkList) $
343+ unless ( not (any notParaOrPlain blkList)) $
344344 lift $ P.report $ DocxParserWarning $
345345 "Docx comment " ++ cmtId ++ " will not retain formatting"
346346 return $ blocksToInlines' blkList
@@ -351,7 +351,7 @@ blocksToInlinesWarn cmtId blks = do
351351parPartToInlines :: PandocMonad m => ParPart -> DocxContext m Inlines
352352parPartToInlines parPart =
353353 case parPart of
354− (BookMark _ anchor) | not $ anchor `elem` dummyAnchors -> do
354+ (BookMark _ anchor) | notElem anchor dummyAnchors -> do
355355 inHdrBool <- asks docxInHeaderBlock
356356 ils <- parPartToInlines' parPart
357357 immedPrevAnchor <- gets docxImmedPrevAnchor
@@ -444,9 +444,9 @@ parPartToInlines' (ExternalHyperLink target runs) = do
444444 return $ link target "" ils
445445parPartToInlines' (PlainOMath exps) =
446446 return $ math $ writeTeX exps
447−parPartToInlines' (SmartTag runs) = do
447+parPartToInlines' (SmartTag runs) =
448448 smushInlines <$> mapM runToInlines runs
449−parPartToInlines' (Field info runs) = do
449+parPartToInlines' (Field info runs) =
450450 case info of
451451 HyperlinkField url -> parPartToInlines' $ ExternalHyperLink url runs
452452 UnknownField -> smushInlines <$> mapM runToInlines runs
@@ -626,9 +626,7 @@ bodyPartToBlocks (ListItem pPr numId lvl (Just levelInfo) parparts) = do
626626 (_, fmt,txt, startFromLevelInfo) = levelInfo
627627 start = case startFromState of
628628 Just n -> n + 1
629− Nothing -> case startFromLevelInfo of
630− Just n' -> n'
631− Nothing -> 1
629+ Nothing -> fromMaybe 1 startFromLevelInfo
632630 kvs = [ ("level", lvl)
633631 , ("num-id", numId)
634632 , ("format", fmt)
src/Text/Pandoc/Readers/Docx/Fields.hs+4−4
@@ -46,7 +46,7 @@ parseFieldInfo = parse fieldInfo ""
4646
4747fieldInfo :: Parser FieldInfo
4848fieldInfo =
49− (try $ HyperlinkField <$> hyperlink)
49+ try (HyperlinkField <$> hyperlink)
5050 <|>
5151 return UnknownField
5252
@@ -54,7 +54,7 @@ escapedQuote :: Parser String
5454escapedQuote = string "\\\""
5555
5656inQuotes :: Parser String
57−inQuotes = do
57+inQuotes =
5858 (try escapedQuote) <|> (anyChar >>= (\c -> return [c]))
5959
6060quotedString :: Parser String
@@ -63,7 +63,7 @@ quotedString = do
6363 concat <$> manyTill inQuotes (try (char '"'))
6464
6565unquotedString :: Parser String
66−unquotedString = manyTill anyChar (try (space))
66+unquotedString = manyTill anyChar (try space)
6767
6868fieldArgument :: Parser String
6969fieldArgument = quotedString <|> unquotedString
@@ -82,7 +82,7 @@ hyperlink = do
8282 string "HYPERLINK"
8383 spaces
8484 farg <- fieldArgument
85− switches <- (spaces *> many hyperlinkSwitch)
85+ switches <- spaces *> many hyperlinkSwitch
8686 let url = case switches of
8787 ("\\l", s) : _ -> farg ++ ('#': s)
8888 _ -> farg
src/Text/Pandoc/Readers/Docx/Lists.hs+4−4
@@ -44,14 +44,14 @@ isListItem (Div (_, classes, _) _) | "list-item" `elem` classes = True
4444isListItem _ = False
4545
4646getLevel :: Block -> Maybe Integer
47−getLevel (Div (_, _, kvs) _) = fmap read $ lookup "level" kvs
47+getLevel (Div (_, _, kvs) _) = read <$> lookup "level" kvs
4848getLevel _ = Nothing
4949
5050getLevelN :: Block -> Integer
5151getLevelN b = fromMaybe (-1) (getLevel b)
5252
5353getNumId :: Block -> Maybe Integer
54−getNumId (Div (_, _, kvs) _) = fmap read $ lookup "num-id" kvs
54+getNumId (Div (_, _, kvs) _) = read <$> lookup "num-id" kvs
5555getNumId _ = Nothing
5656
5757getNumIdN :: Block -> Integer
@@ -140,8 +140,8 @@ flatToBullets' num xs@(b : elems)
140140 (children, remaining) =
141141 span
142142 (\b' ->
143− (getLevelN b') > bLevel ||
144− ((getLevelN b') == bLevel && (getNumIdN b') == bNumId))
143+ getLevelN b' > bLevel ||
144+ (getLevelN b' == bLevel && getNumIdN b' == bNumId))
145145 xs
146146 in
147147 case getListType b of
src/Text/Pandoc/Readers/Docx/Parse.hs+4−7
@@ -358,9 +358,7 @@ archiveToDocument zf = do
358358 docElem <- maybeToD $ (parseXMLDoc . UTF8.toStringLazy . fromEntry) entry
359359 let namespaces = elemToNameSpaces docElem
360360 bodyElem <- maybeToD $ findChildByName namespaces "w" "body" docElem
361− let bodyElem' = case walkDocument namespaces bodyElem of
362− Just e -> e
363− Nothing -> bodyElem
361+ let bodyElem' = fromMaybe bodyElem (walkDocument namespaces bodyElem)
364362 body <- elemToBody namespaces bodyElem'
365363 return $ Document namespaces body
366364
@@ -603,7 +601,7 @@ elemToTblLook ns element | isElem ns "w" "tblLook" element =
603601 Just bitMask -> testBitMask bitMask 0x020
604602 Nothing -> False
605603 in
606− return $ TblLook{firstRowFormatting = firstRowFmt}
604+ return TblLook{firstRowFormatting = firstRowFmt}
607605elemToTblLook _ _ = throwError WrongElem
608606
609607elemToRow :: NameSpaces -> Element -> D Row
@@ -623,7 +621,7 @@ elemToCell _ _ = throwError WrongElem
623621
624622elemToParIndentation :: NameSpaces -> Element -> Maybe ParIndentation
625623elemToParIndentation ns element | isElem ns "w" "ind" element =
626− Just $ ParIndentation {
624+ Just ParIndentation {
627625 leftParIndent =
628626 findAttrByName ns "w" "left" element >>=
629627 stringToInteger
@@ -1173,8 +1171,7 @@ elemToRunElems ns element
11731171 let font = do
11741172 fontElem <- findElement (qualName "rFonts") element
11751173 stringToFont =<<
1176− foldr (<|>) Nothing (
1177− map (flip findAttr fontElem . qualName) ["ascii", "hAnsi"])
1174+ foldr ((<|>) . (flip findAttr fontElem . qualName)) Nothing ["ascii", "hAnsi"]
11781175 local (setFont font) (mapD (elemToRunElem ns) (elChildren element))
11791176elemToRunElems _ _ = throwError WrongElem
11801177
src/Text/Pandoc/Readers/HTML.hs+4−4
@@ -43,14 +43,14 @@ module Text.Pandoc.Readers.HTML ( readHtml
4343 ) where
4444
4545import Control.Applicative ((<|>))
46−import Control.Arrow ((***))
46+import Control.Arrow (first)
4747import Control.Monad (guard, mplus, msum, mzero, unless, void)
4848import Control.Monad.Except (throwError)
4949import Control.Monad.Reader (ReaderT, ask, asks, lift, local, runReaderT)
5050import Data.Char (isAlphaNum, isDigit, isLetter)
5151import Data.Default (Default (..), def)
5252import Data.Foldable (for_)
53−import Data.List (intercalate, isPrefixOf)
53+import Data.List (isPrefixOf)
5454import Data.List.Split (wordsBy, splitWhen)
5555import qualified Data.Map as M
5656import Data.Maybe (fromMaybe, isJust, isNothing)
@@ -777,7 +777,7 @@ pCode = try $ do
777777 (TagOpen open attr') <- pSatisfy $ tagOpen (`elem` ["code","tt"]) (const True)
778778 let attr = toStringAttr attr'
779779 result <- manyTill pAnyTag (pCloses open)
780− return $ B.codeWith (mkAttr attr) $ intercalate " " $ lines $ T.unpack $
780+ return $ B.codeWith (mkAttr attr) $ unwords $ lines $ T.unpack $
781781 innerText result
782782
783783pSpan :: PandocMonad m => TagParser m Inlines
@@ -1227,7 +1227,7 @@ stripPrefixes = map stripPrefix
12271227
12281228stripPrefix :: Tag Text -> Tag Text
12291229stripPrefix (TagOpen s as) =
1230− TagOpen (stripPrefix' s) (map (stripPrefix' *** id) as)
1230+ TagOpen (stripPrefix' s) (map (first stripPrefix') as)
12311231stripPrefix (TagClose s) = TagClose (stripPrefix' s)
12321232stripPrefix x = x
12331233
src/Text/Pandoc/Readers/JATS.hs−1
@@ -494,4 +494,3 @@ parseInline (Elem e) =
494494 "" -> []
495495 l -> [l]
496496 return $ codeWith (attrValue "id" e,classes',[]) $ strContentRecursive e
497−
src/Text/Pandoc/Readers/LaTeX.hs+10−10
@@ -272,7 +272,7 @@ rawLaTeXBlock = do
272272 lookAhead (try (char '\\' >> letter))
273273 -- we don't want to apply newly defined latex macros to their own
274274 -- definitions:
275− (snd <$> rawLaTeXParser macroDef)
275+ snd <$> rawLaTeXParser macroDef
276276 <|> ((snd <$> rawLaTeXParser (environment <|> blockCommand)) >>= applyMacros)
277277
278278rawLaTeXInline :: (PandocMonad m, HasMacros s, HasReaderOptions s)
@@ -351,7 +351,7 @@ totoks pos t =
351351 Tok pos (Arg i) ("#" <> t1)
352352 : totoks (incSourceColumn pos (1 + T.length t1)) t2
353353 Nothing ->
354− Tok pos Symbol ("#")
354+ Tok pos Symbol "#"
355355 : totoks (incSourceColumn pos 1) t2
356356 | c == '^' ->
357357 case T.uncons rest of
@@ -369,10 +369,10 @@ totoks pos t =
369369 | d < '\128' ->
370370 Tok pos Esc1 (T.pack ['^','^',d])
371371 : totoks (incSourceColumn pos 3) rest''
372− _ -> Tok pos Symbol ("^") :
373− Tok (incSourceColumn pos 1) Symbol ("^") :
372+ _ -> Tok pos Symbol "^" :
373+ Tok (incSourceColumn pos 1) Symbol "^" :
374374 totoks (incSourceColumn pos 2) rest'
375− _ -> Tok pos Symbol ("^")
375+ _ -> Tok pos Symbol "^"
376376 : totoks (incSourceColumn pos 1) rest
377377 | otherwise ->
378378 Tok pos Symbol (T.singleton c) : totoks (incSourceColumn pos 1) rest
@@ -454,7 +454,7 @@ doMacros n = do
454454 addTok _ (Tok _ (CtrlSeq x) txt)
455455 acc@(Tok _ Word _ : _)
456456 | not (T.null txt) &&
457− (isLetter (T.last txt)) =
457+ isLetter (T.last txt) =
458458 Tok spos (CtrlSeq x) (txt <> " ") : acc
459459 addTok _ t acc = setpos spos t : acc
460460 ts' <- getInput
@@ -1244,7 +1244,7 @@ inlineEnvironments = M.fromList [
12441244 ]
12451245
12461246inlineCommands :: PandocMonad m => M.Map Text (LP m Inlines)
1247−inlineCommands = M.union inlineLanguageCommands $ M.fromList $
1247+inlineCommands = M.union inlineLanguageCommands $ M.fromList
12481248 [ ("emph", extractSpaces emph <$> tok)
12491249 , ("textit", extractSpaces emph <$> tok)
12501250 , ("textsl", extractSpaces emph <$> tok)
@@ -1501,7 +1501,7 @@ foreignlanguage :: PandocMonad m => LP m Inlines
15011501foreignlanguage = do
15021502 babelLang <- T.unpack . untokenize <$> braced
15031503 case babelLangToBCP47 babelLang of
1504− Just lang -> spanWith ("", [], [("lang", renderLang $ lang)]) <$> tok
1504+ Just lang -> spanWith ("", [], [("lang", renderLang lang)]) <$> tok
15051505 _ -> tok
15061506
15071507inlineLanguageCommands :: PandocMonad m => M.Map Text (LP m Inlines)
@@ -2021,7 +2021,7 @@ closing = do
20212021 return $ para (trimInlines contents) <> sigs
20222022
20232023blockCommands :: PandocMonad m => M.Map Text (LP m Blocks)
2024−blockCommands = M.fromList $
2024+blockCommands = M.fromList
20252025 [ ("par", mempty <$ skipopts)
20262026 , ("parbox", skipopts >> braced >> grouped blocks)
20272027 , ("title", mempty <$ (skipopts *>
@@ -2444,7 +2444,7 @@ parseAligns = try $ do
24442444 spaces
24452445 spec <- braced
24462446 case safeRead ds of
2447− Just n -> do
2447+ Just n ->
24482448 getInput >>= setInput . (mconcat (replicate n spec) ++)
24492449 Nothing -> fail $ "Could not parse " ++ ds ++ " as number"
24502450 bgroup
src/Text/Pandoc/Readers/Markdown.hs+28−30
@@ -36,7 +36,7 @@ import Control.Monad
3636import Control.Monad.Except (throwError)
3737import Data.Char (isAlphaNum, isPunctuation, isSpace, toLower)
3838import qualified Data.HashMap.Strict as H
39−import Data.List (findIndex, intercalate, sortBy, transpose)
39+import Data.List (intercalate, sortBy, transpose, elemIndex)
4040import qualified Data.Map as M
4141import Data.Maybe
4242import Data.Monoid ((<>))
@@ -162,16 +162,14 @@ inlinesInBalancedBrackets =
162162 stripBracket xs = if last xs == ']' then init xs else xs
163163 go :: PandocMonad m => Int -> MarkdownParser m ()
164164 go 0 = return ()
165− go openBrackets = do
165+ go openBrackets =
166166 (() <$ (escapedChar <|>
167− code <|>
168− rawHtmlInline <|>
169− rawLaTeXInline') >> go openBrackets)
167+ code <|>
168+ rawHtmlInline <|>
169+ rawLaTeXInline') >> go openBrackets)
170170 <|>
171171 (do char ']'
172− if openBrackets > 1
173− then go (openBrackets - 1)
174− else return ())
172+ Control.Monad.when (openBrackets > 1) $ go (openBrackets - 1))
175173 <|>
176174 (char '[' >> go (openBrackets + 1))
177175 <|>
@@ -257,13 +255,13 @@ yamlMetaBlock = try $ do
257255 v' <- yamlToMeta v
258256 let k' = T.unpack k
259257 updateState $ \st -> st{ stateMeta' =
260− (do m <- stateMeta' st
261− -- if there's already a value, leave it unchanged
262− case lookupMeta k' m of
263− Just _ -> return m
264− Nothing -> do
265− v'' <- v'
266− return $ B.setMeta (T.unpack k) v'' m)}
258+ do m <- stateMeta' st
259+ -- if there's already a value, leave it unchanged
260+ case lookupMeta k' m of
261+ Just _ -> return m
262+ Nothing -> do
263+ v'' <- v'
264+ return $ B.setMeta (T.unpack k) v'' m}
267265 ) alist
268266 Right Yaml.Null -> return ()
269267 Right _ -> do
@@ -596,7 +594,7 @@ setextHeader = try $ do
596594 underlineChar <- oneOf setextHChars
597595 many (char underlineChar)
598596 blanklines
599− let level = fromMaybe 0 (findIndex (== underlineChar) setextHChars) + 1
597+ let level = fromMaybe 0 (elemIndex underlineChar setextHChars) + 1
600598 attr' <- registerHeader attr (runF text defaultParserState)
601599 guardDisabled Ext_implicit_header_references
602600 <|> registerImplicitHeader raw attr'
@@ -851,7 +849,7 @@ orderedListStart mbstydelim = try $ do
851849 return (num, style, delim))
852850
853851listStart :: PandocMonad m => MarkdownParser m ()
854−listStart = bulletListStart <|> (Control.Monad.void (orderedListStart Nothing))
852+listStart = bulletListStart <|> Control.Monad.void (orderedListStart Nothing)
855853
856854listLine :: PandocMonad m => Int -> MarkdownParser m String
857855listLine continuationIndent = try $ do
@@ -881,7 +879,7 @@ rawListItem fourSpaceRule start = try $ do
881879 pos2 <- getPosition
882880 let continuationIndent = if fourSpaceRule
883881 then 4
884− else (sourceColumn pos2 - sourceColumn pos1)
882+ else sourceColumn pos2 - sourceColumn pos1
885883 first <- listLineCommon
886884 rest <- many (do notFollowedBy listStart
887885 notFollowedBy (() <$ codeBlockFenced)
@@ -912,10 +910,10 @@ listContinuation continuationIndent = try $ do
912910 return $ concat (x:xs) ++ blanks
913911
914912notFollowedByDivCloser :: PandocMonad m => MarkdownParser m ()
915−notFollowedByDivCloser = do
913+notFollowedByDivCloser =
916914 guardDisabled Ext_fenced_divs <|>
917− do divLevel <- stateFencedDivLevel <$> getState
918− guard (divLevel < 1) <|> notFollowedBy divFenceEnd
915+ do divLevel <- stateFencedDivLevel <$> getState
916+ guard (divLevel < 1) <|> notFollowedBy divFenceEnd
919917
920918notFollowedByHtmlCloser :: PandocMonad m => MarkdownParser m ()
921919notFollowedByHtmlCloser = do
@@ -1222,7 +1220,7 @@ simpleTableHeader headless = try $ do
12221220 if headless
12231221 then lookAhead anyLine
12241222 else return rawContent
1225− let aligns = zipWith alignType (map ((: [])) rawHeads) lengths
1223+ let aligns = zipWith alignType (map (: []) rawHeads) lengths
12261224 let rawHeads' = if headless
12271225 then replicate (length dashes) ""
12281226 else rawHeads
@@ -1418,11 +1416,11 @@ pipeTableHeaderPart = try $ do
14181416 skipMany spaceChar
14191417 let len = length pipe + maybe 0 (const 1) left + maybe 0 (const 1) right
14201418 return
1421− ((case (left,right) of
1422− (Nothing,Nothing) -> AlignDefault
1423− (Just _,Nothing) -> AlignLeft
1424− (Nothing,Just _) -> AlignRight
1425− (Just _,Just _) -> AlignCenter), len)
1419+ (case (left,right) of
1420+ (Nothing,Nothing) -> AlignDefault
1421+ (Just _,Nothing) -> AlignLeft
1422+ (Nothing,Just _) -> AlignRight
1423+ (Just _,Just _) -> AlignCenter, len)
14261424
14271425-- Succeed only if current line contains a pipe.
14281426scanForPipe :: PandocMonad m => ParserT [Char] st m ()
@@ -1929,7 +1927,7 @@ rawConTeXtEnvironment = try $ do
19291927 (try $ string "\\stop" >> string completion)
19301928 return $ "\\start" ++ completion ++ concat contents ++ "\\stop" ++ completion
19311929
1932−inBrackets :: PandocMonad m => (ParserT [Char] st m Char) -> ParserT [Char] st m String
1930+inBrackets :: PandocMonad m => ParserT [Char] st m Char -> ParserT [Char] st m String
19331931inBrackets parser = do
19341932 char '['
19351933 contents <- many parser
@@ -2150,6 +2148,6 @@ doubleQuoted :: PandocMonad m => MarkdownParser m (F Inlines)
21502148doubleQuoted = try $ do
21512149 doubleQuoteStart
21522150 contents <- mconcat <$> many (try $ notFollowedBy doubleQuoteEnd >> inline)
2153− (withQuoteContext InDoubleQuote $ doubleQuoteEnd >> return
2151+ withQuoteContext InDoubleQuote (doubleQuoteEnd >> return
21542152 (fmap B.doubleQuoted . trimInlinesF $ contents))
2155− <|> (return $ return (B.str "\8220") <> contents)
2153+ <|> return (return (B.str "\8220") <> contents)
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -482,7 +482,7 @@ definitionList :: PandocMonad m => MuseParser m (F Blocks)
482482definitionList = try $ do
483483 many spaceChar
484484 pos <- getPosition
485− (guardDisabled Ext_amuse) <|> (guard (sourceColumn pos /= 1)) -- Initial space is required by Amusewiki, but not Emacs Muse
485+ guardDisabled Ext_amuse <|> guard (sourceColumn pos /= 1) -- Initial space is required by Amusewiki, but not Emacs Muse
486486 first <- definitionListItem 0
487487 rest <- many $ try (optionMaybe blankline >> definitionListItem (sourceColumn pos - 1))
488488 return $ B.definitionList <$> sequence (first : rest)
src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs+2−2
@@ -211,9 +211,9 @@ a ^>>?% f = arr a >>?^ (uncurry f)
211211---
212212(>>?%?) :: (ArrowChoice a)
213213 => FallibleArrow a x f (b,b')
214− -> (b -> b' -> (Either f c))
214+ -> (b -> b' -> Either f c)
215215 -> FallibleArrow a x f c
216−a >>?%? f = a >>?^? (uncurry f)
216+a >>?%? f = a >>?^? uncurry f
217217
218218infixr 1 >>?, >>?^, >>?^?
219219infixr 1 ^>>?, >>?!
src/Text/Pandoc/Readers/Odt/ContentReader.hs+9−10
@@ -322,7 +322,7 @@ type InlineModifier = Inlines -> Inlines
322322modifierFromStyleDiff :: PropertyTriple -> InlineModifier
323323modifierFromStyleDiff propertyTriple =
324324 composition $
325− (getVPosModifier propertyTriple)
325+ getVPosModifier propertyTriple
326326 : map (first ($ propertyTriple) >>> ifThen_else ignore)
327327 [ (hasEmphChanged , emph )
328328 , (hasChanged isStrong , strong )
@@ -352,7 +352,7 @@ modifierFromStyleDiff propertyTriple =
352352 ]
353353
354354 hasChanged property triple@(_, property -> newProperty, _) =
355− maybe True (/=newProperty) (lookupPreviousValue property triple)
355+ (/= Just newProperty) (lookupPreviousValue property triple)
356356
357357 hasChangedM property triple@(_, textProps,_) =
358358 fromMaybe False $ (/=) <$> property textProps <*> lookupPreviousValueM property triple
@@ -362,7 +362,7 @@ modifierFromStyleDiff propertyTriple =
362362 lookupPreviousValueM f = lookupPreviousStyleValue ((f =<<).textProperties)
363363
364364 lookupPreviousStyleValue f (ReaderState{..},_,mFamily)
365− = ( findBy f $ extendedStylePropertyChain styleTrace styleSet )
365+ = findBy f (extendedStylePropertyChain styleTrace styleSet)
366366 <|> ( f =<< fmap (lookupDefaultStyle' styleSet) mFamily )
367367
368368
@@ -793,8 +793,7 @@ read_image_src = matchingElement NsDraw "image"
793793 Left _ -> returnV "" -< ()
794794
795795read_frame_title :: InlineMatcher
796−read_frame_title = matchingElement NsSVG "title"
797− $ (matchChildContent [] read_plain_text)
796+read_frame_title = matchingElement NsSVG "title" (matchChildContent [] read_plain_text)
798797
799798read_frame_text_box :: InlineMatcher
800799read_frame_text_box = matchingElement NsDraw "text-box"
@@ -803,12 +802,12 @@ read_frame_text_box = matchingElement NsDraw "text-box"
803802 arr read_img_with_caption -< toList paragraphs
804803
805804read_img_with_caption :: [Block] -> Inlines
806−read_img_with_caption ((Para [Image attr alt (src,title)]) : _) =
805+read_img_with_caption (Para [Image attr alt (src,title)] : _) =
807806 singleton (Image attr alt (src, 'f':'i':'g':':':title)) -- no text, default caption
808807read_img_with_caption (Para (Image attr _ (src,title) : txt) : _) =
809808 singleton (Image attr txt (src, 'f':'i':'g':':':title) ) -- override caption with the text that follows
810−read_img_with_caption ( (Para (_ : xs)) : ys) =
811− read_img_with_caption ((Para xs) : ys)
809+read_img_with_caption ( Para (_ : xs) : ys) =
810+ read_img_with_caption (Para xs : ys)
812811read_img_with_caption _ =
813812 mempty
814813
@@ -909,8 +908,8 @@ post_process (Pandoc m blocks) =
909908 Pandoc m (post_process' blocks)
910909
911910post_process' :: [Block] -> [Block]
912−post_process' ((Table _ a w h r) : (Div ("", ["caption"], _) [Para inlines] ) : xs) =
913− (Table inlines a w h r) : ( post_process' xs )
911+post_process' (Table _ a w h r : Div ("", ["caption"], _) [Para inlines] : xs) =
912+ Table inlines a w h r : post_process' xs
914913post_process' bs = bs
915914
916915read_body :: OdtReader _x (Pandoc, MediaBag)
src/Text/Pandoc/Readers/Odt/Namespaces.hs+1−1
@@ -48,7 +48,7 @@ instance NameSpaceID Namespace where
4848
4949
5050findID :: NameSpaceIRI -> Maybe Namespace
51−findID iri = listToMaybe [nsID | (iri',~nsID) <- nsIDs, iri' `isPrefixOf` iri]
51+findID iri = listToMaybe [nsID | (iri',nsID) <- nsIDs, iri' `isPrefixOf` iri]
5252
5353nsIDmap :: NameSpaceIRIs Namespace
5454nsIDmap = foldr (uncurry $ flip M.insert) M.empty nsIDs
src/Text/Pandoc/Readers/Odt/StyleReader.hs+20−23
@@ -131,13 +131,12 @@ type StyleReaderSafe a b = XMLReaderSafe FontPitches a b
131131-- | A reader for font pitches
132132fontPitchReader :: XMLReader _s _x FontPitches
133133fontPitchReader = executeIn NsOffice "font-face-decls" (
134− ( withEveryL NsStyle "font-face" $ liftAsSuccess (
134+ withEveryL NsStyle "font-face" (liftAsSuccess (
135135 findAttr' NsStyle "name"
136136 &&&
137137 lookupDefaultingAttr NsStyle "font-pitch"
138− )
139− )
140− >>?^ ( M.fromList . (foldl accumLegalPitches []) )
138+ ))
139+ >>?^ ( M.fromList . foldl accumLegalPitches [] )
141140 )
142141 where accumLegalPitches ls (Nothing,_) = ls
143142 accumLegalPitches ls (Just n,p) = (n,p):ls
@@ -383,11 +382,11 @@ data ListLevelStyle = ListLevelStyle { listLevelType :: ListLevelType
383382
384383instance Show ListLevelStyle where
385384 show ListLevelStyle{..} = "<LLS|"
386− ++ (show listLevelType)
385+ ++ show listLevelType
387386 ++ "|"
388− ++ (maybeToString listItemPrefix)
389− ++ (show listItemFormat)
390− ++ (maybeToString listItemSuffix)
387+ ++ maybeToString listItemPrefix
388+ ++ show listItemFormat
389+ ++ maybeToString listItemSuffix
391390 ++ ">"
392391 where maybeToString = fromMaybe ""
393392
@@ -483,14 +482,14 @@ readTextProperties =
483482 ( liftA6 PropT
484483 ( searchAttr NsXSL_FO "font-style" False isFontEmphasised )
485484 ( searchAttr NsXSL_FO "font-weight" False isFontBold )
486− ( findPitch )
485+ findPitch
487486 ( getAttr NsStyle "text-position" )
488− ( readUnderlineMode )
489− ( readStrikeThroughMode )
487+ readUnderlineMode
488+ readStrikeThroughMode
490489 )
491490 where isFontEmphasised = [("normal",False),("italic",True),("oblique",True)]
492491 isFontBold = ("normal",False):("bold",True)
493− :(map ((,True).show) ([100,200..900]::[Int]))
492+ :map ((,True).show) ([100,200..900]::[Int])
494493
495494readUnderlineMode :: StyleReaderSafe _x (Maybe UnderlineMode)
496495readUnderlineMode = readLineMode "text-underline-mode"
@@ -510,7 +509,7 @@ readLineMode modeAttr styleAttr = proc x -> do
510509 Nothing -> returnA -< Just UnderlineModeNormal
511510 else returnA -< Nothing
512511 where
513− isLinePresent = [("none",False)] ++ map (,True)
512+ isLinePresent = ("none",False) : map (,True)
514513 [ "dash" , "dot-dash" , "dot-dot-dash" , "dotted"
515514 , "long-dash" , "solid" , "wave"
516515 ]
@@ -547,20 +546,18 @@ readListStyle =
547546 findAttr NsStyle "name"
548547 >>?! keepingTheValue
549548 ( liftA ListStyle
550− $ ( liftA3 SM.union3
549+ $ liftA3 SM.union3
551550 ( readListLevelStyles NsText "list-level-style-number" LltNumbered )
552551 ( readListLevelStyles NsText "list-level-style-bullet" LltBullet )
553− ( readListLevelStyles NsText "list-level-style-image" LltImage )
554− ) >>^ M.mapMaybe chooseMostSpecificListLevelStyle
552+ ( readListLevelStyles NsText "list-level-style-image" LltImage ) >>^ M.mapMaybe chooseMostSpecificListLevelStyle
555553 )
556554--
557555readListLevelStyles :: Namespace -> ElementName
558556 -> ListLevelType
559557 -> StyleReaderSafe _x (SM.SetMap Int ListLevelStyle)
560558readListLevelStyles namespace elementName levelType =
561− ( tryAll namespace elementName (readListLevelStyle levelType)
559+ tryAll namespace elementName (readListLevelStyle levelType)
562560 >>^ SM.fromList
563− )
564561
565562--
566563readListLevelStyle :: ListLevelType -> StyleReader _x (Int, ListLevelStyle)
@@ -632,7 +629,7 @@ parents style styles = unfoldr findNextParent style -- Ha!
632629getStyleFamily :: Style -> Styles -> Maybe StyleFamily
633630getStyleFamily style@Style{..} styles
634631 = styleFamily
635− <|> (F.asum $ map (`getStyleFamily` styles) $ parents style styles)
632+ <|> F.asum (map (`getStyleFamily` styles) $ parents style styles)
636633
637634-- | Each 'Style' has certain 'StyleProperties'. But sometimes not all property
638635-- values are specified. Instead, a value might be inherited from a
@@ -654,7 +651,7 @@ stylePropertyChain style styles
654651--
655652extendedStylePropertyChain :: [Style] -> Styles -> [StyleProperties]
656653extendedStylePropertyChain [] _ = []
657−extendedStylePropertyChain [style] styles = (stylePropertyChain style styles)
658− ++ (maybeToList (fmap (lookupDefaultStyle' styles) (getStyleFamily style styles)))
659−extendedStylePropertyChain (style:trace) styles = (stylePropertyChain style styles)
660− ++ (extendedStylePropertyChain trace styles)
654+extendedStylePropertyChain [style] styles = stylePropertyChain style styles
655+ ++ maybeToList (fmap (lookupDefaultStyle' styles) (getStyleFamily style styles))
656+extendedStylePropertyChain (style:trace) styles = stylePropertyChain style styles
657+ ++ extendedStylePropertyChain trace styles
src/Text/Pandoc/Readers/Org/Blocks.hs+1−1
@@ -516,7 +516,7 @@ include = try $ do
516516 blocksParser <- case includeArgs of
517517 ("example" : _) -> return $ pure . B.codeBlock <$> parseRaw
518518 ["export"] -> return . returnF $ B.fromList []
519− ("export" : format : []) -> return $ pure . B.rawBlock format <$> parseRaw
519+ ["export", format] -> return $ pure . B.rawBlock format <$> parseRaw
520520 ("src" : rest) -> do
521521 let attr = case rest of
522522 [lang] -> (mempty, [lang], mempty)
src/Text/Pandoc/Readers/RST.hs+4−4
@@ -1263,7 +1263,7 @@ simpleTableHeader headless = try $ do
12631263 let rawHeads = if headless
12641264 then replicate (length dashes) ""
12651265 else simpleTableSplitLine indices rawContent
1266− heads <- mapM ( (parseFromString' (mconcat <$> many plain)) . trim) rawHeads
1266+ heads <- mapM ( parseFromString' (mconcat <$> many plain) . trim) rawHeads
12671267 return (heads, aligns, indices)
12681268
12691269-- Parse a simple table.
@@ -1414,7 +1414,7 @@ renderRole contents fmt role attr = case role of
14141414 pepUrl = "http://www.python.org/dev/peps/pep-" ++ padNo ++ "/"
14151415
14161416addClass :: String -> Attr -> Attr
1417−addClass c (ident, classes, keyValues) = (ident, union classes [c], keyValues)
1417+addClass c (ident, classes, keyValues) = (ident, classes `union` [c], keyValues)
14181418
14191419roleName :: PandocMonad m => RSTParser m String
14201420roleName = many1 (letter <|> char '-')
@@ -1454,7 +1454,7 @@ endline = try $ do
14541454 notFollowedBy blankline
14551455 -- parse potential list-starts at beginning of line differently in a list:
14561456 st <- getState
1457− when ((stateParserContext st) == ListItemState) $ notFollowedBy (anyOrderedListMarker >> spaceChar) >>
1457+ when (stateParserContext st == ListItemState) $ notFollowedBy (anyOrderedListMarker >> spaceChar) >>
14581458 notFollowedBy' bulletListStart
14591459 return B.softbreak
14601460
@@ -1577,7 +1577,7 @@ note = try $ do
15771577 -- not yet in this implementation.
15781578 updateState $ \st -> st{ stateNotes = [] }
15791579 contents <- parseFromString' parseBlocks raw
1580− let newnotes = if (ref == "*" || ref == "#") -- auto-numbered
1580+ let newnotes = if ref == "*" || ref == "#" -- auto-numbered
15811581 -- delete the note so the next auto-numbered note
15821582 -- doesn't get the same contents:
15831583 then deleteFirstsBy (==) notes [(ref,raw)]
src/Text/Pandoc/Readers/Textile.hs+7−6
@@ -110,7 +110,7 @@ noteBlock = try $ do
110110 startPos <- getPosition
111111 ref <- noteMarker
112112 optional blankline
113− contents <- fmap unlines $ many1Till anyLine (blanklines <|> noteBlock)
113+ contents <- unlines <$> many1Till anyLine (blanklines <|> noteBlock)
114114 endPos <- getPosition
115115 let newnote = (ref, contents ++ "\n")
116116 st <- getState
@@ -360,7 +360,7 @@ cellAttributes = try $ do
360360tableCell :: PandocMonad m => ParserT [Char] ParserState m ((Bool, Alignment), Blocks)
361361tableCell = try $ do
362362 char '|'
363− (isHeader, alignment) <- option (False, AlignDefault) $ cellAttributes
363+ (isHeader, alignment) <- option (False, AlignDefault) cellAttributes
364364 notFollowedBy blankline
365365 raw <- trim <$>
366366 many (noneOf "|\n" <|> try (char '\n' <* notFollowedBy blankline))
@@ -499,7 +499,7 @@ copy = do
499499
500500note :: PandocMonad m => ParserT [Char] ParserState m Inlines
501501note = try $ do
502− ref <- (char '[' *> many1 digit <* char ']')
502+ ref <- char '[' *> many1 digit <* char ']'
503503 notes <- stateNotes <$> getState
504504 case lookup ref notes of
505505 Nothing -> fail "note not found"
@@ -530,7 +530,7 @@ hyphenedWords = do
530530wordChunk :: PandocMonad m => ParserT [Char] ParserState m String
531531wordChunk = try $ do
532532 hd <- noneOf wordBoundaries
533− tl <- many ( (noneOf wordBoundaries) <|>
533+ tl <- many ( noneOf wordBoundaries <|>
534534 try (notFollowedBy' note *> oneOf markupChars
535535 <* lookAhead (noneOf wordBoundaries) ) )
536536 return $ hd:tl
@@ -614,7 +614,7 @@ escapedEqs = B.str <$>
614614-- | literal text escaped btw <notextile> tags
615615escapedTag :: PandocMonad m => ParserT [Char] ParserState m Inlines
616616escapedTag = B.str <$>
617− (try $ string "<notextile>" *>
617+ try (string "<notextile>" *>
618618 manyTill anyChar' (try $ string "</notextile>"))
619619
620620-- | Any special symbol defined in wordBoundaries
@@ -630,7 +630,8 @@ code = code1 <|> code2
630630-- any character except a newline before a blank line
631631anyChar' :: PandocMonad m => ParserT [Char] ParserState m Char
632632anyChar' =
633− satisfy (/='\n') <|> (try $ char '\n' <* notFollowedBy blankline)
633+ satisfy (/='\n') <|>
634+ try (char '\n' <* notFollowedBy blankline)
634635
635636code1 :: PandocMonad m => ParserT [Char] ParserState m Inlines
636637code1 = B.code <$> surrounded (char '@') anyChar'
src/Text/Pandoc/Readers/TikiWiki.hs+7−7
@@ -168,7 +168,7 @@ table = try $ do
168168 where
169169 -- The headers are as many empty srings as the number of columns
170170 -- in the first row
171− headers rows = map (B.plain . B.str) $replicate (length $ rows !! 0) ""
171+ headers rows = map (B.plain . B.str) $replicate (length $ head rows) ""
172172
173173para :: PandocMonad m => TikiWikiParser m B.Blocks
174174para = fmap (result . mconcat) ( many1Till inline endOfParaElement)
@@ -238,8 +238,8 @@ fixListNesting [first] = [recurseOnList first]
238238fixListNesting (first:second:rest) =
239239 let secondBlock = head $ B.toList second in
240240 case secondBlock of
241− BulletList _ -> fixListNesting $ (mappend (recurseOnList first) (recurseOnList second)) : rest
242− OrderedList _ _ -> fixListNesting $ (mappend (recurseOnList first) (recurseOnList second)) : rest
241+ BulletList _ -> fixListNesting $ mappend (recurseOnList first) (recurseOnList second) : rest
242+ OrderedList _ _ -> fixListNesting $ mappend (recurseOnList first) (recurseOnList second) : rest
243243 _ -> recurseOnList first : fixListNesting (second:rest)
244244
245245-- This function walks the Block structure for fixListNesting,
@@ -285,7 +285,7 @@ spanFoldUpList ln (first:rest) =
285285-- level and of the same type.
286286splitListNesting :: ListNesting -> (ListNesting, B.Blocks) -> Bool
287287splitListNesting ln1 (ln2, _)
288− | (lnnest ln1) < (lnnest ln2) =
288+ | lnnest ln1 < lnnest ln2 =
289289 True
290290 | ln1 == ln2 =
291291 True
@@ -341,7 +341,7 @@ listItemLine nest = lineContent >>= parseContent
341341 lineContent = do
342342 content <- anyLine
343343 continuation <- optionMaybe listContinuation
344− return $ filterSpaces content ++ "\n" ++ maybe "" id continuation
344+ return $ filterSpaces content ++ "\n" ++ Data.Maybe.fromMaybe "" continuation
345345 filterSpaces = reverse . dropWhile (== ' ') . reverse
346346 listContinuation = string (replicate nest '+') >> lineContent
347347 parseContent x = do
@@ -410,7 +410,7 @@ inline = choice [ whitespace
410410 ] <?> "inline"
411411
412412whitespace :: PandocMonad m => TikiWikiParser m B.Inlines
413−whitespace = (lb <|> regsp)
413+whitespace = lb <|> regsp
414414 where lb = try $ skipMany spaceChar >> linebreak >> return B.space
415415 regsp = try $ skipMany1 spaceChar >> return B.space
416416
@@ -501,7 +501,7 @@ escapedChar = try $ do
501501 string "~"
502502 inner <- many1 $ oneOf "0123456789"
503503 string "~"
504− return $B.str [(toEnum (read inner :: Int)) :: Char]
504+ return $B.str [toEnum (read inner :: Int) :: Char]
505505
506506-- UNSUPPORTED, as there doesn't seem to be any facility in calibre
507507-- for this
src/Text/Pandoc/Readers/Txt2Tags.hs+2−2
@@ -36,7 +36,7 @@ import Control.Monad.Except (catchError, throwError)
3636import Control.Monad.Reader (Reader, asks, runReader)
3737import Data.Char (toLower)
3838import Data.Default
39−import Data.List (intercalate, intersperse, transpose)
39+import Data.List (intercalate, transpose)
4040import Data.Maybe (fromMaybe)
4141import Data.Monoid ((<>))
4242import Data.Text (Text)
@@ -463,7 +463,7 @@ titleLink = try $ do
463463 char ']'
464464 let link' = last tokens
465465 guard $ not $ null link'
466− let tit = concat (intersperse " " (init tokens))
466+ let tit = unwords (init tokens)
467467 return $ B.link link' "" (B.text tit)
468468
469469-- Link with image
src/Text/Pandoc/Readers/Vimwiki.hs+1−3
@@ -388,9 +388,7 @@ bulletListMarkers = "ul" <$ (char '*' <|> char '-')
388388
389389orderedListMarkers :: PandocMonad m => VwParser m String
390390orderedListMarkers =
391− ("ol" <$choice (orderedListMarker Decimal Period:(($OneParen)
392− <$> orderedListMarker
393− <$> [Decimal, LowerRoman, UpperRoman, LowerAlpha, UpperAlpha])))
391+ ("ol" <$choice (orderedListMarker Decimal Period:(($OneParen) . orderedListMarker <$> [Decimal, LowerRoman, UpperRoman, LowerAlpha, UpperAlpha])))
394392 <|> ("ol" <$ char '#')
395393
396394--many need trimInlines
src/Text/Pandoc/Shared.hs+1−1
@@ -494,7 +494,7 @@ hierarchicalizeWithIds (Header level attr@(_,classes,_) title':xs) = do
494494 return $ Sec level newnum attr title' sectionContents' : rest'
495495hierarchicalizeWithIds (Div ("",["references"],[])
496496 (Header level (ident,classes,kvs) title' : xs):ys) =
497− hierarchicalizeWithIds (Header level (ident,("references":classes),kvs)
497+ hierarchicalizeWithIds (Header level (ident,"references":classes,kvs)
498498 title' : (xs ++ ys))
499499hierarchicalizeWithIds (x:rest) = do
500500 rest' <- hierarchicalizeWithIds rest
src/Text/Pandoc/Writers/AsciiDoc.hs+2−3
@@ -265,8 +265,7 @@ blockToAsciiDoc opts (OrderedList (_start, sty, _delim) items) = do
265265 let markers' = map (\m -> if length m < 3
266266 then m ++ replicate (3 - length m) ' '
267267 else m) markers
268− contents <- mapM (uncurry (orderedListItemToAsciiDoc opts)) $
269− zip markers' items
268+ contents <- zipWithM (orderedListItemToAsciiDoc opts) markers' items
270269 return $ cat contents <> blankline
271270blockToAsciiDoc opts (DefinitionList items) = do
272271 contents <- mapM (definitionListItemToAsciiDoc opts) items
@@ -452,7 +451,7 @@ inlineToAsciiDoc opts (Link _ txt (src, _tit)) = do
452451 else prefix <> text src <> "[" <> linktext <> "]"
453452inlineToAsciiDoc opts (Image attr alternate (src, tit)) = do
454453-- image:images/logo.png[Company logo, title="blah"]
455− let txt = if (null alternate) || (alternate == [Str ""])
454+ let txt = if null alternate || (alternate == [Str ""])
456455 then [Str "image"]
457456 else alternate
458457 linktext <- inlineListToAsciiDoc opts txt
src/Text/Pandoc/Writers/Docx.hs+5−8
@@ -1057,12 +1057,9 @@ getParaProps displayMathPara = do
10571057 props <- asks envParaProperties
10581058 listLevel <- asks envListLevel
10591059 numid <- asks envListNumId
1060− let listPr = if listLevel >= 0 && not displayMathPara
1061− then [ mknode "w:numPr" []
1062− [ mknode "w:numId" [("w:val",show numid)] ()
1063− , mknode "w:ilvl" [("w:val",show listLevel)] () ]
1064− ]
1065− else []
1060+ let listPr = [mknode "w:numPr" []
1061+ [ mknode "w:numId" [("w:val",show numid)] ()
1062+ , mknode "w:ilvl" [("w:val",show listLevel)] () ] | listLevel >= 0 && not displayMathPara]
10661063 return $ case props ++ listPr of
10671064 [] -> []
10681065 ps -> [mknode "w:pPr" [] ps]
@@ -1145,7 +1142,7 @@ inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
11451142 return $ \f -> do
11461143 x <- f
11471144 return [ mknode "w:ins"
1148− [("w:id", (show insId)),
1145+ [("w:id", show insId),
11491146 ("w:author", author),
11501147 ("w:date", date)] x ]
11511148 else return id
@@ -1272,7 +1269,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
12721269 Nothing ->
12731270 catchError
12741271 (do (img, mt) <- P.fetchItem src
1275− ident <- ("rId"++) `fmap` ((lift . lift) getUniqueId)
1272+ ident <- ("rId"++) `fmap` (lift . lift) getUniqueId
12761273 let (xpt,ypt) = desiredSizeInPoints opts attr
12771274 (either (const def) id (imageSize opts img))
12781275 -- 12700 emu = 1 pt
src/Text/Pandoc/Writers/FB2.hs+1−2
@@ -131,8 +131,7 @@ description meta' = do
131131 _ -> return []
132132 return $ el "description"
133133 [ el "title-info" (genre : (bt ++ as ++ dd ++ lang))
134− , el "document-info" ([ el "program-used" "pandoc" ] -- FIXME: +version
135− ++ coverpage)
134+ , el "document-info" (el "program-used" "pandoc" : coverpage)
136135 ]
137136
138137booktitle :: PandocMonad m => Meta -> FBM m [Content]
src/Text/Pandoc/Writers/HTML.hs+7−6
@@ -56,7 +56,8 @@ import qualified Data.Text.Lazy as TL
5656import Network.HTTP (urlEncode)
5757import Network.URI (URI (..), parseURIReference, unEscapeString)
5858import Numeric (showHex)
59−import Text.Blaze.Internal (customLeaf, MarkupM(Empty))
59+import Text.Blaze.Internal
60+ (customLeaf, MarkupM(Empty), preEscapedString, preEscapedText)
6061import Text.Blaze.Html hiding (contents)
6162import Text.Pandoc.Definition
6263import Text.Pandoc.Highlighting (formatHtmlBlock, formatHtmlInline, highlight,
@@ -424,7 +425,7 @@ elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elemen
424425 modify (\st -> st{ stElement = False})
425426 return res
426427
427− let isSec (Sec{}) = True
428+ let isSec Sec{} = True
428429 isSec (Blk _) = False
429430 let isPause (Blk x) = x == Para [Str ".",Space,Str ".",Space,Str "."]
430431 isPause _ = False
@@ -618,7 +619,7 @@ imageExts = [ "art", "bmp", "cdr", "cdt", "cpt", "cr2", "crw", "djvu", "erf",
618619
619620treatAsImage :: FilePath -> Bool
620621treatAsImage fp =
621− let path = fromMaybe fp (uriPath `fmap` parseURIReference fp)
622+ let path = maybe fp uriPath (parseURIReference fp)
622623 ext = map toLower $ drop 1 $ takeExtension path
623624 in null ext || ext `elem` imageExts
624625
@@ -797,8 +798,8 @@ blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
797798 let numstyle' = case numstyle of
798799 Example -> "decimal"
799800 _ -> camelCaseToHyphenated $ show numstyle
800− let attribs = ([A.start $ toValue startnum | startnum /= 1]) ++
801− ([A.class_ "example" | numstyle == Example]) ++
801+ let attribs = [A.start $ toValue startnum | startnum /= 1] ++
802+ [A.class_ "example" | numstyle == Example] ++
802803 (if numstyle /= DefaultStyle
803804 then if html5
804805 then [A.type_ $
@@ -819,7 +820,7 @@ blockToHtml opts (DefinitionList lst) = do
819820 do term' <- if null term
820821 then return mempty
821822 else liftM H.dt $ inlineListToHtml opts term
822− defs' <- mapM (liftM (\x -> H.dd $ (x >> nl opts)) .
823+ defs' <- mapM (liftM (\x -> H.dd (x >> nl opts)) .
823824 blockListToHtml opts) defs
824825 return $ mconcat $ nl opts : term' : nl opts :
825826 intersperse (nl opts) defs') lst
src/Text/Pandoc/Writers/Haddock.hs+1−2
@@ -168,8 +168,7 @@ blockToHaddock opts (OrderedList (start,_,delim) items) = do
168168 let markers' = map (\m -> if length m < 3
169169 then m ++ replicate (3 - length m) ' '
170170 else m) markers
171− contents <- mapM (uncurry (orderedListItemToHaddock opts)) $
172− zip markers' items
171+ contents <- zipWithM (orderedListItemToHaddock opts) markers' items
173172 return $ cat contents <> blankline
174173blockToHaddock opts (DefinitionList items) = do
175174 contents <- mapM (definitionListItemToHaddock opts) items
src/Text/Pandoc/Writers/ICML.hs+2−2
@@ -154,7 +154,7 @@ writeICML opts (Pandoc meta blocks) = do
154154-- | Auxilary functions for parStylesToDoc and charStylesToDoc.
155155contains :: String -> (String, (String, String)) -> [(String, String)]
156156contains s rule =
157− [snd rule | isInfixOf (fst rule) s]
157+ [snd rule | (fst rule) `isInfixOf` s]
158158
159159-- | The monospaced font to use as default.
160160monospacedFont :: Doc
@@ -282,7 +282,7 @@ hyperlinksToDoc (x:xs) = hyp x $$ hyperlinksToDoc xs
282282 ("Source","htss-"++show ident), ("Visible","true"), ("DestinationUniqueKey","1")]
283283 $ inTags True "Properties" []
284284 $ inTags False "BorderColor" [("type","enumeration")] (text "Black")
285− $$ inTags False "Destination" [("type","object")] (text $ "HyperlinkURLDestination/"++(escapeColons (escapeStringForXML url))) -- HyperlinkURLDestination with more than one colon crashes CS6
285+ $$ inTags False "Destination" [("type","object")] (text $ "HyperlinkURLDestination/"++escapeColons (escapeStringForXML url)) -- HyperlinkURLDestination with more than one colon crashes CS6
286286
287287
288288-- | Convert a list of Pandoc blocks to ICML.
src/Text/Pandoc/Writers/LaTeX.hs+4−4
@@ -41,7 +41,7 @@ import Data.Char (isAlphaNum, isAscii, isDigit, isLetter, isPunctuation, ord,
4141 toLower)
4242import Data.List (foldl', intercalate, intersperse, isInfixOf, nubBy,
4343 stripPrefix, (\\))
44−import Data.Maybe (catMaybes, fromMaybe, isJust, mapMaybe)
44+import Data.Maybe (catMaybes, fromMaybe, isJust, mapMaybe, isNothing)
4545import Data.Text (Text)
4646import qualified Data.Text as T
4747import Network.URI (unEscapeString)
@@ -401,7 +401,7 @@ elementToBeamer slideLevel (Sec lvl _num (ident,classes,kvs) tit elts)
401401 let frameoptions = ["allowdisplaybreaks", "allowframebreaks", "fragile",
402402 "b", "c", "t", "environment",
403403 "label", "plain", "shrink", "standout"]
404− let optionslist = ["fragile" | fragile && lookup "fragile" kvs == Nothing] ++
404+ let optionslist = ["fragile" | fragile && isNothing (lookup "fragile" kvs)] ++
405405 [k | k <- classes, k `elem` frameoptions] ++
406406 [k ++ "=" ++ v | (k,v) <- kvs, k `elem` frameoptions]
407407 let options = if null optionslist
@@ -819,7 +819,7 @@ listItemToLaTeX lst
819819 -- we need to put some text before a header if it's the first
820820 -- element in an item. This will look ugly in LaTeX regardless, but
821821 -- this will keep the typesetter from throwing an error.
822− | (Header _ _ _ :_) <- lst =
822+ | (Header{} :_) <- lst =
823823 blockListToLaTeX lst >>= return . (text "\\item ~" $$) . nest 2
824824 | otherwise = blockListToLaTeX lst >>= return . (text "\\item" $$) .
825825 nest 2
@@ -856,7 +856,7 @@ sectionHeader unnumbered ident level lst = do
856856 plain <- stringToLaTeX TextString $ concatMap stringify lst
857857 let removeInvalidInline (Note _) = []
858858 removeInvalidInline (Span (id', _, _) _) | not (null id') = []
859− removeInvalidInline (Image{}) = []
859+ removeInvalidInline Image{} = []
860860 removeInvalidInline x = [x]
861861 let lstNoNotes = foldr (mappend . (\x -> walkM removeInvalidInline x)) mempty lst
862862 txtNoNotes <- inlineListToLaTeX lstNoNotes
src/Text/Pandoc/Writers/Man.hs+1−1
@@ -114,7 +114,7 @@ notesToMan :: PandocMonad m => WriterOptions -> [[Block]] -> StateT WriterState
114114notesToMan opts notes =
115115 if null notes
116116 then return empty
117− else mapM (uncurry (noteToMan opts)) (zip [1..] notes) >>=
117+ else zipWithM (noteToMan opts) [1..] notes >>=
118118 return . (text ".SH NOTES" $$) . vcat
119119
120120-- | Return man representation of a note.
src/Text/Pandoc/Writers/Muse.hs+1−1
@@ -218,7 +218,7 @@ blockToMuse (DefinitionList items) = do
218218 descriptionToMuse :: PandocMonad m
219219 => [Block]
220220 -> StateT WriterState m Doc
221− descriptionToMuse desc = (hang 4 " :: ") <$> blockListToMuse desc
221+ descriptionToMuse desc = hang 4 " :: " <$> blockListToMuse desc
222222blockToMuse (Header level (ident,_,_) inlines) = do
223223 opts <- gets stOptions
224224 contents <- inlineListToMuse inlines
src/Text/Pandoc/Writers/OOXML.hs+1−1
@@ -104,5 +104,5 @@ fitToPage :: (Double, Double) -> Integer -> (Integer, Integer)
104104fitToPage (x, y) pageWidth
105105 -- Fixes width to the page width and scales the height
106106 | x > fromIntegral pageWidth =
107− (pageWidth, floor $ ((fromIntegral pageWidth) / x) * y)
107+ (pageWidth, floor $ (fromIntegral pageWidth / x) * y)
108108 | otherwise = (floor x, floor y)
src/Text/Pandoc/Writers/OpenDocument.hs+1−1
@@ -594,7 +594,7 @@ paraStyle attrs = do
594594 tight = if t then [ ("fo:margin-top" , "0in" )
595595 , ("fo:margin-bottom" , "0in" )]
596596 else []
597− indent = if (i /= 0 || b)
597+ indent = if i /= 0 || b
598598 then [ ("fo:margin-left" , indentVal)
599599 , ("fo:margin-right" , "0in" )
600600 , ("fo:text-indent" , "0in" )
src/Text/Pandoc/Writers/Powerpoint.hs+1−1
@@ -1,4 +1,4 @@
1−{-# LANGUAGE PatternGuards #-}
1+
22
33{-
44Copyright (C) 2017-2018 Jesse Rosenthal <jrosenthal@jhu.edu>
src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+36−38
@@ -72,7 +72,7 @@ import qualified Text.Pandoc.Shared as Shared -- so we don't overlap "Element"
7272import Text.Pandoc.Writers.Shared (metaValueToInlines)
7373import qualified Data.Map as M
7474import qualified Data.Set as S
75−import Data.Maybe (maybeToList)
75+import Data.Maybe (maybeToList, fromMaybe)
7676import Text.Pandoc.Highlighting
7777import qualified Data.Text as T
7878import Control.Applicative ((<|>))
@@ -136,7 +136,7 @@ reservedSlideIds = S.fromList [ metadataSlideId
136136
137137uniqueSlideId' :: Integer -> S.Set SlideId -> String -> SlideId
138138uniqueSlideId' n idSet s =
139− let s' = if n == 0 then s else (s ++ "-" ++ show n)
139+ let s' = if n == 0 then s else s ++ "-" ++ show n
140140 in if SlideId s' `S.member` idSet
141141 then uniqueSlideId' (n+1) idSet s
142142 else SlideId s'
@@ -152,7 +152,7 @@ runUniqueSlideId s = do
152152 return sldId
153153
154154addLogMessage :: LogMessage -> Pres ()
155−addLogMessage msg = modify $ \st -> st{stLog = msg : (stLog st)}
155+addLogMessage msg = modify $ \st -> st{stLog = msg : stLog st}
156156
157157type Pres = ReaderT WriterEnv (State WriterState)
158158
@@ -180,7 +180,7 @@ data DocProps = DocProps { dcTitle :: Maybe String
180180
181181data Slide = Slide { slideId :: SlideId
182182 , slideLayout :: Layout
183− , slideNotes :: (Maybe Notes)
183+ , slideNotes :: Maybe Notes
184184 } deriving (Show, Eq)
185185
186186newtype SlideId = SlideId String
@@ -345,12 +345,12 @@ inlineToParElems (SmallCaps ils) =
345345inlineToParElems Space = inlineToParElems (Str " ")
346346inlineToParElems SoftBreak = inlineToParElems (Str " ")
347347inlineToParElems LineBreak = return [Break]
348−inlineToParElems (Link _ ils (url, title)) = do
348+inlineToParElems (Link _ ils (url, title)) =
349349 local (\r ->r{envRunProps = (envRunProps r){rLink = Just $ ExternalTarget (url, title)}}) $
350− inlinesToParElems ils
351−inlineToParElems (Code _ str) = do
350+ inlinesToParElems ils
351+inlineToParElems (Code _ str) =
352352 local (\r ->r{envRunProps = (envRunProps r){rPropCode = True}}) $
353− inlineToParElems $ Str str
353+ inlineToParElems $ Str str
354354inlineToParElems (Math mathtype str) =
355355 return [MathElem mathtype (TeXString str)]
356356inlineToParElems (Note blks) = do
@@ -409,7 +409,7 @@ blockToParagraphs (CodeBlock attr str) =
409409 Just sty ->
410410 case highlight synMap (formatSourceLines sty) attr str of
411411 Right pElems -> do pProps <- asks envParaProps
412− return $ [Paragraph pProps pElems]
412+ return [Paragraph pProps pElems]
413413 Left _ -> blockToParagraphs $ Para [Str str]
414414 Nothing -> blockToParagraphs $ Para [Str str]
415415-- We can't yet do incremental lists, but we should render a
@@ -463,7 +463,7 @@ blockToParagraphs (DefinitionList entries) = do
463463 definition <- concatMapM (blockToParagraphs . BlockQuote) blksLst
464464 return $ term ++ definition
465465 concatMapM go entries
466−blockToParagraphs (Div (_, ("notes" : []), _) _) = return []
466+blockToParagraphs (Div (_, "notes" : [], _) _) = return []
467467blockToParagraphs (Div _ blks) = concatMapM blockToParagraphs blks
468468blockToParagraphs blk = do
469469 addLogMessage $ BlockNotRendered blk
@@ -481,7 +481,7 @@ multiParBullet (b:bs) = do
481481
482482cellToParagraphs :: Alignment -> TableCell -> Pres [Paragraph]
483483cellToParagraphs algn tblCell = do
484− paras <- mapM (blockToParagraphs) tblCell
484+ paras <- mapM blockToParagraphs tblCell
485485 let alignment = case algn of
486486 AlignLeft -> Just AlgnLeft
487487 AlignRight -> Just AlgnRight
@@ -494,7 +494,7 @@ rowToParagraphs :: [Alignment] -> [TableCell] -> Pres [[Paragraph]]
494494rowToParagraphs algns tblCells = do
495495 -- We have to make sure we have the right number of alignments
496496 let pairs = zip (algns ++ repeat AlignDefault) tblCells
497− mapM (\(a, tc) -> cellToParagraphs a tc) pairs
497+ mapM (uncurry cellToParagraphs) pairs
498498
499499withAttr :: Attr -> Shape -> Shape
500500withAttr attr (Pic picPr url caption) =
@@ -507,17 +507,17 @@ withAttr _ sp = sp
507507
508508blockToShape :: Block -> Pres Shape
509509blockToShape (Plain (il:_)) | Image attr ils (url, _) <- il =
510− (withAttr attr . Pic def url) <$> (inlinesToParElems ils)
510+ (withAttr attr . Pic def url) <$> inlinesToParElems ils
511511blockToShape (Para (il:_)) | Image attr ils (url, _) <- il =
512− (withAttr attr . Pic def url) <$> (inlinesToParElems ils)
512+ (withAttr attr . Pic def url) <$> inlinesToParElems ils
513513blockToShape (Plain (il:_)) | Link _ (il':_) target <- il
514514 , Image attr ils (url, _) <- il' =
515515 (withAttr attr . Pic def {picPropLink = Just $ ExternalTarget target} url) <$>
516− (inlinesToParElems ils)
516+ inlinesToParElems ils
517517blockToShape (Para (il:_)) | Link _ (il':_) target <- il
518518 , Image attr ils (url, _) <- il' =
519519 (withAttr attr . Pic def{picPropLink = Just $ ExternalTarget target} url) <$>
520− (inlinesToParElems ils)
520+ inlinesToParElems ils
521521blockToShape (Table caption algn _ hdrCells rows) = do
522522 caption' <- inlinesToParElems caption
523523 hdrCells' <- rowToParagraphs algn hdrCells
@@ -537,11 +537,11 @@ blockToShape blk = do paras <- blockToParagraphs blk
537537
538538combineShapes :: [Shape] -> [Shape]
539539combineShapes [] = []
540−combineShapes (s : []) = [s]
541−combineShapes (pic@(Pic _ _ _) : ss) = pic : combineShapes ss
542−combineShapes ((TextBox []) : ss) = combineShapes ss
540+combineShapes[s] = [s]
541+combineShapes (pic@(Pic{}) : ss) = pic : combineShapes ss
542+combineShapes (TextBox [] : ss) = combineShapes ss
543543combineShapes (s : TextBox [] : ss) = combineShapes (s : ss)
544−combineShapes ((TextBox (p:ps)) : (TextBox (p':ps')) : ss) =
544+combineShapes (TextBox (p:ps) : TextBox (p':ps') : ss) =
545545 combineShapes $ TextBox ((p:ps) ++ (p':ps')) : ss
546546combineShapes (s:ss) = s : combineShapes ss
547547
@@ -549,8 +549,8 @@ blocksToShapes :: [Block] -> Pres [Shape]
549549blocksToShapes blks = combineShapes <$> mapM blockToShape blks
550550
551551isImage :: Inline -> Bool
552−isImage (Image _ _ _) = True
553−isImage (Link _ ((Image _ _ _) : _) _) = True
552+isImage (Image{}) = True
553+isImage (Link _ (Image _ _ _ : _) _) = True
554554isImage _ = False
555555
556556splitBlocks' :: [Block] -> [[Block]] -> [Block] -> Pres [[Block]]
@@ -565,27 +565,27 @@ splitBlocks' cur acc (h@(Header n _ _) : blks) = do
565565 GT -> splitBlocks' (cur ++ [h]) acc blks
566566-- `blockToParagraphs` treats Plain and Para the same, so we can save
567567-- some code duplication by treating them the same here.
568−splitBlocks' cur acc ((Plain ils) : blks) = splitBlocks' cur acc ((Para ils) : blks)
569−splitBlocks' cur acc ((Para (il:ils)) : blks) | isImage il = do
568+splitBlocks' cur acc (Plain ils : blks) = splitBlocks' cur acc (Para ils : blks)
569+splitBlocks' cur acc (Para (il:ils) : blks) | isImage il = do
570570 slideLevel <- asks envSlideLevel
571571 case cur of
572− (Header n _ _) : [] | n == slideLevel ->
572+ [(Header n _ _)] | n == slideLevel ->
573573 splitBlocks' []
574574 (acc ++ [cur ++ [Para [il]]])
575− (if null ils then blks else (Para ils) : blks)
575+ (if null ils then blks else Para ils : blks)
576576 _ -> splitBlocks' []
577577 (acc ++ (if null cur then [] else [cur]) ++ [[Para [il]]])
578− (if null ils then blks else (Para ils) : blks)
579−splitBlocks' cur acc (tbl@(Table _ _ _ _ _) : blks) = do
578+ (if null ils then blks else Para ils : blks)
579+splitBlocks' cur acc (tbl@(Table{}) : blks) = do
580580 slideLevel <- asks envSlideLevel
581581 case cur of
582− (Header n _ _) : [] | n == slideLevel ->
582+ [(Header n _ _)] | n == slideLevel ->
583583 splitBlocks' [] (acc ++ [cur ++ [tbl]]) blks
584584 _ -> splitBlocks' [] (acc ++ (if null cur then [] else [cur]) ++ [[tbl]]) blks
585585splitBlocks' cur acc (d@(Div (_, classes, _) _): blks) | "columns" `elem` classes = do
586586 slideLevel <- asks envSlideLevel
587587 case cur of
588− (Header n _ _) : [] | n == slideLevel ->
588+ [(Header n _ _)] | n == slideLevel ->
589589 splitBlocks' [] (acc ++ [cur ++ [d]]) blks
590590 _ -> splitBlocks' [] (acc ++ (if null cur then [] else [cur]) ++ [[d]]) blks
591591splitBlocks' cur acc (blk : blks) = splitBlocks' (cur ++ [blk]) acc blks
@@ -594,12 +594,12 @@ splitBlocks :: [Block] -> Pres [[Block]]
594594splitBlocks = splitBlocks' [] []
595595
596596blocksToSlide' :: Int -> [Block] -> Pres Slide
597−blocksToSlide' lvl ((Header n (ident, _, _) ils) : blks)
597+blocksToSlide' lvl (Header n (ident, _, _) ils : blks)
598598 | n < lvl = do
599599 registerAnchorId ident
600600 sldId <- asks envCurSlideId
601601 hdr <- inlinesToParElems ils
602− return $ Slide sldId (TitleSlide {titleSlideHeader = hdr}) Nothing
602+ return $ Slide sldId TitleSlide {titleSlideHeader = hdr} Nothing
603603 | n == lvl = do
604604 registerAnchorId ident
605605 hdr <- inlinesToParElems ils
@@ -614,7 +614,7 @@ blocksToSlide' lvl ((Header n (ident, _, _) ils) : blks)
614614blocksToSlide' _ (blk : blks)
615615 | Div (_, classes, _) divBlks <- blk
616616 , "columns" `elem` classes
617− , (Div (_, clsL, _) blksL) : (Div (_, clsR, _) blksR) : remaining <- divBlks
617+ , Div (_, clsL, _) blksL : Div (_, clsR, _) blksR : remaining <- divBlks
618618 , "column" `elem` clsL, "column" `elem` clsR = do
619619 unless (null blks)
620620 (mapM (addLogMessage . BlockNotRendered) blks >> return ())
@@ -672,7 +672,7 @@ makeNoteEntry n blks =
672672 in
673673 case blks of
674674 (Para ils : blks') -> (Para $ enum : Space : ils) : blks'
675− _ -> (Para [enum]) : blks
675+ _ -> Para [enum] : blks
676676
677677forceFontSize :: Pixels -> Pres a -> Pres a
678678forceFontSize px x = do
@@ -860,7 +860,7 @@ blocksToPresentationSlides blks = do
860860 (\env -> env { envCurSlideId = endNotesSlideId
861861 , envInNoteSlide = True
862862 })
863− (blocksToSlide $ endNotesSlideBlocks)
863+ (blocksToSlide endNotesSlideBlocks)
864864 return [endNotesSlide]
865865
866866 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
@@ -889,9 +889,7 @@ documentToPresentation :: WriterOptions
889889documentToPresentation opts (Pandoc meta blks) =
890890 let env = def { envOpts = opts
891891 , envMetadata = meta
892− , envSlideLevel = case writerSlideLevel opts of
893− Just lvl -> lvl
894− Nothing -> getSlideLevel blks
892+ , envSlideLevel = fromMaybe (getSlideLevel blks) (writerSlideLevel opts)
895893 }
896894 (presSlides, msgs) = runPres env def $ blocksToPresentationSlides blks
897895 docProps = metaToDocProps meta
src/Text/Pandoc/Writers/RST.hs+7−8
@@ -132,7 +132,7 @@ keyToRST (label, (src, _)) = do
132132-- | Return RST representation of notes.
133133notesToRST :: PandocMonad m => [[Block]] -> RST m Doc
134134notesToRST notes =
135− mapM (uncurry noteToRST) (zip [1..] notes) >>=
135+ zipWithM noteToRST [1..] notes >>=
136136 return . vsep
137137
138138-- | Return RST representation of a note.
@@ -306,8 +306,7 @@ blockToRST (OrderedList (start, style', delim) items) = do
306306 let maxMarkerLength = maximum $ map length markers
307307 let markers' = map (\m -> let s = maxMarkerLength - length m
308308 in m ++ replicate s ' ') markers
309− contents <- mapM (uncurry orderedListItemToRST) $
310− zip markers' items
309+ contents <- zipWithM orderedListItemToRST markers' items
311310 -- ensure that sublists have preceding blank line
312311 return $ blankline $$ chomp (vcat contents) $$ blankline
313312blockToRST (DefinitionList items) = do
@@ -356,12 +355,12 @@ blockListToRST' topLevel blocks = do
356355 let fixBlocks (b1:b2@(BlockQuote _):bs)
357356 | toClose b1 = b1 : commentSep : b2 : fixBlocks bs
358357 where
359− toClose (Plain{}) = False
360− toClose (Header{}) = False
361− toClose (LineBlock{}) = False
362− toClose (HorizontalRule) = False
358+ toClose Plain{} = False
359+ toClose Header{} = False
360+ toClose LineBlock{} = False
361+ toClose HorizontalRule = False
363362 toClose (Para [Image _ _ (_,'f':'i':'g':':':_)]) = True
364− toClose (Para{}) = False
363+ toClose Para{} = False
365364 toClose _ = True
366365 commentSep = RawBlock "rst" "..\n\n"
367366 fixBlocks (b:bs) = b : fixBlocks bs
src/Text/Pandoc/Writers/RTF.hs+4−4
@@ -31,6 +31,7 @@ Conversion of 'Pandoc' documents to RTF (rich text format).
3131module Text.Pandoc.Writers.RTF ( writeRTF
3232 ) where
3333import Control.Monad.Except (catchError, throwError)
34+import Control.Monad
3435import qualified Data.ByteString as B
3536import Data.Char (chr, isDigit, ord)
3637import Data.List (intercalate, isSuffixOf)
@@ -278,8 +279,7 @@ blockToRTF indent alignment (BulletList lst) = (spaceAtEnd . concat) <$>
278279 mapM (listItemToRTF alignment indent (bulletMarker indent)) lst
279280blockToRTF indent alignment (OrderedList attribs lst) =
280281 (spaceAtEnd . concat) <$>
281− mapM (uncurry (listItemToRTF alignment indent))
282− (zip (orderedMarkers indent attribs) lst)
282+ zipWithM (listItemToRTF alignment indent) (orderedMarkers indent attribs) lst
283283blockToRTF indent alignment (DefinitionList lst) = (spaceAtEnd . concat) <$>
284284 mapM (definitionListItemToRTF alignment indent) lst
285285blockToRTF indent _ HorizontalRule = return $
@@ -303,8 +303,8 @@ tableRowToRTF header indent aligns sizes' cols = do
303303 let sizes = if all (== 0) sizes'
304304 then replicate (length cols) (1.0 / fromIntegral (length cols))
305305 else sizes'
306− columns <- concat <$> mapM (uncurry (tableItemToRTF indent))
307− (zip aligns cols)
306+ columns <- concat <$>
307+ zipWithM (tableItemToRTF indent) aligns cols
308308 let rightEdges = tail $ scanl (\sofar new -> sofar + floor (new * totalTwips))
309309 (0 :: Integer) sizes
310310 let cellDefs = map (\edge -> (if header
src/Text/Pandoc/Writers/Texinfo.hs+1−1
@@ -475,7 +475,7 @@ inlineToTexinfo (Link _ txt (src@('#':_), _)) = do
475475inlineToTexinfo (Link _ txt (src, _)) =
476476 case txt of
477477 [Str x] | escapeURI x == src -> -- autolink
478− do return $ text $ "@url{" ++ x ++ "}"
478+ return $ text $ "@url{" ++ x ++ "}"
479479 _ -> do contents <- escapeCommas $ inlineListToTexinfo txt
480480 let src1 = stringToTexinfo src
481481 return $ text ("@uref{" ++ src1 ++ ",") <> contents <>
test/Tests/Command.hs+3−3
@@ -40,7 +40,7 @@ runTest testname pandocpath cmd inp norm = testCase testname $ do
4040 -- filter \r so the tests will work on Windows machines
4141 let out = filter (/= '\r') $ err' ++ out'
4242 result <- if ec == ExitSuccess
43− then do
43+ then
4444 if out == norm
4545 then return TestPassed
4646 else return
@@ -52,6 +52,7 @@ runTest testname pandocpath cmd inp norm = testCase testname $ do
5252 assertBool (show result) (result == TestPassed)
5353
5454tests :: TestTree
55+{-# NOINLINE tests #-}
5556tests = unsafePerformIO $ do
5657 pandocpath <- findPandoc
5758 files <- filter (".md" `isSuffixOf`) <$>
@@ -89,7 +90,6 @@ extractCommandTest pandocpath fp = unsafePerformIO $ do
8990 contents <- UTF8.toText <$> BS.readFile ("command" </> fp)
9091 Pandoc _ blocks <- runIOorExplode (readMarkdown
9192 def{ readerExtensions = pandocExtensions } contents)
92− let codeblocks = map extractCode $ filter isCodeBlock $ blocks
93+ let codeblocks = map extractCode $ filter isCodeBlock blocks
9394 let cases = map (runCommandTest pandocpath) $ zip [1..] codeblocks
9495 return $ testGroup fp cases
95−
test/Tests/Readers/Creole.hs+1−1
@@ -224,7 +224,7 @@ tests = [
224224 <> " bar")
225225 , "escaped auto link" =:
226226 "foo ~http://foo.example.com/bar/baz.html bar"
227− =?> para ("foo http://foo.example.com/bar/baz.html bar")
227+ =?> para "foo http://foo.example.com/bar/baz.html bar"
228228 , "wiki link simple" =:
229229 "foo [[http://foo.example.com/foo.png]] bar"
230230 =?> para ("foo "
test/Tests/Readers/Docx.hs+5−6
@@ -5,6 +5,7 @@ import qualified Data.ByteString as BS
55import qualified Data.ByteString.Lazy as B
66import qualified Data.Map as M
77import qualified Data.Text as T
8+import Data.Maybe
89import System.IO.Unsafe
910import Test.Tasty
1011import Test.Tasty.HUnit
@@ -46,7 +47,7 @@ compareOutput opts docxFile nativeFile = do
4647 nf <- UTF8.toText <$> BS.readFile nativeFile
4748 p <- runIOorExplode $ readDocx opts df
4849 df' <- runIOorExplode $ readNative def nf
49− return $ (noNorm p, noNorm df')
50+ return (noNorm p, noNorm df')
5051
5152testCompareWithOptsIO :: ReaderOptions -> String -> FilePath -> FilePath -> IO TestTree
5253testCompareWithOptsIO opts name docxFile nativeFile = do
@@ -87,11 +88,9 @@ compareMediaPathIO mediaPath mediaBag docxPath = do
8788 Nothing -> error ("couldn't find " ++
8889 mediaPath ++
8990 " in media bag")
90− docxBS = case docxMedia of
91− Just bs -> bs
92− Nothing -> error ("couldn't find " ++
93− mediaPath ++
94− " in media bag")
91+ docxBS = fromMaybe (error ("couldn't find " ++
92+ mediaPath ++
93+ " in media bag")) docxMedia
9594 return $ mbBS == docxBS
9695
9796compareMediaBagIO :: FilePath -> IO Bool
test/Tests/Readers/EPUB.hs+1−1
@@ -17,7 +17,7 @@ getMediaBag fp = do
1717
1818testMediaBag :: FilePath -> [(String, String, Int)] -> IO ()
1919testMediaBag fp bag = do
20− actBag <- (mediaDirectory <$> getMediaBag fp)
20+ actBag <- mediaDirectory <$> getMediaBag fp
2121 assertBool (show "MediaBag did not match:\nExpected: "
2222 ++ show bag
2323 ++ "\nActual: "
test/Tests/Readers/Muse.hs+3−3
@@ -30,8 +30,8 @@ spcSep = mconcat . intersperse space
3030-- Tables and definition lists don't round-trip yet
3131
3232makeRoundTrip :: Block -> Block
33−makeRoundTrip (Table{}) = Para [Str "table was here"]
34−makeRoundTrip (DefinitionList{}) = Para [Str "deflist was here"]
33+makeRoundTrip Table{} = Para [Str "table was here"]
34+makeRoundTrip DefinitionList{} = Para [Str "deflist was here"]
3535makeRoundTrip x = x
3636
3737-- Demand that any AST produced by Muse reader and written by Muse writer can be read back exactly the same way.
@@ -44,7 +44,7 @@ roundTrip b = d'' == d'''
4444 d'' = rewrite d'
4545 d''' = rewrite d''
4646 rewrite = amuse . T.pack . (++ "\n") . T.unpack .
47− (purely $ writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
47+ purely (writeMuse def { writerExtensions = extensionsFromList [Ext_amuse]
4848 , writerWrapText = WrapPreserve
4949 })
5050
test/Tests/Readers/Org/Block/Header.hs+1−1
@@ -130,7 +130,7 @@ tests =
130130 mconcat [ para "foo"
131131 , headerWith ("thing-other-thing", [], [])
132132 1
133− ((strikeout "thing") <> " other thing")
133+ (strikeout "thing" <> " other thing")
134134 ]
135135
136136 , "Comment Trees" =:
test/Tests/Readers/Org/Block/List.hs+9−9
@@ -75,16 +75,16 @@ tests =
7575 ]
7676
7777 , "Bullet List with Decreasing Indent" =:
78− (" - Discovery\n\
79− \ - Human After All\n") =?>
78+ " - Discovery\n\
79+ \ - Human After All\n" =?>
8080 mconcat [ bulletList [ plain "Discovery" ]
8181 , bulletList [ plain ("Human" <> space <> "After" <> space <> "All")]
8282 ]
8383
8484 , "Header follows Bullet List" =:
85− (" - Discovery\n\
85+ " - Discovery\n\
8686 \ - Human After All\n\
87− \* Homework") =?>
87+ \* Homework" =?>
8888 mconcat [ bulletList [ plain "Discovery"
8989 , plain ("Human" <> space <> "After" <> space <> "All")
9090 ]
@@ -92,9 +92,9 @@ tests =
9292 ]
9393
9494 , "Bullet List Unindented with trailing Header" =:
95− ("- Discovery\n\
95+ "- Discovery\n\
9696 \- Homework\n\
97− \* NotValidListItem") =?>
97+ \* NotValidListItem" =?>
9898 mconcat [ bulletList [ plain "Discovery"
9999 , plain "Homework"
100100 ]
@@ -166,14 +166,14 @@ tests =
166166 , "Ordered List in Bullet List" =:
167167 ("- Emacs\n" <>
168168 " 1. Org\n") =?>
169− bulletList [ (plain "Emacs") <>
170− (orderedList [ plain "Org"])
169+ bulletList [ plain "Emacs" <>
170+ orderedList [ plain "Org"]
171171 ]
172172
173173 , "Bullet List in Ordered List" =:
174174 ("1. GNU\n" <>
175175 " - Freedom\n") =?>
176− orderedList [ (plain "GNU") <> bulletList [ (plain "Freedom") ] ]
176+ orderedList [ plain "GNU" <> bulletList [ plain "Freedom" ] ]
177177
178178 , "Definition List" =:
179179 T.unlines [ "- PLL :: phase-locked loop"
test/Tests/Readers/Org/Directive.hs+2−2
@@ -107,8 +107,8 @@ tests =
107107 ] =?>
108108 mconcat [ para "first block"
109109 , orderedList
110− [ (para "top-level section 1" <>
111− orderedList [ para "subsection" ])
110+ [ para "top-level section 1" <>
111+ orderedList [ para "subsection" ]
112112 , para "top-level section 2" ]
113113 ]
114114
test/Tests/Readers/Org/Inline.hs+30−29
@@ -36,7 +36,7 @@ tests =
3636
3737 , "Underline" =:
3838 "_underline_" =?>
39− para (underlineSpan $ "underline")
39+ para (underlineSpan "underline")
4040
4141 , "Strikeout" =:
4242 "+Kill Bill+" =?>
@@ -127,11 +127,12 @@ tests =
127127
128128 , "Markup should work properly after a blank line" =:
129129 T.unlines ["foo", "", "/bar/"] =?>
130− (para $ text "foo") <> (para $ emph $ text "bar")
130+ para (text "foo") <>
131+ para (emph $ text "bar")
131132
132133 , "Inline math must stay within three lines" =:
133134 T.unlines [ "$a", "b", "c$", "$d", "e", "f", "g$" ] =?>
134− para ((math "a\nb\nc") <> softbreak <>
135+ para (math "a\nb\nc" <> softbreak <>
135136 "$d" <> softbreak <> "e" <> softbreak <>
136137 "f" <> softbreak <> "g$")
137138
@@ -139,7 +140,7 @@ tests =
139140 "$a$ $b$! $c$?" =?>
140141 para (spcSep [ math "a"
141142 , "$b$!"
142− , (math "c") <> "?"
143+ , math "c" <> "?"
143144 ])
144145
145146 , "Markup may not span more than two lines" =:
@@ -166,12 +167,12 @@ tests =
166167 para (mconcat $ intersperse softbreak
167168 [ "a" <> subscript "(a(b)(c)d)"
168169 , "e" <> superscript "(f(g)h)"
169− , "i" <> (subscript "(jk)") <> "l)"
170− , "m" <> (superscript "()") <> "n"
170+ , "i" <> subscript "(jk)" <> "l)"
171+ , "m" <> superscript "()" <> "n"
171172 , "o" <> subscript "p{q{}r}"
172173 , "s" <> superscript "t{u}v"
173− , "w" <> (subscript "xy") <> "z}"
174− , "1" <> (superscript "") <> "2"
174+ , "w" <> subscript "xy" <> "z}"
175+ , "1" <> superscript "" <> "2"
175176 , "3" <> subscript "{}"
176177 , "4" <> superscript ("(a(" <> strong "b(c" <> ")d))")
177178 ])
@@ -182,17 +183,17 @@ tests =
182183 , testGroup "Images"
183184 [ "Image" =:
184185 "[[./sunset.jpg]]" =?>
185− (para $ image "./sunset.jpg" "" "")
186+ para (image "./sunset.jpg" "" "")
186187
187188 , "Image with explicit file: prefix" =:
188189 "[[file:sunrise.jpg]]" =?>
189− (para $ image "sunrise.jpg" "" "")
190+ para (image "sunrise.jpg" "" "")
190191
191192 , "Multiple images within a paragraph" =:
192193 T.unlines [ "[[file:sunrise.jpg]]"
193194 , "[[file:sunset.jpg]]"
194195 ] =?>
195− (para $ (image "sunrise.jpg" "" "")
196+ para ((image "sunrise.jpg" "" "")
196197 <> softbreak
197198 <> (image "sunset.jpg" "" ""))
198199
@@ -200,75 +201,75 @@ tests =
200201 T.unlines [ "#+ATTR_HTML: :width 50%"
201202 , "[[file:guinea-pig.gif]]"
202203 ] =?>
203− (para $ imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
204+ para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")
204205 ]
205206
206207 , "Explicit link" =:
207208 "[[http://zeitlens.com/][pseudo-random /nonsense/]]" =?>
208− (para $ link "http://zeitlens.com/" ""
209+ para (link "http://zeitlens.com/" ""
209210 ("pseudo-random" <> space <> emph "nonsense"))
210211
211212 , "Self-link" =:
212213 "[[http://zeitlens.com/]]" =?>
213− (para $ link "http://zeitlens.com/" "" "http://zeitlens.com/")
214+ para (link "http://zeitlens.com/" "" "http://zeitlens.com/")
214215
215216 , "Absolute file link" =:
216217 "[[/url][hi]]" =?>
217− (para $ link "file:///url" "" "hi")
218+ para (link "file:///url" "" "hi")
218219
219220 , "Link to file in parent directory" =:
220221 "[[../file.txt][moin]]" =?>
221− (para $ link "../file.txt" "" "moin")
222+ para (link "../file.txt" "" "moin")
222223
223224 , "Empty link (for gitit interop)" =:
224225 "[[][New Link]]" =?>
225− (para $ link "" "" "New Link")
226+ para (link "" "" "New Link")
226227
227228 , "Image link" =:
228229 "[[sunset.png][file:dusk.svg]]" =?>
229− (para $ link "sunset.png" "" (image "dusk.svg" "" ""))
230+ para (link "sunset.png" "" (image "dusk.svg" "" ""))
230231
231232 , "Image link with non-image target" =:
232233 "[[http://example.com][./logo.png]]" =?>
233− (para $ link "http://example.com" "" (image "./logo.png" "" ""))
234+ para (link "http://example.com" "" (image "./logo.png" "" ""))
234235
235236 , "Plain link" =:
236237 "Posts on http://zeitlens.com/ can be funny at times." =?>
237− (para $ spcSep [ "Posts", "on"
238+ para (spcSep [ "Posts", "on"
238239 , link "http://zeitlens.com/" "" "http://zeitlens.com/"
239240 , "can", "be", "funny", "at", "times."
240241 ])
241242
242243 , "Angle link" =:
243244 "Look at <http://moltkeplatz.de> for fnords." =?>
244− (para $ spcSep [ "Look", "at"
245+ para (spcSep [ "Look", "at"
245246 , link "http://moltkeplatz.de" "" "http://moltkeplatz.de"
246247 , "for", "fnords."
247248 ])
248249
249250 , "Absolute file link" =:
250251 "[[file:///etc/passwd][passwd]]" =?>
251− (para $ link "file:///etc/passwd" "" "passwd")
252+ para (link "file:///etc/passwd" "" "passwd")
252253
253254 , "File link" =:
254255 "[[file:target][title]]" =?>
255− (para $ link "target" "" "title")
256+ para (link "target" "" "title")
256257
257258 , "Anchor" =:
258259 "<<anchor>> Link here later." =?>
259− (para $ spanWith ("anchor", [], []) mempty <>
260+ para (spanWith ("anchor", [], []) mempty <>
260261 "Link" <> space <> "here" <> space <> "later.")
261262
262263 , "Inline code block" =:
263264 "src_emacs-lisp{(message \"Hello\")}" =?>
264− (para $ codeWith ( ""
265+ para (codeWith ( ""
265266 , [ "commonlisp" ]
266267 , [ ("org-language", "emacs-lisp") ])
267268 "(message \"Hello\")")
268269
269270 , "Inline code block with arguments" =:
270271 "src_sh[:export both :results output]{echo 'Hello, World'}" =?>
271− (para $ codeWith ( ""
272+ para (codeWith ( ""
272273 , [ "bash" ]
273274 , [ ("org-language", "sh")
274275 , ("export", "both")
@@ -279,7 +280,7 @@ tests =
279280
280281 , "Inline code block with toggle" =:
281282 "src_sh[:toggle]{echo $HOME}" =?>
282− (para $ codeWith ( ""
283+ para (codeWith ( ""
283284 , [ "bash" ]
284285 , [ ("org-language", "sh")
285286 , ("toggle", "yes")
@@ -415,7 +416,7 @@ tests =
415416 in [
416417 "Berkeley-style in-text citation" =:
417418 "See @Dominik201408." =?>
418− (para $ "See "
419+ para ("See "
419420 <> cite [dominikInText] "@Dominik201408"
420421 <> ".")
421422
@@ -468,7 +469,7 @@ tests =
468469
469470 , "MathML symbol in LaTeX-style" =:
470471 "There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: '\\nbsp')." =?>
471− para ("There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: ' ').")
472+ para "There is a hackerspace in Lübeck, Germany, called nbsp (unicode symbol: ' ')."
472473
473474 , "MathML symbol in LaTeX-style, including braces" =:
474475 "\\Aacute{}stor" =?>
test/Tests/Readers/Org/Inline/Note.hs−1
@@ -84,4 +84,3 @@ tests =
8484 , para "next"
8585 ]
8686 ]
87−
test/Tests/Readers/Org/Inline/Smart.hs+2−2
@@ -38,9 +38,9 @@ tests =
3838
3939 , test orgSmart "Single quotes can be followed by emphasized text"
4040 ("Singles on the '/meat market/'" =?>
41− para ("Singles on the " <> (singleQuoted $ emph "meat market")))
41+ para ("Singles on the " <> singleQuoted (emph "meat market")))
4242
4343 , test orgSmart "Double quotes can be followed by emphasized text"
4444 ("Double income, no kids: \"/DINK/\"" =?>
45− para ("Double income, no kids: " <> (doubleQuoted $ emph "DINK")))
45+ para ("Double income, no kids: " <> doubleQuoted (emph "DINK")))
4646 ]
test/Tests/Readers/Org/Meta.hs+14−14
@@ -30,32 +30,32 @@ tests =
3030 , "Title" =:
3131 "#+TITLE: Hello, World" =?>
3232 let titleInline = toList $ "Hello," <> space <> "World"
33− meta = setMeta "title" (MetaInlines titleInline) $ nullMeta
33+ meta = setMeta "title" (MetaInlines titleInline) nullMeta
3434 in Pandoc meta mempty
3535
3636 , "Author" =:
3737 "#+author: John /Emacs-Fanboy/ Doe" =?>
3838 let author = toList . spcSep $ [ "John", emph "Emacs-Fanboy", "Doe" ]
39− meta = setMeta "author" (MetaList [MetaInlines author]) $ nullMeta
39+ meta = setMeta "author" (MetaList [MetaInlines author]) nullMeta
4040 in Pandoc meta mempty
4141
4242 , "Multiple authors" =:
4343 "#+author: James Dewey Watson, Francis Harry Compton Crick " =?>
4444 let watson = MetaInlines $ toList "James Dewey Watson"
4545 crick = MetaInlines $ toList "Francis Harry Compton Crick"
46− meta = setMeta "author" (MetaList [watson, crick]) $ nullMeta
46+ meta = setMeta "author" (MetaList [watson, crick]) nullMeta
4747 in Pandoc meta mempty
4848
4949 , "Date" =:
5050 "#+Date: Feb. *28*, 2014" =?>
51− let date = toList . spcSep $ [ "Feb.", (strong "28") <> ",", "2014" ]
52− meta = setMeta "date" (MetaInlines date) $ nullMeta
51+ let date = toList . spcSep $ [ "Feb.", strong "28" <> ",", "2014" ]
52+ meta = setMeta "date" (MetaInlines date) nullMeta
5353 in Pandoc meta mempty
5454
5555 , "Description" =:
5656 "#+DESCRIPTION: Explanatory text" =?>
5757 let description = "Explanatory text"
58− meta = setMeta "description" (MetaString description) $ nullMeta
58+ meta = setMeta "description" (MetaString description) nullMeta
5959 in Pandoc meta mempty
6060
6161 , "Properties drawer" =:
@@ -94,7 +94,7 @@ tests =
9494 , "#+author: Max"
9595 ] =?>
9696 let author = MetaInlines [Str "Max"]
97− meta = setMeta "author" (MetaList [author]) $ nullMeta
97+ meta = setMeta "author" (MetaList [author]) nullMeta
9898 in Pandoc meta mempty
9999
100100 , "Logbook drawer" =:
@@ -135,7 +135,7 @@ tests =
135135
136136 , "Search links are read as emph" =:
137137 "[[Wally][Where's Wally?]]" =?>
138− (para (emph $ "Where's" <> space <> "Wally?"))
138+ para (emph $ "Where's" <> space <> "Wally?")
139139
140140 , "Link to nonexistent anchor" =:
141141 T.unlines [ "<<link-here>> Target."
@@ -149,25 +149,25 @@ tests =
149149 T.unlines [ "#+LINK: wp https://en.wikipedia.org/wiki/%s"
150150 , "[[wp:Org_mode][Wikipedia on Org-mode]]"
151151 ] =?>
152− (para (link "https://en.wikipedia.org/wiki/Org_mode" ""
153− ("Wikipedia" <> space <> "on" <> space <> "Org-mode")))
152+ para (link "https://en.wikipedia.org/wiki/Org_mode" ""
153+ ("Wikipedia" <> space <> "on" <> space <> "Org-mode"))
154154
155155 , "Link abbreviation, defined after first use" =:
156156 T.unlines [ "[[zl:non-sense][Non-sense articles]]"
157157 , "#+LINK: zl http://zeitlens.com/tags/%s.html"
158158 ] =?>
159− (para (link "http://zeitlens.com/tags/non-sense.html" ""
160− ("Non-sense" <> space <> "articles")))
159+ para (link "http://zeitlens.com/tags/non-sense.html" ""
160+ ("Non-sense" <> space <> "articles"))
161161
162162 , "Link abbreviation, URL encoded arguments" =:
163163 T.unlines [ "#+link: expl http://example.com/%h/foo"
164164 , "[[expl:Hello, World!][Moin!]]"
165165 ] =?>
166− (para (link "http://example.com/Hello%2C%20World%21/foo" "" "Moin!"))
166+ para (link "http://example.com/Hello%2C%20World%21/foo" "" "Moin!")
167167
168168 , "Link abbreviation, append arguments" =:
169169 T.unlines [ "#+link: expl http://example.com/"
170170 , "[[expl:foo][bar]]"
171171 ] =?>
172− (para (link "http://example.com/foo" "" "bar"))
172+ para (link "http://example.com/foo" "" "bar")
173173 ]
test/Tests/Readers/RST.hs+14−15
@@ -36,8 +36,8 @@ tests = [ "line block with blank line" =:
3636 , ":Parameter i: integer"
3737 , ":Final: item"
3838 , " on two lines" ]
39− =?> ( doc
40− $ para "para" <>
39+ =?>
40+ doc (para "para" <>
4141 definitionList [ (str "Hostname", [para "media08"])
4242 , (text "IP address", [para "10.0.0.19"])
4343 , (str "Size", [para "3ru"])
@@ -56,10 +56,10 @@ tests = [ "line block with blank line" =:
5656 , ""
5757 , ":Version: 1"
5858 ]
59− =?> ( setMeta "version" (para "1")
60− $ setMeta "title" ("Title" :: Inlines)
59+ =?>
60+ setMeta "version" (para "1") (setMeta "title" ("Title" :: Inlines)
6161 $ setMeta "subtitle" ("Subtitle" :: Inlines)
62− $ doc mempty )
62+ $ doc mempty)
6363 , "with inline markup" =: T.unlines
6464 [ ":*Date*: today"
6565 , ""
@@ -73,8 +73,8 @@ tests = [ "line block with blank line" =:
7373 , ".. _two: http://example.com"
7474 , ".. _three: http://example.org"
7575 ]
76− =?> ( setMeta "date" (str "today")
77− $ doc
76+ =?>
77+ setMeta "date" (str "today") (doc
7878 $ definitionList [ (emph "one", [para "emphasis"])
7979 , (link "http://example.com" "" "two", [para "reference"])
8080 , (link "http://example.org" "" "three", [para "another one"])
@@ -102,13 +102,12 @@ tests = [ "line block with blank line" =:
102102 , " def func(x):"
103103 , " return y"
104104 ] =?>
105− ( doc $ codeBlockWith
105+ doc (codeBlockWith
106106 ( ""
107107 , ["sourceCode", "python", "numberLines", "class1", "class2", "class3"]
108108 , [ ("startFrom", "34") ]
109109 )
110− "def func(x):\n return y"
111− )
110+ "def func(x):\n return y")
112111 , "Code directive with number-lines, no line specified" =: T.unlines
113112 [ ".. code::python"
114113 , " :number-lines: "
@@ -116,13 +115,12 @@ tests = [ "line block with blank line" =:
116115 , " def func(x):"
117116 , " return y"
118117 ] =?>
119− ( doc $ codeBlockWith
118+ doc (codeBlockWith
120119 ( ""
121120 , ["sourceCode", "python", "numberLines"]
122121 , [ ("startFrom", "") ]
123122 )
124− "def func(x):\n return y"
125− )
123+ "def func(x):\n return y")
126124 , testGroup "literal / line / code blocks"
127125 [ "indented literal block" =: T.unlines
128126 [ "::"
@@ -131,7 +129,8 @@ tests = [ "line block with blank line" =:
131129 , ""
132130 , " can go on for many lines"
133131 , "but must stop here"]
134− =?> (doc $
132+ =?>
133+ doc (
135134 codeBlock "block quotes\n\ncan go on for many lines" <>
136135 para "but must stop here")
137136 , "line block with 3 lines" =: "| a\n| b\n| c"
@@ -185,6 +184,6 @@ tests = [ "line block with blank line" =:
185184 , ".. [1]"
186185 , " bar"
187186 ] =?>
188− (para $ "foo" <> (note $ para "bar"))
187+ para ("foo" <> (note $ para "bar"))
189188 ]
190189 ]
test/Tests/Readers/Txt2Tags.hs+4−4
@@ -30,11 +30,11 @@ simpleTable' :: Int
3030 -> [Blocks]
3131 -> [[Blocks]]
3232 -> Blocks
33−simpleTable' n = table "" (take n $ repeat (AlignCenter, 0.0))
33+simpleTable' n = table "" (replicate n (AlignCenter, 0.0))
3434
3535tests :: [TestTree]
3636tests =
37− [ testGroup "Inlines" $
37+ [ testGroup "Inlines"
3838 [ "Plain String" =:
3939 "Hello, World" =?>
4040 para (spcSep [ "Hello,", "World" ])
@@ -114,7 +114,7 @@ tests =
114114
115115 ]
116116
117− , testGroup "Basic Blocks" $
117+ , testGroup "Basic Blocks"
118118 ["Paragraph, lines grouped together" =:
119119 "A paragraph\n A blank line ends the \n current paragraph\n"
120120 =?> para "A paragraph\n A blank line ends the\n current paragraph"
@@ -197,7 +197,7 @@ tests =
197197
198198 ]
199199
200− , testGroup "Lists" $
200+ , testGroup "Lists"
201201 [ "Simple Bullet Lists" =:
202202 ("- Item1\n" <>
203203 "- Item2\n") =?>
test/Tests/Shared.hs+18−18
@@ -19,21 +19,21 @@ tests = [ testGroup "compactifyDL"
1919
2020testCollapse :: [TestTree]
2121testCollapse = map (testCase "collapse")
22− [ (collapseFilePath (joinPath [ ""]) @?= (joinPath [ ""]))
23− , (collapseFilePath (joinPath [ ".","foo"]) @?= (joinPath [ "foo"]))
24− , (collapseFilePath (joinPath [ ".",".","..","foo"]) @?= (joinPath [ joinPath ["..", "foo"]]))
25− , (collapseFilePath (joinPath [ "..","foo"]) @?= (joinPath [ "..","foo"]))
26− , (collapseFilePath (joinPath [ "","bar","..","baz"]) @?= (joinPath [ "","baz"]))
27− , (collapseFilePath (joinPath [ "","..","baz"]) @?= (joinPath [ "","..","baz"]))
28− , (collapseFilePath (joinPath [ ".","foo","..",".","bar","..",".",".","baz"]) @?= (joinPath [ "baz"]))
29− , (collapseFilePath (joinPath [ ".",""]) @?= (joinPath [ ""]))
30− , (collapseFilePath (joinPath [ ".",".",""]) @?= (joinPath [ ""]))
31− , (collapseFilePath (joinPath [ "..",""]) @?= (joinPath [ ".."]))
32− , (collapseFilePath (joinPath [ "..",".",""]) @?= (joinPath [ ".."]))
33− , (collapseFilePath (joinPath [ ".","..",""]) @?= (joinPath [ ".."]))
34− , (collapseFilePath (joinPath [ "..","..",""]) @?= (joinPath [ "..",".."]))
35− , (collapseFilePath (joinPath [ "parent","foo","baz","..","bar"]) @?= (joinPath [ "parent","foo","bar"]))
36− , (collapseFilePath (joinPath [ "parent","foo","baz","..","..","bar"]) @?= (joinPath [ "parent","bar"]))
37− , (collapseFilePath (joinPath [ "parent","foo",".."]) @?= (joinPath [ "parent"]))
38− , (collapseFilePath (joinPath [ "","parent","foo","..","..","bar"]) @?= (joinPath [ "","bar"]))
39− , (collapseFilePath (joinPath [ "",".","parent","foo"]) @?= (joinPath [ "","parent","foo"]))]
22+ [ collapseFilePath (joinPath [ ""]) @?= (joinPath [ ""])
23+ , collapseFilePath (joinPath [ ".","foo"]) @?= (joinPath [ "foo"])
24+ , collapseFilePath (joinPath [ ".",".","..","foo"]) @?= (joinPath [ joinPath ["..", "foo"]])
25+ , collapseFilePath (joinPath [ "..","foo"]) @?= (joinPath [ "..","foo"])
26+ , collapseFilePath (joinPath [ "","bar","..","baz"]) @?= (joinPath [ "","baz"])
27+ , collapseFilePath (joinPath [ "","..","baz"]) @?= (joinPath [ "","..","baz"])
28+ , collapseFilePath (joinPath [ ".","foo","..",".","bar","..",".",".","baz"]) @?= (joinPath [ "baz"])
29+ , collapseFilePath (joinPath [ ".",""]) @?= (joinPath [ ""])
30+ , collapseFilePath (joinPath [ ".",".",""]) @?= (joinPath [ ""])
31+ , collapseFilePath (joinPath [ "..",""]) @?= (joinPath [ ".."])
32+ , collapseFilePath (joinPath [ "..",".",""]) @?= (joinPath [ ".."])
33+ , collapseFilePath (joinPath [ ".","..",""]) @?= (joinPath [ ".."])
34+ , collapseFilePath (joinPath [ "..","..",""]) @?= (joinPath [ "..",".."])
35+ , collapseFilePath (joinPath [ "parent","foo","baz","..","bar"]) @?= (joinPath [ "parent","foo","bar"])
36+ , collapseFilePath (joinPath [ "parent","foo","baz","..","..","bar"]) @?= (joinPath [ "parent","bar"])
37+ , collapseFilePath (joinPath [ "parent","foo",".."]) @?= (joinPath [ "parent"])
38+ , collapseFilePath (joinPath [ "","parent","foo","..","..","bar"]) @?= (joinPath [ "","bar"])
39+ , collapseFilePath (joinPath [ "",".","parent","foo"]) @?= (joinPath [ "","parent","foo"])]
test/Tests/Writers/ConTeXt.hs+3−4
@@ -41,9 +41,9 @@ tests = [ testGroup "inline code"
4141 , "without '}'" =: code "]" =?> "\\type{]}"
4242 , testProperty "code property" $ \s -> null s ||
4343 if '{' `elem` s || '}' `elem` s
44− then (context' $ code s) == "\\mono{" ++
45− (context' $ str s) ++ "}"
46− else (context' $ code s) == "\\type{" ++ s ++ "}"
44+ then context' (code s) == "\\mono{" ++
45+ context' (str s) ++ "}"
46+ else context' (code s) == "\\type{" ++ s ++ "}"
4747 ]
4848 , testGroup "headers"
4949 [ "level 1" =:
@@ -124,4 +124,3 @@ tests = [ testGroup "inline code"
124124 , "\\stopplacetable" ]
125125 ]
126126 ]
127−
test/Tests/Writers/Docbook.hs+1−1
@@ -230,7 +230,7 @@ tests = [ testGroup "line blocks"
230230 ]
231231 ]
232232 ]
233− , testGroup "writer options" $
233+ , testGroup "writer options"
234234 [ testGroup "top-level division" $
235235 let
236236 headers = header 1 (text "header1")
test/Tests/Writers/FB2.hs+1−1
@@ -23,7 +23,7 @@ tests = [ testGroup "block elements"
2323 ]
2424 , testGroup "inlines"
2525 [
26− "Emphasis" =: emph ("emphasized")
26+ "Emphasis" =: emph "emphasized"
2727 =?> fb2 "<emphasis>emphasized</emphasis>"
2828 ]
2929 , "bullet list" =: bulletList [ plain $ text "first"
test/Tests/Writers/JATS.hs−2
@@ -120,5 +120,3 @@ tests = [ testGroup "inline code"
120120 \</sec>"
121121 ]
122122 ]
123−
124−
test/Tests/Writers/Markdown.hs+21−21
@@ -80,7 +80,7 @@ noteTestDoc =
8080 ".") <>
8181 blockQuote (para ("A note inside a block quote." <>
8282 note (para "The second note.")) <>
83− para ("A second paragraph.")) <>
83+ para "A second paragraph.") <>
8484 header 1 "Second Header" <>
8585 para "Some more text."
8686
@@ -91,7 +91,7 @@ noteTests = testGroup "note and reference location"
9191 [ test (markdownWithOpts defopts)
9292 "footnotes at the end of a document" $
9393 noteTestDoc =?>
94− (unlines $ [ "First Header"
94+ (unlines [ "First Header"
9595 , "============"
9696 , ""
9797 , "This is a footnote.[^1] And this is a [link](https://www.google.com)."
@@ -112,7 +112,7 @@ noteTests = testGroup "note and reference location"
112112 , test (markdownWithOpts defopts{writerReferenceLocation=EndOfBlock})
113113 "footnotes at the end of blocks" $
114114 noteTestDoc =?>
115− (unlines $ [ "First Header"
115+ (unlines [ "First Header"
116116 , "============"
117117 , ""
118118 , "This is a footnote.[^1] And this is a [link](https://www.google.com)."
@@ -133,7 +133,7 @@ noteTests = testGroup "note and reference location"
133133 , test (markdownWithOpts defopts{writerReferenceLocation=EndOfBlock, writerReferenceLinks=True})
134134 "footnotes and reference links at the end of blocks" $
135135 noteTestDoc =?>
136− (unlines $ [ "First Header"
136+ (unlines [ "First Header"
137137 , "============"
138138 , ""
139139 , "This is a footnote.[^1] And this is a [link]."
@@ -156,7 +156,7 @@ noteTests = testGroup "note and reference location"
156156 , test (markdownWithOpts defopts{writerReferenceLocation=EndOfSection})
157157 "footnotes at the end of section" $
158158 noteTestDoc =?>
159− (unlines $ [ "First Header"
159+ (unlines [ "First Header"
160160 , "============"
161161 , ""
162162 , "This is a footnote.[^1] And this is a [link](https://www.google.com)."
@@ -186,27 +186,27 @@ shortcutLinkRefsTests =
186186 (=:) = test (purely (writeMarkdown defopts{writerReferenceLinks = True}) . toPandoc)
187187 in testGroup "Shortcut reference links"
188188 [ "Simple link (shortcutable)"
189− =: (para (link "/url" "title" "foo"))
189+ =: para (link "/url" "title" "foo")
190190 =?> "[foo]\n\n [foo]: /url \"title\""
191191 , "Followed by another link (unshortcutable)"
192− =: (para ((link "/url1" "title1" "first")
193− <> (link "/url2" "title2" "second")))
192+ =: para ((link "/url1" "title1" "first")
193+ <> (link "/url2" "title2" "second"))
194194 =?> unlines [ "[first][][second]"
195195 , ""
196196 , " [first]: /url1 \"title1\""
197197 , " [second]: /url2 \"title2\""
198198 ]
199199 , "Followed by space and another link (unshortcutable)"
200− =: (para ((link "/url1" "title1" "first") <> " "
201− <> (link "/url2" "title2" "second")))
200+ =: para ((link "/url1" "title1" "first") <> " "
201+ <> (link "/url2" "title2" "second"))
202202 =?> unlines [ "[first][] [second]"
203203 , ""
204204 , " [first]: /url1 \"title1\""
205205 , " [second]: /url2 \"title2\""
206206 ]
207207 , "Reference link is used multiple times (unshortcutable)"
208− =: (para ((link "/url1" "" "foo") <> (link "/url2" "" "foo")
209− <> (link "/url3" "" "foo")))
208+ =: para ((link "/url1" "" "foo") <> (link "/url2" "" "foo")
209+ <> (link "/url3" "" "foo"))
210210 =?> unlines [ "[foo][][foo][1][foo][2]"
211211 , ""
212212 , " [foo]: /url1"
@@ -214,8 +214,8 @@ shortcutLinkRefsTests =
214214 , " [2]: /url3"
215215 ]
216216 , "Reference link is used multiple times (unshortcutable)"
217− =: (para ((link "/url1" "" "foo") <> " " <> (link "/url2" "" "foo")
218− <> " " <> (link "/url3" "" "foo")))
217+ =: para ((link "/url1" "" "foo") <> " " <> (link "/url2" "" "foo")
218+ <> " " <> (link "/url3" "" "foo"))
219219 =?> unlines [ "[foo][] [foo][1] [foo][2]"
220220 , ""
221221 , " [foo]: /url1"
@@ -223,43 +223,43 @@ shortcutLinkRefsTests =
223223 , " [2]: /url3"
224224 ]
225225 , "Reference link is followed by text in brackets"
226− =: (para ((link "/url" "" "link") <> "[text in brackets]"))
226+ =: para ((link "/url" "" "link") <> "[text in brackets]")
227227 =?> unlines [ "[link][]\\[text in brackets\\]"
228228 , ""
229229 , " [link]: /url"
230230 ]
231231 , "Reference link is followed by space and text in brackets"
232− =: (para ((link "/url" "" "link") <> " [text in brackets]"))
232+ =: para ((link "/url" "" "link") <> " [text in brackets]")
233233 =?> unlines [ "[link][] \\[text in brackets\\]"
234234 , ""
235235 , " [link]: /url"
236236 ]
237237 , "Reference link is followed by RawInline"
238− =: (para ((link "/url" "" "link") <> rawInline "markdown" "[rawText]"))
238+ =: para ((link "/url" "" "link") <> rawInline "markdown" "[rawText]")
239239 =?> unlines [ "[link][][rawText]"
240240 , ""
241241 , " [link]: /url"
242242 ]
243243 , "Reference link is followed by space and RawInline"
244− =: (para ((link "/url" "" "link") <> space <> rawInline "markdown" "[rawText]"))
244+ =: para ((link "/url" "" "link") <> space <> rawInline "markdown" "[rawText]")
245245 =?> unlines [ "[link][] [rawText]"
246246 , ""
247247 , " [link]: /url"
248248 ]
249249 , "Reference link is followed by RawInline with space"
250− =: (para ((link "/url" "" "link") <> rawInline "markdown" " [rawText]"))
250+ =: para ((link "/url" "" "link") <> rawInline "markdown" " [rawText]")
251251 =?> unlines [ "[link][] [rawText]"
252252 , ""
253253 , " [link]: /url"
254254 ]
255255 , "Reference link is followed by citation"
256− =: (para ((link "/url" "" "link") <> cite [Citation "author" [] [] NormalCitation 0 0] (str "[@author]")))
256+ =: para ((link "/url" "" "link") <> cite [Citation "author" [] [] NormalCitation 0 0] (str "[@author]"))
257257 =?> unlines [ "[link][][@author]"
258258 , ""
259259 , " [link]: /url"
260260 ]
261261 , "Reference link is followed by space and citation"
262− =: (para ((link "/url" "" "link") <> space <> cite [Citation "author" [] [] NormalCitation 0 0] (str "[@author]")))
262+ =: para ((link "/url" "" "link") <> space <> cite [Citation "author" [] [] NormalCitation 0 0] (str "[@author]"))
263263 =?> unlines [ "[link][] [@author]"
264264 , ""
265265 , " [link]: /url"
test/Tests/Writers/Native.hs+1−1
@@ -18,5 +18,5 @@ p_write_blocks_rt bs =
1818tests :: [TestTree]
1919tests = [ testProperty "p_write_rt" p_write_rt
2020 , testProperty "p_write_blocks_rt" $ mapSize
21− (\x -> if x > 3 then 3 else x) $ p_write_blocks_rt
21+ (\x -> if x > 3 then 3 else x) p_write_blocks_rt
2222 ]
test/Tests/Writers/Powerpoint.hs+6−6
@@ -72,7 +72,7 @@ numSlideTests = testGroup "Number of slides in output"
7272 def
7373 (doc $
7474 para "first slide" <>
75− (para $ image "lalune.jpg" "" "") <>
75+ para (image "lalune.jpg" "" "") <>
7676 para "foo")
7777 , testNumberOfSlides
7878 "With image slide, header" 3
@@ -80,14 +80,14 @@ numSlideTests = testGroup "Number of slides in output"
8080 (doc $
8181 para "first slide" <>
8282 header 2 "image header" <>
83− (para $ image "lalune.jpg" "" "") <>
83+ para (image "lalune.jpg" "" "") <>
8484 para "foo")
8585 , testNumberOfSlides
8686 "With table, no header" 3
8787 def
8888 (doc $
8989 para "first slide" <>
90− (simpleTable [para "foo" <> para "bar"] [[para "this" <> para "that"]]) <>
90+ simpleTable [para "foo" <> para "bar"] [[para "this" <> para "that"]] <>
9191 para "foo")
9292 , testNumberOfSlides
9393 "With table, header" 3
@@ -95,7 +95,7 @@ numSlideTests = testGroup "Number of slides in output"
9595 (doc $
9696 para "first slide" <>
9797 header 2 "table header" <>
98− (simpleTable [para "foo" <> para "bar"] [[para "this" <> para "that"]]) <>
98+ simpleTable [para "foo" <> para "bar"] [[para "this" <> para "that"]] <>
9999 para "foo")
100100 , testNumberOfSlides
101101 "hrule" 2
@@ -117,7 +117,7 @@ contentTypesFileExists opts pd =
117117 testCase "Existence of [Content_Types].xml file" $
118118 do archive <- getPptxArchive opts pd
119119 assertBool "Missing [Content_Types].xml file" $
120− "[Content_Types].xml" `elem` (filesInArchive archive)
120+ "[Content_Types].xml" `elem` filesInArchive archive
121121
122122
123123
@@ -138,7 +138,7 @@ prop_ContentOverrides pd = do
138138 Nothing -> throwIO $
139139 PandocSomeError "Missing [Content_Types].xml file"
140140 typesElem <- case parseXMLDoc contentTypes of
141− Just element -> return $ element
141+ Just element -> return element
142142 Nothing -> throwIO $
143143 PandocSomeError "[Content_Types].xml cannot be parsed"
144144 let ns = findAttr (QName "xmlns" Nothing Nothing) typesElem
test/Tests/Writers/TEI.hs+1−1
@@ -31,7 +31,7 @@ tests = [ testGroup "block elements"
3131 ]
3232 , testGroup "inlines"
3333 [
34− "Emphasis" =: emph ("emphasized")
34+ "Emphasis" =: emph "emphasized"
3535 =?> "<p><hi rendition=\"simple:italic\">emphasized</hi></p>"
3636 ,"SingleQuoted" =: singleQuoted (text "quoted material")
3737 =?> "<p><quote>quoted material</quote></p>"