From c4814ea965704ffb3bc7cf5e918a2fc342d401b3 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 18 Feb 2019 15:09:29 +0300 Subject: Muse reader: add secondary note support --- src/Text/Pandoc/Readers/Muse.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Readers/Muse.hs') diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index ba476f7d7..012eb017d 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -481,11 +481,17 @@ paraUntil end = do guard $ not inPara first (fmap B.para) <$> paraContentsUntil end -noteMarker :: PandocMonad m => MuseParser m String -noteMarker = try $ (:) - <$ char '[' +noteMarker' :: PandocMonad m + => Char + -> Char + -> MuseParser m String +noteMarker' l r = try $ (\x y -> l:x:y ++ [r]) + <$ char l <*> oneOf "123456789" - <*> manyTill digit (char ']') + <*> manyTill digit (char r) + +noteMarker :: PandocMonad m => MuseParser m String +noteMarker = noteMarker' '[' ']' <|> noteMarker' '{' '}' addNote :: PandocMonad m => String @@ -797,7 +803,7 @@ footnote = try $ do return $ do notes <- asksF museNotes case M.lookup ref notes of - Nothing -> return $ B.str $ "[" ++ ref ++ "]" + Nothing -> return $ B.str $ ref Just (_pos, contents) -> do st <- askF let contents' = runF contents st { museNotes = M.delete ref (museNotes st) } -- cgit v1.2.3