git.iko.soy/typeable/pandoc
on master help sign in
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.

commit2c0e989f9df788b7f168159fd99d5c3e1a78aa85 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 7 Aug 2017, 21:00 (9 years ago) parentfd23b6d
2 files changed+19−2
src/Text/Pandoc/Readers/Markdown.hs+4−2 test/command/3840.md+15
src/Text/Pandoc/Readers/Markdown.hs+4−2
@@ -1695,8 +1695,10 @@ endline = try $ do
16951695
16961696-- a reference label for a link
16971697reference :: PandocMonad m => MarkdownParser m (F Inlines, String)
1698−reference = do notFollowedBy' (string "[^") -- footnote reference
1699− withRaw $ trimInlinesF <$> inlinesInBalancedBrackets
1698+reference = do
1699+ guardDisabled Ext_footnotes <|> notFollowedBy' (string "[^")
1700+ guardDisabled Ext_citations <|> notFollowedBy' (string "[@")
1701+ withRaw $ trimInlinesF <$> inlinesInBalancedBrackets
17001702
17011703parenthesizedChars :: PandocMonad m => MarkdownParser m [Char]
17021704parenthesizedChars = do
test/command/3840.mdnew file+15
@@ -0,0 +1,15 @@
1+```
2+% pandoc
3+[@Alhazen1572-qk, V.9]: "competentius est"
4+^D
5+<p><span class="citation" data-cites="Alhazen1572-qk">[@Alhazen1572-qk, V.9]</span>: “competentius est”</p>
6+```
7+
8+```
9+% pandoc -f markdown-citations
10+[@Alhazen1572-qk, V.9]: "competentius est"
11+
12+[@Alhazen1572-qk, V.9]
13+^D
14+<p><a href="" title="competentius est">@Alhazen1572-qk, V.9</a></p>
15+```