git.iko.soy/typeable/pandoc
on master help sign in
hlint fixes.
commitdfa1dc164a15389e00c86b8d97d71646827a74cf authorJohn MacFarlane <jgm@berkeley.edu> dateSat 17 Mar 2018, 22:00 (9 years ago) parent73f9ba4
18 files changed+40−41
src/Text/Pandoc/ImageSize.hs+5−5 src/Text/Pandoc/Lua/Util.hs+1−1 src/Text/Pandoc/Readers/Docx.hs+1−1 src/Text/Pandoc/Readers/Docx/Parse.hs+2−2 src/Text/Pandoc/Readers/Markdown.hs+1−1 src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs+4−4 src/Text/Pandoc/Writers/Docx.hs+3−3 src/Text/Pandoc/Writers/DokuWiki.hs+2−2 src/Text/Pandoc/Writers/EPUB.hs+2−2 src/Text/Pandoc/Writers/Haddock.hs+2−2 src/Text/Pandoc/Writers/Muse.hs+2−2 src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+10−10 src/Text/Pandoc/Writers/Shared.hs+1−1 test/Tests/Old.hs−1 test/Tests/Readers/Muse.hs+1−1 test/Tests/Readers/RST.hs+1−1 test/Tests/Readers/Txt2Tags.hs+1−1 test/Tests/Writers/RST.hs+1−1
src/Text/Pandoc/ImageSize.hs+5−5
@@ -126,7 +126,7 @@ imageType img = case B.take 4 img of
126126 | B.take 4 (B.drop 1 $ B.dropWhile (/=' ') img) == "EPSF"
127127 -> return Eps
128128 "\x01\x00\x00\x00"
129− | B.take 4 (B.drop 40 img) == " EMF"
129+ | B.take 4 (B.drop 40 img) == " EMF"
130130 -> return Emf
131131 _ -> mzero
132132
@@ -361,9 +361,9 @@ svgSize opts img = do
361361 , dpiX = dpi
362362 , dpiY = dpi
363363 }
364−
364+
365365emfSize :: ByteString -> Maybe ImageSize
366−emfSize img =
366+emfSize img =
367367 let
368368 parseheader = runGetOrFail $ do
369369 skip 0x18 -- 0x00
@@ -388,11 +388,11 @@ emfSize img =
388388 , dpiX = fromIntegral dpiW
389389 , dpiY = fromIntegral dpiH
390390 }
391− in
391+ in
392392 case parseheader . BL.fromStrict $ img of
393393 Left _ -> Nothing
394394 Right (_, _, size) -> Just size
395−
395+
396396
397397jpegSize :: ByteString -> Either String ImageSize
398398jpegSize img =
src/Text/Pandoc/Lua/Util.hs+1−1
@@ -132,7 +132,7 @@ class PushViaCall a where
132132instance PushViaCall (Lua ()) where
133133 pushViaCall' fn pushArgs num = do
134134 Lua.push fn
135− Lua.rawget (Lua.registryindex)
135+ Lua.rawget Lua.registryindex
136136 pushArgs
137137 call num 1
138138
src/Text/Pandoc/Readers/Docx.hs+1−1
@@ -367,7 +367,7 @@ blocksToInlinesWarn cmtId blks = do
367367parPartToInlines :: PandocMonad m => ParPart -> DocxContext m Inlines
368368parPartToInlines parPart =
369369 case parPart of
370− (BookMark _ anchor) | notElem anchor dummyAnchors -> do
370+ (BookMark _ anchor) | anchor `notElem` dummyAnchors -> do
371371 inHdrBool <- asks docxInHeaderBlock
372372 ils <- parPartToInlines' parPart
373373 immedPrevAnchor <- gets docxImmedPrevAnchor
src/Text/Pandoc/Readers/Docx/Parse.hs+2−2
@@ -136,9 +136,9 @@ unwrap :: NameSpaces -> Content -> [Content]
136136unwrap ns (Elem element)
137137 | isElem ns "w" "sdt" element
138138 , Just sdtContent <- findChildByName ns "w" "sdtContent" element
139− = concatMap (unwrap ns) $ map Elem $ elChildren sdtContent
139+ = concatMap ((unwrap ns) . Elem) (elChildren sdtContent)
140140 | isElem ns "w" "smartTag" element
141− = concatMap (unwrap ns) $ map Elem $ elChildren element
141+ = concatMap ((unwrap ns) . Elem) (elChildren element)
142142unwrap _ content = [content]
143143
144144unwrapChild :: NameSpaces -> Content -> Content
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -161,7 +161,7 @@ inlinesInBalancedBrackets =
161161 stripBracket xs = if last xs == ']' then init xs else xs
162162 go :: PandocMonad m => Int -> MarkdownParser m ()
163163 go 0 = return ()
164− go openBrackets =
164+ go openBrackets =
165165 (() <$ (escapedChar <|>
166166 code <|>
167167 rawHtmlInline <|>
src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs+4−4
@@ -61,13 +61,13 @@ and6 :: (Arrow a)
6161 => a b c0->a b c1->a b c2->a b c3->a b c4->a b c5
6262 -> a b (c0,c1,c2,c3,c4,c5 )
6363
64−and3 a b c = (and2 a b ) &&& c
64+and3 a b c = and2 a b &&& c
6565 >>^ \((z,y ) , x) -> (z,y,x )
66−and4 a b c d = (and3 a b c ) &&& d
66+and4 a b c d = and3 a b c &&& d
6767 >>^ \((z,y,x ) , w) -> (z,y,x,w )
68−and5 a b c d e = (and4 a b c d ) &&& e
68+and5 a b c d e = and4 a b c d &&& e
6969 >>^ \((z,y,x,w ) , v) -> (z,y,x,w,v )
70−and6 a b c d e f = (and5 a b c d e ) &&& f
70+and6 a b c d e f = and5 a b c d e &&& f
7171 >>^ \((z,y,x,w,v ) , u) -> (z,y,x,w,v,u )
7272
7373liftA2 :: (Arrow a) => (x -> y -> z) -> a b x -> a b y -> a b z
src/Text/Pandoc/Writers/Docx.hs+3−3
@@ -1337,7 +1337,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
13371337 imgElt
13381338
13391339 case stImage of
1340− Just imgData -> return $ [generateImgElt imgData]
1340+ Just imgData -> return [generateImgElt imgData]
13411341 Nothing -> ( do --try
13421342 (img, mt) <- P.fetchItem src
13431343 ident <- ("rId"++) `fmap` getUniqueId
@@ -1386,12 +1386,12 @@ breakElement kind = mknode "w:r" [] [mknode "w:br" [("w:type",kind)] () ]
13861386defaultFootnotes :: [Element]
13871387defaultFootnotes = [ mknode "w:footnote"
13881388 [("w:type", "separator"), ("w:id", "-1")]
1389− [ mknode "w:p" [] $
1389+ [ mknode "w:p" []
13901390 [mknode "w:r" [] $
13911391 [ mknode "w:separator" [] ()]]]
13921392 , mknode "w:footnote"
13931393 [("w:type", "continuationSeparator"), ("w:id", "0")]
1394− [ mknode "w:p" [] $
1394+ [ mknode "w:p" []
13951395 [ mknode "w:r" [] $
13961396 [ mknode "w:continuationSeparator" [] ()]]]]
13971397
src/Text/Pandoc/Writers/DokuWiki.hs+2−2
@@ -372,9 +372,9 @@ backSlashLineBreaks :: [String] -> String
372372backSlashLineBreaks ls = vcatBackSlash $ map escape ls
373373 where
374374 vcatBackSlash = intercalate "\\\\ \\\\ " -- simulate paragraphs.
375− escape ('\n':[]) = "" -- remove trailing newlines
375+ escape ['\n'] = "" -- remove trailing newlines
376376 escape ('\n':cs) = "\\\\ " ++ escape cs
377− escape (c:cs) = c : (escape cs)
377+ escape (c:cs) = c : escape cs
378378 escape [] = []
379379
380380-- Auxiliary functions for tables:
src/Text/Pandoc/Writers/EPUB.hs+2−2
@@ -458,7 +458,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do
458458 -- mediaRef <- P.newIORef []
459459 Pandoc _ blocks <- walkM (transformInline opts') doc >>=
460460 walkM transformBlock
461− picEntries <- (mapMaybe (snd . snd)) <$> gets stMediaPaths
461+ picEntries <- mapMaybe (snd . snd) <$> gets stMediaPaths
462462 -- handle fonts
463463 let matchingGlob f = do
464464 xs <- lift $ P.glob f
@@ -872,7 +872,7 @@ metadataElement version md currentTime =
872872 dcTag' n s = [dcTag n s]
873873 toIdentifierNode id' (Identifier txt scheme)
874874 | version == EPUB2 = [dcNode "identifier" !
875− ([("id",id')] ++ maybe [] (\x -> [("opf:scheme", x)]) scheme) $
875+ (("id",id') : maybe [] (\x -> [("opf:scheme", x)]) scheme) $
876876 txt]
877877 | otherwise = [dcNode "identifier" ! [("id",id')] $ txt] ++
878878 maybe [] (\x -> [unode "meta" !
src/Text/Pandoc/Writers/Haddock.hs+2−2
@@ -1,6 +1,6 @@
11{-# LANGUAGE OverloadedStrings #-}
22{-# LANGUAGE ScopedTypeVariables #-}
3−{-# LANGUAGE TupleSections #-}
3+
44{-
55Copyright (C) 2014-2015, 2017-2018 John MacFarlane <jgm@berkeley.edu>
66
@@ -141,7 +141,7 @@ blockToHaddock opts (Table caption aligns widths headers rows) = do
141141 then empty
142142 else blankline <> caption' <> blankline
143143 tbl <- gridTable opts blockListToHaddock
144− (all null headers) (map (\_ -> AlignDefault) aligns)
144+ (all null headers) (map (const AlignDefault) aligns)
145145 widths headers rows
146146 return $ prefixed "> " (tbl $$ blankline $$ caption'') $$ blankline
147147blockToHaddock opts (BulletList items) = do
src/Text/Pandoc/Writers/Muse.hs+2−2
@@ -373,7 +373,7 @@ inlineToMuse (Superscript lst) = do
373373inlineToMuse (Subscript lst) = do
374374 contents <- inlineListToMuse lst
375375 return $ "<sub>" <> contents <> "</sub>"
376−inlineToMuse (SmallCaps {}) =
376+inlineToMuse SmallCaps {} =
377377 fail "SmallCaps should be expanded before normalization"
378378inlineToMuse (Quoted SingleQuote lst) = do
379379 contents <- inlineListToMuse lst
@@ -381,7 +381,7 @@ inlineToMuse (Quoted SingleQuote lst) = do
381381inlineToMuse (Quoted DoubleQuote lst) = do
382382 contents <- inlineListToMuse lst
383383 return $ "“" <> contents <> "”"
384−inlineToMuse (Cite {}) =
384+inlineToMuse Cite {} =
385385 fail "Citations should be expanded before normalization"
386386inlineToMuse (Code _ str) = return $
387387 "<code>" <> text (substitute "</code>" "<</code><code>/code>" str) <> "</code>"
src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+10−10
@@ -474,7 +474,7 @@ blockToParagraphs (DefinitionList entries) = do
474474 definition <- concatMapM (blockToParagraphs . BlockQuote) blksLst
475475 return $ term ++ definition
476476 concatMapM go entries
477−blockToParagraphs (Div (_, "notes" : [], _) blks) =
477+blockToParagraphs (Div (_, ["notes"], _) blks) =
478478 local (\env -> env{envInSpeakerNotes=True}) $ do
479479 sldId <- asks envCurSlideId
480480 spkNotesMap <- gets stSpeakerNotesMap
@@ -558,7 +558,7 @@ blockToShape blk = do paras <- blockToParagraphs blk
558558combineShapes :: [Shape] -> [Shape]
559559combineShapes [] = []
560560combineShapes[s] = [s]
561−combineShapes (pic@(Pic{}) : ss) = pic : combineShapes ss
561+combineShapes (pic@Pic{} : ss) = pic : combineShapes ss
562562combineShapes (TextBox [] : ss) = combineShapes ss
563563combineShapes (s : TextBox [] : ss) = combineShapes (s : ss)
564564combineShapes (TextBox (p:ps) : TextBox (p':ps') : ss) =
@@ -569,8 +569,8 @@ blocksToShapes :: [Block] -> Pres [Shape]
569569blocksToShapes blks = combineShapes <$> mapM blockToShape blks
570570
571571isImage :: Inline -> Bool
572−isImage (Image{}) = True
573−isImage (Link _ (Image _ _ _ : _) _) = True
572+isImage Image{} = True
573+isImage (Link _ (Image{} : _) _) = True
574574isImage _ = False
575575
576576splitBlocks' :: [Block] -> [[Block]] -> [Block] -> Pres [[Block]]
@@ -589,23 +589,23 @@ splitBlocks' cur acc (Plain ils : blks) = splitBlocks' cur acc (Para ils : blks)
589589splitBlocks' cur acc (Para (il:ils) : blks) | isImage il = do
590590 slideLevel <- asks envSlideLevel
591591 case cur of
592− [(Header n _ _)] | n == slideLevel ->
592+ [Header n _ _] | n == slideLevel ->
593593 splitBlocks' []
594594 (acc ++ [cur ++ [Para [il]]])
595595 (if null ils then blks else Para ils : blks)
596596 _ -> splitBlocks' []
597597 (acc ++ (if null cur then [] else [cur]) ++ [[Para [il]]])
598598 (if null ils then blks else Para ils : blks)
599−splitBlocks' cur acc (tbl@(Table{}) : blks) = do
599+splitBlocks' cur acc (tbl@Table{} : blks) = do
600600 slideLevel <- asks envSlideLevel
601601 case cur of
602− [(Header n _ _)] | n == slideLevel ->
602+ [Header n _ _] | n == slideLevel ->
603603 splitBlocks' [] (acc ++ [cur ++ [tbl]]) blks
604604 _ -> splitBlocks' [] (acc ++ (if null cur then [] else [cur]) ++ [[tbl]]) blks
605605splitBlocks' cur acc (d@(Div (_, classes, _) _): blks) | "columns" `elem` classes = do
606606 slideLevel <- asks envSlideLevel
607607 case cur of
608− [(Header n _ _)] | n == slideLevel ->
608+ [Header n _ _] | n == slideLevel ->
609609 splitBlocks' [] (acc ++ [cur ++ [d]]) blks
610610 _ -> splitBlocks' [] (acc ++ (if null cur then [] else [cur]) ++ [[d]]) blks
611611splitBlocks' cur acc (blk : blks) = splitBlocks' (cur ++ [blk]) acc blks
@@ -617,7 +617,7 @@ getSpeakerNotes :: Pres (Maybe SpeakerNotes)
617617getSpeakerNotes = do
618618 sldId <- asks envCurSlideId
619619 spkNtsMap <- gets stSpeakerNotesMap
620− return $ (SpeakerNotes . concat . reverse) <$> (M.lookup sldId spkNtsMap)
620+ return $ (SpeakerNotes . concat . reverse) <$> M.lookup sldId spkNtsMap
621621
622622blocksToSlide' :: Int -> [Block] -> Pres Slide
623623blocksToSlide' lvl (Header n (ident, _, _) ils : blks)
@@ -864,7 +864,7 @@ emptyParagraph para = all emptyParaElem $ paraElems para
864864
865865
866866emptyShape :: Shape -> Bool
867−emptyShape (TextBox paras) = all emptyParagraph $ paras
867+emptyShape (TextBox paras) = all emptyParagraph paras
868868emptyShape _ = False
869869
870870emptyLayout :: Layout -> Bool
src/Text/Pandoc/Writers/Shared.hs+1−1
@@ -289,7 +289,7 @@ gridTable opts blocksToDoc headless aligns widths headers rows = do
289289 -- on command line options, widths given in this specific table, and
290290 -- cells' contents
291291 let handleWidths
292− | (writerWrapText opts) == WrapNone = handleFullWidths
292+ | writerWrapText opts == WrapNone = handleFullWidths
293293 | all (== 0) widths = handleZeroWidths
294294 | otherwise = handleGivenWidths widths
295295 (widthsInChars, rawHeaders, rawRows) <- handleWidths
test/Tests/Old.hs−1
@@ -286,4 +286,3 @@ findDynlibDir :: [FilePath] -> Maybe FilePath
286286findDynlibDir [] = Nothing
287287findDynlibDir ("build":xs) = Just $ joinPath (reverse xs) </> "build"
288288findDynlibDir (_:xs) = findDynlibDir xs
289−
test/Tests/Readers/Muse.hs+1−1
@@ -175,7 +175,7 @@ tests =
175175 , "Class tag without name" =: "<class>foobar</class>" =?> para (spanWith ("", [], []) "foobar")
176176
177177 -- <em> tag should match with the last </em> tag, not verbatim one
178− , "Nested \"</em>\" inside em tag" =: "<em>foo<verbatim></em></verbatim>bar</em>" =?> para (emph ("foo</em>bar"))
178+ , "Nested \"</em>\" inside em tag" =: "<em>foo<verbatim></em></verbatim>bar</em>" =?> para (emph "foo</em>bar")
179179
180180 , testGroup "Links"
181181 [ "Link without description" =:
test/Tests/Readers/RST.hs+1−1
@@ -184,6 +184,6 @@ tests = [ "line block with blank line" =:
184184 , ".. [1]"
185185 , " bar"
186186 ] =?>
187− para ("foo" <> (note $ para "bar"))
187+ para ("foo" <> note (para "bar"))
188188 ]
189189 ]
test/Tests/Readers/Txt2Tags.hs+1−1
@@ -143,7 +143,7 @@ tests =
143143
144144 , "Header with label" =:
145145 "= header =[label]" =?>
146− headerWith ("label", [], []) 1 ("header")
146+ headerWith ("label", [], []) 1 "header"
147147
148148 , "Invalid header, mismatched delimiters" =:
149149 "== header =" =?>
test/Tests/Writers/RST.hs+1−1
@@ -61,7 +61,7 @@ tests = [ testGroup "rubrics"
6161 -- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup
6262 strong (space <> str "text" <> space <> space) =?> "**text**"
6363 , "single space stripped" =:
64− strong (space) =?> ""
64+ strong space =?> ""
6565 ]
6666 , testGroup "headings"
6767 [ "normal heading" =: