@@ -468,11 +468,21 @@ paraUntil end = do
468468 guard $ not inPara
469469 first (fmap B. para) <$> paraContentsUntil end
470470
471- noteMarker :: PandocMonad m => MuseParser m String
472- noteMarker = try $ (:)
473- <$ char ' ['
474- <*> oneOf " 123456789"
475- <*> manyTill digit (char ' ]' )
471+ noteBrackets :: NoteType -> (Char , Char )
472+ noteBrackets nt =
473+ case nt of
474+ Endnote -> (' {' , ' }' )
475+ _ -> (' [' , ' ]' )
476+
477+ noteMarker :: PandocMonad m => NoteType -> MuseParser m (NoteType , String )
478+ noteMarker nt = try $ do
479+ char l
480+ m <- (:) <$> oneOf " 123456789" <*> manyTill digit (char r)
481+ return (nt, [l] ++ m ++ [r])
482+ where (l, r) = noteBrackets nt
483+
484+ anyNoteMarker :: PandocMonad m => MuseParser m (NoteType , String )
485+ anyNoteMarker = noteMarker Footnote <|> noteMarker Endnote
476486
477487addNote :: PandocMonad m
478488 => String
@@ -492,7 +502,7 @@ amuseNoteBlockUntil :: PandocMonad m
492502 -> MuseParser m (F Blocks , a )
493503amuseNoteBlockUntil end = try $ do
494504 guardEnabled Ext_amuse
495- ref <- noteMarker
505+ (_, ref) <- anyNoteMarker
496506 pos <- getPosition
497507 void spaceChar <|> lookAhead eol
498508 (content, e) <- allowPara $ listItemContentsUntil (sourceColumn pos) (fail " x" ) end
@@ -504,14 +514,14 @@ amuseNoteBlockUntil end = try $ do
504514emacsNoteBlock :: PandocMonad m => MuseParser m (F Blocks )
505515emacsNoteBlock = try $ do
506516 guardDisabled Ext_amuse
507- ref <- noteMarker
517+ (_, ref) <- anyNoteMarker
508518 pos <- getPosition
509519 content <- fmap mconcat blocksTillNote
510520 addNote ref pos content
511521 return mempty
512522 where
513523 blocksTillNote =
514- many1Till parseBlock (eof <|> () <$ lookAhead noteMarker )
524+ many1Till parseBlock (eof <|> () <$ lookAhead anyNoteMarker )
515525
516526--
517527-- Verse markup
@@ -750,15 +760,15 @@ footnote :: PandocMonad m => MuseParser m (F Inlines)
750760footnote = try $ do
751761 inLink <- asks museInLink
752762 guard $ not inLink
753- ref <- noteMarker
763+ (notetype, ref) <- anyNoteMarker
754764 return $ do
755765 notes <- asksF museNotes
756766 case M. lookup ref notes of
757- Nothing -> return $ B. str $ " [ " ++ ref ++ " ] "
767+ Nothing -> return $ B. str ref
758768 Just (_pos, contents) -> do
759769 st <- askF
760770 let contents' = runF contents st { museNotes = M. delete ref (museNotes st) }
761- return $ B. note contents'
771+ return $ B. singleton $ Note notetype $ B. toList contents'
762772
763773whitespace :: PandocMonad m => MuseParser m (F Inlines )
764774whitespace = try $ pure B. space <$ skipMany1 spaceChar
0 commit comments