aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-09-12 08:58:47 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-09-12 08:58:47 -0700
commit4177ee86261f624232cf6022d28dba573af128fd (patch)
tree6e03650c27877ca3e043c3e9e9773fc8bd195612 /src
parent2e2795412def2f1f7c01b0b719b4d15a9b6f20f4 (diff)
downloadpandoc-4177ee86261f624232cf6022d28dba573af128fd.tar.gz
Textile reader: allow 'pre' code in list item.
Closes #3916.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index 853d2768f..9cd3d2c36 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -178,7 +178,6 @@ codeBlockPre :: PandocMonad m => ParserT [Char] ParserState m Blocks
codeBlockPre = try $ do
(t@(TagOpen _ attrs),_) <- htmlTag (tagOpen (=="pre") (const True))
result' <- manyTill anyChar (htmlTag (tagClose (=="pre")))
- optional blanklines
-- drop leading newline if any
let result'' = case result' of
'\n':xs -> xs
@@ -262,10 +261,11 @@ orderedListItemAtDepth = genericListItemAtDepth '#'
genericListItemAtDepth :: PandocMonad m => Char -> Int -> ParserT [Char] ParserState m Blocks
genericListItemAtDepth c depth = try $ do
count depth (char c) >> attributes >> whitespace
- p <- mconcat <$> many listInline
+ contents <- mconcat <$> many ((B.plain . mconcat <$> many1 inline) <|>
+ try (newline >> codeBlockPre))
newline
sublist <- option mempty (anyListAtDepth (depth + 1))
- return $ (B.plain p) <> sublist
+ return $ contents <> sublist
-- | A definition list is a set of consecutive definition items
definitionList :: PandocMonad m => ParserT [Char] ParserState m Blocks
@@ -295,10 +295,6 @@ definitionListStart = try $ do
<|> try (lookAhead (() <$ string ":="))
)
-listInline :: PandocMonad m => ParserT [Char] ParserState m Inlines
-listInline = try (notFollowedBy newline >> inline)
- <|> try (endline <* notFollowedBy listStart)
-
-- | A definition list item in textile begins with '- ', followed by
-- the term defined, then spaces and ":=". The definition follows, on
-- the same single line, or spaned on multiple line, after a line
@@ -310,7 +306,7 @@ definitionListItem = try $ do
return (term, def')
where inlineDef :: PandocMonad m => ParserT [Char] ParserState m [Blocks]
inlineDef = liftM (\d -> [B.plain d])
- $ optional whitespace >> (trimInlines . mconcat <$> many listInline) <* newline
+ $ optional whitespace >> (trimInlines . mconcat <$> many inline) <* newline
multilineDef :: PandocMonad m => ParserT [Char] ParserState m [Blocks]
multilineDef = try $ do
optional whitespace >> newline