git.iko.soy/typeable/pandoc
on master help sign in
Textile reader: allow 'pre' code in list item.

Closes #3916.

commit4177ee86261f624232cf6022d28dba573af128fd authorJohn MacFarlane <jgm@berkeley.edu> dateTue 12 Sep 2017, 08:58 (9 years ago) parent2e27954
2 files changed+15−8
src/Text/Pandoc/Readers/Textile.hs+4−8 test/command/3916.md+11
src/Text/Pandoc/Readers/Textile.hs+4−8
@@ -178,7 +178,6 @@ codeBlockPre :: PandocMonad m => ParserT [Char] ParserState m Blocks
178178codeBlockPre = try $ do
179179 (t@(TagOpen _ attrs),_) <- htmlTag (tagOpen (=="pre") (const True))
180180 result' <- manyTill anyChar (htmlTag (tagClose (=="pre")))
181− optional blanklines
182181 -- drop leading newline if any
183182 let result'' = case result' of
184183 '\n':xs -> xs
@@ -262,10 +261,11 @@ orderedListItemAtDepth = genericListItemAtDepth '#'
262261genericListItemAtDepth :: PandocMonad m => Char -> Int -> ParserT [Char] ParserState m Blocks
263262genericListItemAtDepth c depth = try $ do
264263 count depth (char c) >> attributes >> whitespace
265− p <- mconcat <$> many listInline
264+ contents <- mconcat <$> many ((B.plain . mconcat <$> many1 inline) <|>
265+ try (newline >> codeBlockPre))
266266 newline
267267 sublist <- option mempty (anyListAtDepth (depth + 1))
268− return $ (B.plain p) <> sublist
268+ return $ contents <> sublist
269269
270270-- | A definition list is a set of consecutive definition items
271271definitionList :: PandocMonad m => ParserT [Char] ParserState m Blocks
@@ -295,10 +295,6 @@ definitionListStart = try $ do
295295 <|> try (lookAhead (() <$ string ":="))
296296 )
297297
298−listInline :: PandocMonad m => ParserT [Char] ParserState m Inlines
299−listInline = try (notFollowedBy newline >> inline)
300− <|> try (endline <* notFollowedBy listStart)
301−
302298-- | A definition list item in textile begins with '- ', followed by
303299-- the term defined, then spaces and ":=". The definition follows, on
304300-- the same single line, or spaned on multiple line, after a line
@@ -310,7 +306,7 @@ definitionListItem = try $ do
310306 return (term, def')
311307 where inlineDef :: PandocMonad m => ParserT [Char] ParserState m [Blocks]
312308 inlineDef = liftM (\d -> [B.plain d])
313− $ optional whitespace >> (trimInlines . mconcat <$> many listInline) <* newline
309+ $ optional whitespace >> (trimInlines . mconcat <$> many inline) <* newline
314310 multilineDef :: PandocMonad m => ParserT [Char] ParserState m [Blocks]
315311 multilineDef = try $ do
316312 optional whitespace >> newline
test/command/3916.mdnew file+11
@@ -0,0 +1,11 @@
1+```
2+% pandoc -f textile -t native
3+# text text
4+<pre>blabla</pre>
5+# more
6+^D
7+[OrderedList (1,DefaultStyle,DefaultDelim)
8+ [[Plain [Str "text",Space,Str "text"]
9+ ,CodeBlock ("",[],[]) "blabla"]
10+ ,[Plain [Str "more"]]]]
11+```