Muse reader: don't allow footnote references inside links

This commit is contained in:
Alexander Krotov 2018-04-15 17:40:36 +03:00
parent 17767bd29d
commit 01f5ed14e6
2 changed files with 5 additions and 0 deletions

View file

@ -822,6 +822,8 @@ anchor = try $ do
-- | Parse a footnote reference.
footnote :: PandocMonad m => MuseParser m (F Inlines)
footnote = try $ do
inLink <- museInLink <$> getState
guard $ not inLink
ref <- noteMarker
return $ do
notes <- asksF museNotes

View file

@ -210,6 +210,9 @@ tests =
, "No implicit links" =: "http://example.org/index.php?action=view&id=1"
=?> para "http://example.org/index.php?action=view&id=1"
, "Link with empty URL" =: "[[][empty URL]]" =?> para (link "" "" (text "empty URL"))
, "No footnotes inside links" =:
"[[https://amusewiki.org/][foo[1]]" =?>
para (link "https://amusewiki.org/" "" (text "foo[1"))
]
, testGroup "Literal"