@@ -1247,6 +1247,7 @@ inline = choice [ whitespace
12471247 , emph
12481248 , note
12491249 , cite
1250+ , textCite
12501251 , link
12511252 , image
12521253 , math
@@ -1625,12 +1626,12 @@ rawHtmlInline = do
16251626cite :: MarkdownParser (F Inlines)
16261627cite = do
16271628 guardEnabled Ext_citations
1628− getOption readerReferences >>= guard . not . null
1629− citations <- textualCite <|> normalCite
1629+ citations <- normalCite
16301630 return $ flip B.cite mempty <$> citations
16311631
1632−textualCite :: MarkdownParser (F [Citation])
1633−textualCite = try $ do
1632+textCite :: MarkdownParser (F Inlines)
1633+textCite = try $ do
1634+ guardEnabled Ext_citations
16341635 (_, key) <- citeKey
16351636 let first = Citation{ citationId = key
16361637 , citationPrefix = []
@@ -1641,8 +1642,15 @@ textualCite = try $ do
16411642 }
16421643 mbrest <- option Nothing $ try $ spnl >> Just <$> normalCite
16431644 case mbrest of
1644− Just rest -> return $ (first:) <$> rest
1645− Nothing -> option (return [first]) $ bareloc first
1645+ Just rest -> return $ (flip B.cite mempty . (first:)) <$> rest
1646+ Nothing -> (do cites <- bareloc first
1647+ return $ flip B.cite mempty <$> cites)
1648+ <|> (do guardEnabled Ext_example_lists
1649+ st <- getState
1650+ case M.lookup key (stateExamples st) of
1651+ Just n -> return $ return $ B.str (show n)
1652+ Nothing -> mzero)
1653+ <|> (return $ return $ flip B.cite mempty [first])
16461654
16471655bareloc :: Citation -> MarkdownParser (F [Citation])
16481656bareloc c = try $ do
@@ -1674,8 +1682,6 @@ citeKey = try $ do
16741682 let internal p = try $ p >>~ lookAhead (letter <|> digit)
16751683 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~/")
16761684 let key = first:rest
1677− citations' <- map CSL.refId <$> getOption readerReferences
1678− guard $ key `elem` citations'
16791685 return (suppress_author, key)
16801686
16811687suffix :: MarkdownParser (F Inlines)