Markdown reader: fixed spurious parsing as citation as reference def.

We now disallow reference keys starting with `@` if the
`citations` extension is enabled.  Closes #3840.
This commit is contained in:
John MacFarlane 2017-08-07 21:00:57 -07:00
parent fd23b6dbce
commit 2c0e989f9d
2 changed files with 19 additions and 2 deletions

View file

@ -1695,8 +1695,10 @@ endline = try $ do
-- a reference label for a link
reference :: PandocMonad m => MarkdownParser m (F Inlines, String)
reference = do notFollowedBy' (string "[^") -- footnote reference
withRaw $ trimInlinesF <$> inlinesInBalancedBrackets
reference = do
guardDisabled Ext_footnotes <|> notFollowedBy' (string "[^")
guardDisabled Ext_citations <|> notFollowedBy' (string "[@")
withRaw $ trimInlinesF <$> inlinesInBalancedBrackets
parenthesizedChars :: PandocMonad m => MarkdownParser m [Char]
parenthesizedChars = do

15
test/command/3840.md Normal file
View file

@ -0,0 +1,15 @@
```
% pandoc
[@Alhazen1572-qk, V.9]: "competentius est"
^D
<p><span class="citation" data-cites="Alhazen1572-qk">[@Alhazen1572-qk, V.9]</span>: “competentius est”</p>
```
```
% pandoc -f markdown-citations
[@Alhazen1572-qk, V.9]: "competentius est"
[@Alhazen1572-qk, V.9]
^D
<p><a href="" title="competentius est">@Alhazen1572-qk, V.9</a></p>
```