"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Text/Pandoc/Readers/Man.hs" between
pandoc-2.11.1.1.tar.gz and pandoc-2.11.2.tar.gz

About: Pandoc converts files from one markup format into another.

Man.hs  (pandoc-2.11.1.1):Man.hs  (pandoc-2.11.2)
skipping to change at line 409 skipping to change at line 409
else return $ mconcat $ intersperse B.space else return $ mconcat $ intersperse B.space
$ map linePartsToInlines args $ map linePartsToInlines args
let lvl = if name == "SH" then 1 else 2 let lvl = if name == "SH" then 1 else 2
return $ header lvl contents return $ header lvl contents
parseBlockQuote :: PandocMonad m => ManParser m Blocks parseBlockQuote :: PandocMonad m => ManParser m Blocks
parseBlockQuote = blockQuote <$> continuation parseBlockQuote = blockQuote <$> continuation
data ListType = Ordered ListAttributes data ListType = Ordered ListAttributes
| Bullet | Bullet
| Definition T.Text
listTypeMatches :: Maybe ListType -> ListType -> Bool listTypeMatches :: Maybe ListType -> ListType -> Bool
listTypeMatches Nothing _ = True listTypeMatches Nothing _ = True
listTypeMatches (Just Bullet) Bullet = True listTypeMatches (Just Bullet) Bullet = True
listTypeMatches (Just (Ordered (_,x,y))) (Ordered (_,x',y')) listTypeMatches (Just (Ordered (_,x,y))) (Ordered (_,x',y'))
= x == x' && y == y' = x == x' && y == y'
listTypeMatches (Just (Definition _)) (Definition _) = True
listTypeMatches (Just _) _ = False listTypeMatches (Just _) _ = False
listItem :: PandocMonad m => Maybe ListType -> ManParser m (ListType, Blocks) listItem :: PandocMonad m => Maybe ListType -> ManParser m (ListType, Blocks)
listItem mbListType = try $ do listItem mbListType = try $ do
(ControlLine _ args _) <- mmacro "IP" (ControlLine _ args _) <- mmacro "IP"
case args of case args of
(arg1 : _) -> do (arg1 : _) -> do
let cs = linePartsToText arg1 let cs = linePartsToText arg1
let cs' = if not (T.any (== '.') cs || T.any (== ')') cs) then cs <> "." e lse cs let cs' = if not (T.any (== '.') cs || T.any (== ')') cs) then cs <> "." e lse cs
let lt = case Parsec.runParser anyOrderedListMarker defaultParserState let lt = case Parsec.runParser anyOrderedListMarker defaultParserState
"list marker" cs' of "list marker" cs' of
Right (start, listtype, listdelim) Right (start, listtype, listdelim)
| cs == cs' -> Ordered (start, listtype, listdelim) | cs == cs' -> Ordered (start, listtype, listdelim)
| otherwise -> Ordered (start, listtype, DefaultDelim) | otherwise -> Ordered (start, listtype, DefaultDelim)
Left _ -> Bullet Left _
| cs == "\183" || cs == "-" || cs == "*" || cs == "+"
-> Bullet
| otherwise -> Definition cs
guard $ listTypeMatches mbListType lt guard $ listTypeMatches mbListType lt
skipMany memptyLine
inls <- option mempty parseInlines inls <- option mempty parseInlines
skipMany memptyLine
continuations <- mconcat <$> many continuation continuations <- mconcat <$> many continuation
return (lt, para inls <> continuations) return (lt, para inls <> continuations)
[] -> mzero [] -> mzero
parseList :: PandocMonad m => ManParser m Blocks parseList :: PandocMonad m => ManParser m Blocks
parseList = try $ do parseList = try $ do
(lt, x) <- listItem Nothing x@(lt, _) <- listItem Nothing
xs <- map snd <$> many (listItem (Just lt)) xs <- many (listItem (Just lt))
let toDefItem (Definition t, bs) = (B.text t, [bs])
toDefItem _ = mempty
return $ case lt of return $ case lt of
Bullet -> bulletList (x:xs) Bullet -> bulletList $ map snd (x:xs)
Ordered lattr -> orderedListWith lattr (x:xs) Ordered lattr -> orderedListWith lattr $ map snd (x:xs)
Definition _ -> definitionList $ map toDefItem (x:xs)
continuation :: PandocMonad m => ManParser m Blocks continuation :: PandocMonad m => ManParser m Blocks
continuation = continuation =
mconcat <$> (mmacro "RS" *> manyTill parseBlock (endmacro "RE")) mconcat <$> (mmacro "RS" *> manyTill parseBlock (endmacro "RE"))
<|> mconcat <$> many1 ( try (bareIP *> parsePara) <|> mconcat <$> many1 ( try (bareIP *> parsePara)
<|> try (bareIP *> parseCodeBlock) <|> try (bareIP *> parseCodeBlock)
) )
definitionListItem :: PandocMonad m definitionListItem :: PandocMonad m
=> ManParser m (Inlines, [Blocks]) => ManParser m (Inlines, [Blocks])
definitionListItem = try $ do definitionListItem = try $ do
mmacro "TP" -- args specify indent level, can ignore mmacro "TP" -- args specify indent level, can ignore
skipMany memptyLine
term <- parseInline term <- parseInline
skipMany memptyLine
moreterms <- many $ try $ do moreterms <- many $ try $ do
mmacro "TQ" mmacro "TQ"
parseInline parseInline
skipMany memptyLine
inls <- option mempty parseInlines inls <- option mempty parseInlines
skipMany memptyLine
continuations <- mconcat <$> many continuation continuations <- mconcat <$> many continuation
return ( mconcat (intersperse B.linebreak (term:moreterms)) return ( mconcat (intersperse B.linebreak (term:moreterms))
, [para inls <> continuations]) , [para inls <> continuations])
parseDefinitionList :: PandocMonad m => ManParser m Blocks parseDefinitionList :: PandocMonad m => ManParser m Blocks
parseDefinitionList = definitionList <$> many1 definitionListItem parseDefinitionList = definitionList <$> many1 definitionListItem
parseLink :: PandocMonad m => [Arg] -> ManParser m Inlines parseLink :: PandocMonad m => [Arg] -> ManParser m Inlines
parseLink args = do parseLink args = do
contents <- mconcat <$> many lineInl contents <- mconcat <$> many lineInl
 End of changes. 11 change blocks. 
5 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)