aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs21
-rw-r--r--tests/textile-reader.native2
2 files changed, 13 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs
index f19d68e64..81994e6bd 100644
--- a/src/Text/Pandoc/Readers/Textile.hs
+++ b/src/Text/Pandoc/Readers/Textile.hs
@@ -604,15 +604,18 @@ ungroupedSimpleInline border construct = try $ do
guard $ (stateQuoteContext st /= NoQuote)
|| (sourceColumn pos == 1)
|| isWhitespace
- body <- surrounded border inlineWithAttribute
- lookAhead (notFollowedBy alphaNum)
- let result = construct $ mconcat body
- return $ if isWhitespace then B.space <> result
- else result
- where
- inlineWithAttribute = (try $ optional attributes) >> notFollowedBy (string "\n\n")
- >> (withQuoteContext InSingleQuote inline)
-
+ border *> notFollowedBy (oneOf " \t\n\r")
+ attr <- attributes
+ body <- trimInlines . mconcat <$>
+ withQuoteContext InSingleQuote
+ (manyTill inline (try border <* notFollowedBy alphaNum))
+ let result = construct $
+ if attr == nullAttr
+ then body
+ else B.spanWith attr body
+ return $ if isWhitespace
+ then B.space <> result
+ else result
groupedSimpleInline :: Parser [Char] ParserState t
-> (Inlines -> Inlines)
diff --git a/tests/textile-reader.native b/tests/textile-reader.native
index 88fc0bb47..a17bd8de1 100644
--- a/tests/textile-reader.native
+++ b/tests/textile-reader.native
@@ -124,7 +124,7 @@ Pandoc (Meta {unMeta = fromList []})
,Para [Str "Textile",Space,Str "inline",Space,Str "image",Space,Str "syntax,",Space,Str "like",LineBreak,Str "here",Space,Image [Str "this is the alt text"] ("this_is_an_image.png","this is the alt text"),LineBreak,Str "and",Space,Str "here",Space,Image [Str ""] ("this_is_an_image.png",""),Str "."]
,Header 1 ("attributes",[],[]) [Str "Attributes"]
,Header 2 ("ident",["bar","foo"],[("style","color:red"),("lang","en")]) [Str "HTML",Space,Str "and",Space,Str "CSS",Space,Str "attributes",Space,Str "are",Space,Str "parsed",Space,Str "in",Space,Str "headers."]
-,Para [Str "as",Space,Str "well",Space,Str "as",Space,Strong [Str "inline",Space,Str "attributes"],Space,Str "of",Space,Str "all",Space,Str "kind"]
+,Para [Str "as",Space,Str "well",Space,Str "as",Space,Strong [Span ("",["foo"],[]) [Str "inline",Space,Str "attributes"]],Space,Str "of",Space,Span ("",[],[("style","color:red")]) [Str "all",Space,Str "kind"]]
,Para [Str "and",Space,Str "paragraph",Space,Str "attributes,",Space,Str "and",Space,Str "table",Space,Str "attributes."]
,Table [] [AlignDefault,AlignDefault,AlignDefault] [0.0,0.0,0.0]
[]