git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: allow nested footnotes
4d89a1dAlexander Krotov
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -821,7 +821,7 @@ footnote = try $ do
821 Nothing -> return $ B.str $ "[" ++ ref ++ "]"
821 Nothing -> return $ B.str $ "[" ++ ref ++ "]"
822 Just (_pos, contents) -> do
822 Just (_pos, contents) -> do
823 st <- askF
823 st <- askF
824− let contents' = runF contents st { museNotes = M.empty }
824+ let contents' = runF contents st { museNotes = M.delete ref (museNotes st) }
825 return $ B.note contents'
825 return $ B.note contents'
826
826
827whitespace :: PandocMonad m => MuseParser m (F Inlines)
827whitespace :: PandocMonad m => MuseParser m (F Inlines)
test/Tests/Readers/Muse.hs+9
@@ -659,6 +659,15 @@ tests =
659 ] =?>
659 ] =?>
660 para (text "Start recursion here" <>
660 para (text "Start recursion here" <>
661 note (para "Recursion continues here[1]"))
661 note (para "Recursion continues here[1]"))
662+ , "Nested footnotes" =:
663+ T.unlines [ "Footnote: [1]"
664+ , ""
665+ , "[1] Nested: [2]"
666+ , ""
667+ , "[2] No recursion: [1]"
668+ ] =?>
669+ para (text "Footnote: " <>
670+ note (para (text "Nested: " <> note (para $ text "No recursion: [1]"))))
662 , "No zero footnotes" =:
671 , "No zero footnotes" =:
663 T.unlines [ "Here is a footnote[0]."
672 T.unlines [ "Here is a footnote[0]."
664 , ""
673 , ""