aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-08-12 21:20:07 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-08-12 21:20:07 +0300
commit81131ef5d19052948b4ac12a727e2ceef8a98186 (patch)
tree5f83eb066804ace386fb64803ac2637b8351239b
parentacf6df1aef337f71612f6d05c8aaa526255b3942 (diff)
downloadpandoc-81131ef5d19052948b4ac12a727e2ceef8a98186.tar.gz
Muse reader: don't allow digits after closing marker in lightweight markup
This change makes reader more compatible with Emacs Muse
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs4
-rw-r--r--test/Tests/Readers/Muse.hs4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 4bb34af7e..01f9be41f 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -43,7 +43,7 @@ import Prelude
import Control.Monad
import Control.Monad.Except (throwError)
import Data.Bifunctor
-import Data.Char (isLetter)
+import Data.Char (isLetter, isDigit)
import Data.Default
import Data.List (intercalate)
import Data.List.Split (splitOn)
@@ -841,7 +841,7 @@ enclosedInlines :: (PandocMonad m, Show a, Show b)
-> MuseParser m b
-> MuseParser m (F Inlines)
enclosedInlines start end = try $
- trimInlinesF . mconcat <$> (enclosed (atStart start) end inline <* notFollowedBy (satisfy isLetter))
+ trimInlinesF . mconcat <$> (enclosed (atStart start) end inline <* notFollowedBy (satisfy ((||) <$> isLetter <*> isDigit)))
-- | Parse an inline tag, such as @\<em>@ and @\<strong>@.
inlineTag :: PandocMonad m
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index fe25e9c5d..1035fb5f1 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -74,6 +74,10 @@ tests =
"Foo x*bar* baz" =?>
para "Foo x*bar* baz"
+ , "Digit after closing *" =:
+ "Foo *bar*0 baz" =?>
+ para "Foo *bar*0 baz"
+
, "Emphasis tag" =:
"<em>Foo bar</em>" =?>
para (emph . spcSep $ ["Foo", "bar"])