aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-12-20 14:00:30 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2017-12-20 14:00:30 +0300
commitb5e62a5c0963cf10338170a94f6a5a2c5b39ad1d (patch)
treeee79f94f2ad598c41e9cc1c068364af50c1414a4
parentac202e648b1c72e55737dc1e71ed94937ad5e835 (diff)
downloadpandoc-b5e62a5c0963cf10338170a94f6a5a2c5b39ad1d.tar.gz
Muse reader: require that note references does not start with 0
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs4
-rw-r--r--test/Tests/Readers/Muse.hs14
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 46dcf38d9..1ea78676b 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -336,7 +336,9 @@ para = do
noteMarker :: PandocMonad m => MuseParser m String
noteMarker = try $ do
char '['
- many1Till digit $ char ']'
+ first <- oneOf "123456789"
+ rest <- manyTill digit (char ']')
+ return $ first:rest
-- Amusewiki version of note
-- Parsing is similar to list item, except that note marker is used instead of list marker
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 41d1d9710..513b54a65 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -505,6 +505,20 @@ tests =
] =?>
para (text "Start recursion here" <>
note (para "Recursion continues here[1]"))
+ , "No zero footnotes" =:
+ T.unlines [ "Here is a footnote[0]."
+ , ""
+ , "[0] Footnote contents"
+ ] =?>
+ para "Here is a footnote[0]." <>
+ para "[0] Footnote contents"
+ , "Footnotes can't start with zero" =:
+ T.unlines [ "Here is a footnote[01]."
+ , ""
+ , "[01] Footnote contents"
+ ] =?>
+ para "Here is a footnote[01]." <>
+ para "[01] Footnote contents"
, testGroup "Multiparagraph footnotes"
[ "Amusewiki multiparagraph footnotes" =:
T.unlines [ "Multiparagraph[1] footnotes[2]"