diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 6 | ||||
-rw-r--r-- | test/command/7632.md | 66 |
2 files changed, 70 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 42ca16c92..03becd144 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -327,6 +327,7 @@ referenceKey :: PandocMonad m => MarkdownParser m (F Blocks) referenceKey = try $ do pos <- getPosition skipNonindentSpaces + notFollowedBy (void cite) (_,raw) <- reference char ':' skipSpaces >> optional newline >> skipSpaces >> notFollowedBy (char '[') @@ -1781,8 +1782,8 @@ endline = try $ do -- a reference label for a link reference :: PandocMonad m => MarkdownParser m (F Inlines, Text) reference = do - guardDisabled Ext_footnotes <|> notFollowedBy' (string "[^") - guardDisabled Ext_citations <|> notFollowedBy' (string "[@") + -- guardDisabled Ext_footnotes <|> notFollowedBy' (string "[^") + -- guardDisabled Ext_citations <|> notFollowedBy' (string "[@") withRaw $ trimInlinesF <$> inlinesInBalancedBrackets parenthesizedChars :: PandocMonad m => MarkdownParser m Text @@ -2201,6 +2202,7 @@ normalCite = try $ do citations <- citeList spnl char ']' + notFollowedBy (oneOf "{([") -- not a link or a bracketed span return citations suffix :: PandocMonad m => MarkdownParser m (F Inlines) diff --git a/test/command/7632.md b/test/command/7632.md new file mode 100644 index 000000000..4256bc207 --- /dev/null +++ b/test/command/7632.md @@ -0,0 +1,66 @@ +``` +% pandoc -t native +(@a) First case + +[link to (@a)](url) +^D +[ OrderedList + ( 1 , Example , TwoParens ) + [ [ Plain [ Str "First" , Space , Str "case" ] ] ] +, Para + [ Link + ( "" , [] , [] ) + [ Str "link" , Space , Str "to" , Space , Str "(1)" ] + ( "url" , "" ) + ] +] +``` + +``` +% pandoc -t native +[@a]{.class} +^D +[ Para + [ Span + ( "" , [ "class" ] , [] ) + [ Cite + [ Citation + { citationId = "a" + , citationPrefix = [] + , citationSuffix = [] + , citationMode = AuthorInText + , citationNoteNum = 1 + , citationHash = 0 + } + ] + [ Str "@a" ] + ] + ] +] + +``` + +``` +% pandoc -t native +[@a](url) +^D +[ Para + [ Link + ( "" , [] , [] ) + [ Cite + [ Citation + { citationId = "a" + , citationPrefix = [] + , citationSuffix = [] + , citationMode = AuthorInText + , citationNoteNum = 1 + , citationHash = 0 + } + ] + [ Str "@a" ] + ] + ( "url" , "" ) + ] +] + +``` |