Markdown reader: Allow reference link labels starting with @...

...if citations extension disabled.  Example:  in

    [link text][@a]

    [@a]: url

`link text` isn't hyperlinked because `[@a]` is parsed as a citation.
Previously this happened whether or not the `citations` extension was
enabled. Now it happens only if the `citations` extension is enabled.

Closes #3209.
This commit is contained in:
John MacFarlane 2016-11-05 21:14:20 +01:00
parent 7db4dd46dc
commit eced02d70e

View file

@ -1774,7 +1774,8 @@ referenceLink :: (Attr -> String -> String -> Inlines -> Inlines)
referenceLink constructor (lab, raw) = do
sp <- (True <$ lookAhead (char ' ')) <|> return False
(_,raw') <- option (mempty, "") $
lookAhead (try (spnl >> normalCite >> return (mempty, "")))
lookAhead (try (guardEnabled Ext_citations >>
spnl >> normalCite >> return (mempty, "")))
<|>
try (spnl >> reference)
when (raw' == "") $ guardEnabled Ext_shortcut_reference_links