git.iko.soy/typeable/pandoc
on master help sign in
hlint
commita553baf3a46e29d5137a8051838153c4fc83c6d5 authorAlexander Krotov <ilabdsf@gmail.com> dateThu 2 Nov 2017, 15:28 (9 years ago) parentfaa1b36
7 files changed+25−28
src/Text/Pandoc/Readers/Markdown.hs+11−11 src/Text/Pandoc/Readers/Odt/Arrows/State.hs+1−1 src/Text/Pandoc/Readers/Odt/ContentReader.hs+4−4 src/Text/Pandoc/Readers/Textile.hs+4−5 src/Text/Pandoc/Readers/TikiWiki.hs+3−5 src/Text/Pandoc/Readers/Txt2Tags.hs+1−1 src/Text/Pandoc/Writers/AsciiDoc.hs+1−1
src/Text/Pandoc/Readers/Markdown.hs+11−11
@@ -1419,7 +1419,7 @@ tableWith headerParser rowParser lineParser footerParser = try $ do
14191419 lines' <- fmap sequence $ rowParser indices `sepEndBy1` lineParser
14201420 footerParser
14211421 numColumns <- getOption readerColumns
1422− let widths = if indices == []
1422+ let widths = if null indices
14231423 then replicate (length aligns) 0.0
14241424 else widthsFromIndices numColumns indices
14251425 return (aligns, widths, heads, lines')
@@ -2006,7 +2006,7 @@ cite = do
20062006 guardEnabled Ext_citations
20072007 textualCite
20082008 <|> do (cs, raw) <- withRaw normalCite
2009− return $ (flip B.cite (B.text raw)) <$> cs
2009+ return $ flip B.cite (B.text raw) <$> cs
20102010
20112011textualCite :: PandocMonad m => MarkdownParser m (F Inlines)
20122012textualCite = try $ do
@@ -2093,15 +2093,15 @@ citation = try $ do
20932093 return $ do
20942094 x <- pref
20952095 y <- suff
2096− return $ Citation{ citationId = key
2097− , citationPrefix = B.toList x
2098− , citationSuffix = B.toList y
2099− , citationMode = if suppress_author
2100− then SuppressAuthor
2101− else NormalCitation
2102− , citationNoteNum = 0
2103− , citationHash = 0
2104− }
2096+ return Citation{ citationId = key
2097+ , citationPrefix = B.toList x
2098+ , citationSuffix = B.toList y
2099+ , citationMode = if suppress_author
2100+ then SuppressAuthor
2101+ else NormalCitation
2102+ , citationNoteNum = 0
2103+ , citationHash = 0
2104+ }
21052105
21062106smart :: PandocMonad m => MarkdownParser m (F Inlines)
21072107smart = do
src/Text/Pandoc/Readers/Odt/Arrows/State.hs+1−1
@@ -82,7 +82,7 @@ tryModifyState f = ArrowState $ \(state,a)
8282
8383instance Cat.Category (ArrowState s) where
8484 id = ArrowState id
85− arrow2 . arrow1 = ArrowState $ (runArrowState arrow2).(runArrowState arrow1)
85+ arrow2 . arrow1 = ArrowState $ runArrowState arrow2 . runArrowState arrow1
8686
8787instance Arrow (ArrowState state) where
8888 arr = ignoringState
src/Text/Pandoc/Readers/Odt/ContentReader.hs+4−4
@@ -293,7 +293,7 @@ withNewStyle a = proc x -> do
293293 modifier <- arr modifierFromStyleDiff -< triple
294294 fShouldTrace <- isStyleToTrace -< style
295295 case fShouldTrace of
296− Right shouldTrace -> do
296+ Right shouldTrace ->
297297 if shouldTrace
298298 then do
299299 pushStyle -< style
@@ -357,7 +357,7 @@ modifierFromStyleDiff propertyTriple =
357357 hasChangedM property triple@(_, textProps,_) =
358358 fromMaybe False $ (/=) <$> property textProps <*> lookupPreviousValueM property triple
359359
360− lookupPreviousValue f = lookupPreviousStyleValue ((fmap f).textProperties)
360+ lookupPreviousValue f = lookupPreviousStyleValue (fmap f . textProperties)
361361
362362 lookupPreviousValueM f = lookupPreviousStyleValue ((f =<<).textProperties)
363363
@@ -803,9 +803,9 @@ read_frame_text_box = matchingElement NsDraw "text-box"
803803 arr read_img_with_caption -< toList paragraphs
804804
805805read_img_with_caption :: [Block] -> Inlines
806−read_img_with_caption ((Para ((Image attr alt (src,title)) : [])) : _) =
806+read_img_with_caption ((Para [Image attr alt (src,title)]) : _) =
807807 singleton (Image attr alt (src, 'f':'i':'g':':':title)) -- no text, default caption
808−read_img_with_caption ((Para ((Image attr _ (src,title)) : txt)) : _) =
808+read_img_with_caption (Para (Image attr _ (src,title) : txt) : _) =
809809 singleton (Image attr txt (src, 'f':'i':'g':':':title) ) -- override caption with the text that follows
810810read_img_with_caption ( (Para (_ : xs)) : ys) =
811811 read_img_with_caption ((Para xs) : ys)
src/Text/Pandoc/Readers/Textile.hs+4−5
@@ -387,7 +387,7 @@ table = try $ do
387387 char '.'
388388 rawcapt <- trim <$> anyLine
389389 parseFromString' (mconcat <$> many inline) rawcapt
390− rawrows <- many1 $ (skipMany ignorableRow) >> tableRow
390+ rawrows <- many1 $ skipMany ignorableRow >> tableRow
391391 skipMany ignorableRow
392392 blanklines
393393 let (headers, rows) = case rawrows of
@@ -438,8 +438,7 @@ maybeExplicitBlock name blk = try $ do
438438
439439-- | Any inline element
440440inline :: PandocMonad m => ParserT [Char] ParserState m Inlines
441−inline = do
442− choice inlineParsers <?> "inline"
441+inline = choice inlineParsers <?> "inline"
443442
444443-- | Inline parsers tried in order
445444inlineParsers :: PandocMonad m => [ParserT [Char] ParserState m Inlines]
@@ -610,7 +609,7 @@ escapedInline = escapedEqs <|> escapedTag
610609
611610escapedEqs :: PandocMonad m => ParserT [Char] ParserState m Inlines
612611escapedEqs = B.str <$>
613− (try $ string "==" *> manyTill anyChar' (try $ string "=="))
612+ try (string "==" *> manyTill anyChar' (try $ string "=="))
614613
615614-- | literal text escaped btw <notextile> tags
616615escapedTag :: PandocMonad m => ParserT [Char] ParserState m Inlines
@@ -643,7 +642,7 @@ code2 = do
643642
644643-- | Html / CSS attributes
645644attributes :: PandocMonad m => ParserT [Char] ParserState m Attr
646−attributes = (foldl (flip ($)) ("",[],[])) <$>
645+attributes = foldl (flip ($)) ("",[],[]) <$>
647646 try (do special <- option id specialAttribute
648647 attrs <- many attribute
649648 return (special : attrs))
src/Text/Pandoc/Readers/TikiWiki.hs+3−5
@@ -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
@@ -587,8 +587,7 @@ macroAttr = try $ do
587587 return (key, value)
588588
589589macroAttrs :: PandocMonad m => TikiWikiParser m [(String, String)]
590−macroAttrs = try $ do
591− sepEndBy macroAttr spaces
590+macroAttrs = try $ sepEndBy macroAttr spaces
592591
593592-- ~np~ __not bold__ ~/np~
594593noparse :: PandocMonad m => TikiWikiParser m B.Inlines
@@ -641,8 +640,7 @@ wikiLinkText start middle end = do
641640 where
642641 linkContent = do
643642 char '|'
644− mystr <- many (noneOf middle)
645− return mystr
643+ many (noneOf middle)
646644
647645externalLink :: PandocMonad m => TikiWikiParser m B.Inlines
648646externalLink = makeLink "[" "]|" "]"
src/Text/Pandoc/Readers/Txt2Tags.hs+1−1
@@ -560,7 +560,7 @@ endline = try $ do
560560 notFollowedBy quote
561561 notFollowedBy list
562562 notFollowedBy table
563− return $ B.softbreak
563+ return B.softbreak
564564
565565str :: T2T Inlines
566566str = try $ do
src/Text/Pandoc/Writers/AsciiDoc.hs+1−1
@@ -219,7 +219,7 @@ blockToAsciiDoc opts (Table caption aligns widths headers rows) = do
219219 AlignCenter -> "^"
220220 AlignRight -> ">"
221221 AlignDefault -> "") ++
222− if wi == 0 then "" else (show wi ++ "%")
222+ if wi == 0 then "" else show wi ++ "%"
223223 let headerspec = if all null headers
224224 then empty
225225 else text "options=\"header\","