aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index f8349ea99..911105045 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -460,24 +460,26 @@ rawLines = do
return $ T.unlines (first:rest)
noteBlock :: PandocMonad m => MarkdownParser m (F Blocks)
-noteBlock = try $ do
- pos <- getPosition
- skipNonindentSpaces
- ref <- noteMarker
- char ':'
- optional blankline
- optional indentSpaces
- first <- rawLines
- rest <- many $ try $ blanklines >> indentSpaces >> rawLines
- let raw = T.unlines (first:rest) <> "\n"
- optional blanklines
- parsed <- parseFromString' parseBlocks raw
- oldnotes <- stateNotes' <$> getState
- case M.lookup ref oldnotes of
- Just _ -> logMessage $ DuplicateNoteReference ref pos
- Nothing -> return ()
- updateState $ \s -> s { stateNotes' = M.insert ref (pos, parsed) oldnotes }
- return mempty
+noteBlock = do
+ guardEnabled Ext_footnotes
+ do pos <- getPosition
+ skipNonindentSpaces
+ ref <- noteMarker
+ char ':'
+ optional blankline
+ optional indentSpaces
+ first <- rawLines
+ rest <- many $ try $ blanklines >> indentSpaces >> rawLines
+ let raw = T.unlines (first:rest) <> "\n"
+ optional blanklines
+ parsed <- parseFromString' parseBlocks raw
+ oldnotes <- stateNotes' <$> getState
+ case M.lookup ref oldnotes of
+ Just _ -> logMessage $ DuplicateNoteReference ref pos
+ Nothing -> return ()
+ updateState $ \s -> s { stateNotes' =
+ M.insert ref (pos, parsed) oldnotes }
+ return mempty
--
-- parsing blocks