@@ -501,6 +501,7 @@ inlineParsers = [ str
501501 , endline
502502 , code
503503 , escapedInline
504+ , spanGroup
504505 , inlineMarkup
505506 , groupedInlineMarkup
506507 , rawHtmlInline
@@ -525,9 +526,21 @@ inlineMarkup = choice [ simpleInline (string "??") (B.cite [])
525526 , simpleInline (char ' -' <* notFollowedBy (char ' -' )) B. strikeout
526527 , simpleInline (char ' ^' ) B. superscript
527528 , simpleInline (char ' ~' ) B. subscript
528- , simpleInline (char ' %' ) id
529529 ]
530530
531+ -- "The <span> tag is created by percent % signs between whitespaces."
532+ -- e.g. My mother has %{color:green;}green% eyes.
533+ spanGroup :: PandocMonad m => TextileParser m Inlines
534+ spanGroup = try $ do
535+ notAfterString >>= guard
536+ char ' %' *> notFollowedBy whitespace
537+ attr <- option nullAttr attributes
538+ contents <- mconcat <$> manyTill
539+ (try (((B. space <> ) <$> try (whitespace *> notFollowedBy newline *> inline))
540+ <|> try (notFollowedBy newline *> inline)))
541+ (try (char ' %' <* lookAhead (newline <|> ' ' <$ whitespace)))
542+ pure $ B. spanWith attr contents
543+
531544-- | Trademark, registered, copyright
532545mark :: PandocMonad m => TextileParser m Inlines
533546mark = try $ char ' (' >> (try tm <|> try reg <|> copy)
@@ -778,14 +791,14 @@ simpleInline :: PandocMonad m
778791 -> (Inlines -> Inlines ) -- ^ Inline constructor
779792 -> TextileParser m Inlines -- ^ content parser (to be used repeatedly)
780793simpleInline border construct = try $ do
781- notAfterString
794+ notAfterString >>= guard
782795 border *> notFollowedBy (oneOf " \t\n\r " )
783796 attr <- attributes
784797 body <- trimInlines . mconcat <$>
785798 withQuoteContext InSingleQuote
786799 (manyTill (((B. space <> ) <$>
787- (whitespace *> notFollowedBy newline >> inline))
788- <|> (notFollowedBy newline >> inline))
800+ try (whitespace *> notFollowedBy newline >> inline))
801+ <|> try (notFollowedBy newline >> inline))
789802 (try border <* notFollowedBy alphaNum))
790803 return $ construct $
791804 if attr == nullAttr
0 commit comments