Markdown reader: don't parse footnote body unless extension enabled.
This commit is contained in:
parent
cbcaf19174
commit
3982b23428
1 changed files with 20 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue