git.iko.soy/typeable/pandoc
on master help sign in
hlint
a553bafAlexander Krotov
src/Text/Pandoc/Readers/Markdown.hs+11−11
@@ -1419,7 +1419,7 @@ tableWith headerParser rowParser lineParser footerParser = try $ do
1419 lines' <- fmap sequence $ rowParser indices `sepEndBy1` lineParser
1419 lines' <- fmap sequence $ rowParser indices `sepEndBy1` lineParser
1420 footerParser
1420 footerParser
1421 numColumns <- getOption readerColumns
1421 numColumns <- getOption readerColumns
1422− let widths = if indices == []
1422+ let widths = if null indices
1423 then replicate (length aligns) 0.0
1423 then replicate (length aligns) 0.0
1424 else widthsFromIndices numColumns indices
1424 else widthsFromIndices numColumns indices
1425 return (aligns, widths, heads, lines')
1425 return (aligns, widths, heads, lines')
@@ -2006,7 +2006,7 @@ cite = do
2006 guardEnabled Ext_citations
2006 guardEnabled Ext_citations
2007 textualCite
2007 textualCite
2008 <|> do (cs, raw) <- withRaw normalCite
2008 <|> do (cs, raw) <- withRaw normalCite
2009− return $ (flip B.cite (B.text raw)) <$> cs
2009+ return $ flip B.cite (B.text raw) <$> cs
2010
2010
2011textualCite :: PandocMonad m => MarkdownParser m (F Inlines)
2011textualCite :: PandocMonad m => MarkdownParser m (F Inlines)
2012textualCite = try $ do
2012textualCite = try $ do
@@ -2093,15 +2093,15 @@ citation = try $ do
2093 return $ do
2093 return $ do
2094 x <- pref
2094 x <- pref
2095 y <- suff
2095 y <- suff
2096− return $ Citation{ citationId = key
2096+ return Citation{ citationId = key
2097− , citationPrefix = B.toList x
2097+ , citationPrefix = B.toList x
2098− , citationSuffix = B.toList y
2098+ , citationSuffix = B.toList y
2099− , citationMode = if suppress_author
2099+ , citationMode = if suppress_author
2100− then SuppressAuthor
2100+ then SuppressAuthor
2101− else NormalCitation
2101+ else NormalCitation
2102− , citationNoteNum = 0
2102+ , citationNoteNum = 0
2103− , citationHash = 0
2103+ , citationHash = 0
2104− }
2104+ }
2105
2105
2106smart :: PandocMonad m => MarkdownParser m (F Inlines)
2106smart :: PandocMonad m => MarkdownParser m (F Inlines)
2107smart = do
2107smart = do
src/Text/Pandoc/Readers/Odt/Arrows/State.hs+1−1
@@ -82,7 +82,7 @@ tryModifyState f = ArrowState $ \(state,a)
82
82
83instance Cat.Category (ArrowState s) where
83instance Cat.Category (ArrowState s) where
84 id = ArrowState id
84 id = ArrowState id
85− arrow2 . arrow1 = ArrowState $ (runArrowState arrow2).(runArrowState arrow1)
85+ arrow2 . arrow1 = ArrowState $ runArrowState arrow2 . runArrowState arrow1
86
86
87instance Arrow (ArrowState state) where
87instance Arrow (ArrowState state) where
88 arr = ignoringState
88 arr = ignoringState
src/Text/Pandoc/Readers/Odt/ContentReader.hs+4−4
@@ -293,7 +293,7 @@ withNewStyle a = proc x -> do
293 modifier <- arr modifierFromStyleDiff -< triple
293 modifier <- arr modifierFromStyleDiff -< triple
294 fShouldTrace <- isStyleToTrace -< style
294 fShouldTrace <- isStyleToTrace -< style
295 case fShouldTrace of
295 case fShouldTrace of
296− Right shouldTrace -> do
296+ Right shouldTrace ->
297 if shouldTrace
297 if shouldTrace
298 then do
298 then do
299 pushStyle -< style
299 pushStyle -< style
@@ -357,7 +357,7 @@ modifierFromStyleDiff propertyTriple =
357 hasChangedM property triple@(_, textProps,_) =
357 hasChangedM property triple@(_, textProps,_) =
358 fromMaybe False $ (/=) <$> property textProps <*> lookupPreviousValueM property triple
358 fromMaybe False $ (/=) <$> property textProps <*> lookupPreviousValueM property triple
359
359
360− lookupPreviousValue f = lookupPreviousStyleValue ((fmap f).textProperties)
360+ lookupPreviousValue f = lookupPreviousStyleValue (fmap f . textProperties)
361
361
362 lookupPreviousValueM f = lookupPreviousStyleValue ((f =<<).textProperties)
362 lookupPreviousValueM f = lookupPreviousStyleValue ((f =<<).textProperties)
363
363
@@ -803,9 +803,9 @@ read_frame_text_box = matchingElement NsDraw "text-box"
803 arr read_img_with_caption -< toList paragraphs
803 arr read_img_with_caption -< toList paragraphs
804
804
805read_img_with_caption :: [Block] -> Inlines
805read_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)]) : _) =
807 singleton (Image attr alt (src, 'f':'i':'g':':':title)) -- no text, default caption
807 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) : _) =
809 singleton (Image attr txt (src, 'f':'i':'g':':':title) ) -- override caption with the text that follows
809 singleton (Image attr txt (src, 'f':'i':'g':':':title) ) -- override caption with the text that follows
810read_img_with_caption ( (Para (_ : xs)) : ys) =
810read_img_with_caption ( (Para (_ : xs)) : ys) =
811 read_img_with_caption ((Para xs) : ys)
811 read_img_with_caption ((Para xs) : ys)
src/Text/Pandoc/Readers/Textile.hs+4−5
@@ -387,7 +387,7 @@ table = try $ do
387 char '.'
387 char '.'
388 rawcapt <- trim <$> anyLine
388 rawcapt <- trim <$> anyLine
389 parseFromString' (mconcat <$> many inline) rawcapt
389 parseFromString' (mconcat <$> many inline) rawcapt
390− rawrows <- many1 $ (skipMany ignorableRow) >> tableRow
390+ rawrows <- many1 $ skipMany ignorableRow >> tableRow
391 skipMany ignorableRow
391 skipMany ignorableRow
392 blanklines
392 blanklines
393 let (headers, rows) = case rawrows of
393 let (headers, rows) = case rawrows of
@@ -438,8 +438,7 @@ maybeExplicitBlock name blk = try $ do
438
438
439-- | Any inline element
439-- | Any inline element
440inline :: PandocMonad m => ParserT [Char] ParserState m Inlines
440inline :: PandocMonad m => ParserT [Char] ParserState m Inlines
441−inline = do
442− choice inlineParsers <?> "inline"
441+inline = choice inlineParsers <?> "inline"
443
442
444-- | Inline parsers tried in order
443-- | Inline parsers tried in order
445inlineParsers :: PandocMonad m => [ParserT [Char] ParserState m Inlines]
444inlineParsers :: PandocMonad m => [ParserT [Char] ParserState m Inlines]
@@ -610,7 +609,7 @@ escapedInline = escapedEqs <|> escapedTag
610
609
611escapedEqs :: PandocMonad m => ParserT [Char] ParserState m Inlines
610escapedEqs :: PandocMonad m => ParserT [Char] ParserState m Inlines
612escapedEqs = B.str <$>
611escapedEqs = B.str <$>
613− (try $ string "==" *> manyTill anyChar' (try $ string "=="))
612+ try (string "==" *> manyTill anyChar' (try $ string "=="))
614
613
615-- | literal text escaped btw <notextile> tags
614-- | literal text escaped btw <notextile> tags
616escapedTag :: PandocMonad m => ParserT [Char] ParserState m Inlines
615escapedTag :: PandocMonad m => ParserT [Char] ParserState m Inlines
@@ -643,7 +642,7 @@ code2 = do
643
642
644-- | Html / CSS attributes
643-- | Html / CSS attributes
645attributes :: PandocMonad m => ParserT [Char] ParserState m Attr
644attributes :: PandocMonad m => ParserT [Char] ParserState m Attr
646−attributes = (foldl (flip ($)) ("",[],[])) <$>
645+attributes = foldl (flip ($)) ("",[],[]) <$>
647 try (do special <- option id specialAttribute
646 try (do special <- option id specialAttribute
648 attrs <- many attribute
647 attrs <- many attribute
649 return (special : attrs))
648 return (special : attrs))
src/Text/Pandoc/Readers/TikiWiki.hs+3−5
@@ -501,7 +501,7 @@ escapedChar = try $ do
501 string "~"
501 string "~"
502 inner <- many1 $ oneOf "0123456789"
502 inner <- many1 $ oneOf "0123456789"
503 string "~"
503 string "~"
504− return $B.str [(toEnum ((read inner) :: Int)) :: Char]
504+ return $B.str [(toEnum (read inner :: Int)) :: Char]
505
505
506-- UNSUPPORTED, as there doesn't seem to be any facility in calibre
506-- UNSUPPORTED, as there doesn't seem to be any facility in calibre
507-- for this
507-- for this
@@ -587,8 +587,7 @@ macroAttr = try $ do
587 return (key, value)
587 return (key, value)
588
588
589macroAttrs :: PandocMonad m => TikiWikiParser m [(String, String)]
589macroAttrs :: PandocMonad m => TikiWikiParser m [(String, String)]
590−macroAttrs = try $ do
591− sepEndBy macroAttr spaces
590+macroAttrs = try $ sepEndBy macroAttr spaces
592
591
593-- ~np~ __not bold__ ~/np~
592-- ~np~ __not bold__ ~/np~
594noparse :: PandocMonad m => TikiWikiParser m B.Inlines
593noparse :: PandocMonad m => TikiWikiParser m B.Inlines
@@ -641,8 +640,7 @@ wikiLinkText start middle end = do
641 where
640 where
642 linkContent = do
641 linkContent = do
643 char '|'
642 char '|'
644− mystr <- many (noneOf middle)
643+ many (noneOf middle)
645− return mystr
646
644
647externalLink :: PandocMonad m => TikiWikiParser m B.Inlines
645externalLink :: PandocMonad m => TikiWikiParser m B.Inlines
648externalLink = makeLink "[" "]|" "]"
646externalLink = makeLink "[" "]|" "]"
src/Text/Pandoc/Readers/Txt2Tags.hs+1−1
@@ -560,7 +560,7 @@ endline = try $ do
560 notFollowedBy quote
560 notFollowedBy quote
561 notFollowedBy list
561 notFollowedBy list
562 notFollowedBy table
562 notFollowedBy table
563− return $ B.softbreak
563+ return B.softbreak
564
564
565str :: T2T Inlines
565str :: T2T Inlines
566str = try $ do
566str = try $ do
src/Text/Pandoc/Writers/AsciiDoc.hs+1−1
@@ -219,7 +219,7 @@ blockToAsciiDoc opts (Table caption aligns widths headers rows) = do
219 AlignCenter -> "^"
219 AlignCenter -> "^"
220 AlignRight -> ">"
220 AlignRight -> ">"
221 AlignDefault -> "") ++
221 AlignDefault -> "") ++
222− if wi == 0 then "" else (show wi ++ "%")
222+ if wi == 0 then "" else show wi ++ "%"
223 let headerspec = if all null headers
223 let headerspec = if all null headers
224 then empty
224 then empty
225 else text "options=\"header\","
225 else text "options=\"header\","