From 24f438aa5f230464d510fae034c94644c0e181ca Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 5 Apr 2014 21:02:12 -0700 Subject: Textile reader: Better support for attributes. Instead of being ignored, attributes are now parsed and included in Span inlines. The output will be a bit different from stock textile: e.g. for `*(foo)hi*`, we'll get `hi` instead of `hi`. But at least the data is not lost. --- src/Text/Pandoc/Readers/Textile.hs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/Text/Pandoc/Readers') 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) -- cgit v1.2.3