Muse reader: allow nested footnotes

This commit is contained in:
Alexander Krotov 2018-04-26 12:29:45 +03:00
parent 73463b8239
commit 4d89a1db7f
2 changed files with 10 additions and 1 deletions

View file

@ -821,7 +821,7 @@ footnote = try $ do
Nothing -> return $ B.str $ "[" ++ ref ++ "]"
Just (_pos, contents) -> do
st <- askF
let contents' = runF contents st { museNotes = M.empty }
let contents' = runF contents st { museNotes = M.delete ref (museNotes st) }
return $ B.note contents'
whitespace :: PandocMonad m => MuseParser m (F Inlines)

View file

@ -659,6 +659,15 @@ tests =
] =?>
para (text "Start recursion here" <>
note (para "Recursion continues here[1]"))
, "Nested footnotes" =:
T.unlines [ "Footnote: [1]"
, ""
, "[1] Nested: [2]"
, ""
, "[2] No recursion: [1]"
] =?>
para (text "Footnote: " <>
note (para (text "Nested: " <> note (para $ text "No recursion: [1]"))))
, "No zero footnotes" =:
T.unlines [ "Here is a footnote[0]."
, ""