@@ -1247,6 +1247,7 @@ inline = choice [ whitespace
@@ -1625,12 +1626,12 @@ rawHtmlInline = do
1625cite :: MarkdownParser (F Inlines)
1626cite :: MarkdownParser (F Inlines)
1626cite = do
1627cite = do
1627 guardEnabled Ext_citations
1628 guardEnabled Ext_citations
1628− getOption readerReferences >>= guard . not . null
1629− citations <- textualCite <|> normalCite
1629+ citations <- normalCite
1630 return $ flip B.cite mempty <$> citations
1630 return $ flip B.cite mempty <$> citations
1632−textualCite :: MarkdownParser (F [Citation])
1632+textCite :: MarkdownParser (F Inlines)
1633−textualCite = try $ do
1633+textCite = try $ do
1634+ guardEnabled Ext_citations
1634 (_, key) <- citeKey
1635 (_, key) <- citeKey
1635 let first = Citation{ citationId = key
1636 let first = Citation{ citationId = key
1636 , citationPrefix = []
1637 , citationPrefix = []
@@ -1641,8 +1642,15 @@ textualCite = try $ do
1642 mbrest <- option Nothing $ try $ spnl >> Just <$> normalCite
1643 mbrest <- option Nothing $ try $ spnl >> Just <$> normalCite
1643 case mbrest of
1644 case mbrest of
1644− Just rest -> return $ (first:) <$> rest
1645+ Just rest -> return $ (flip B.cite mempty . (first:)) <$> rest
1645− Nothing -> option (return [first]) $ bareloc first
1646+ Nothing -> (do cites <- bareloc first
1647+ return $ flip B.cite mempty <$> cites)
1648+ <|> (do guardEnabled Ext_example_lists
1650+ case M.lookup key (stateExamples st) of
1651+ Just n -> return $ return $ B.str (show n)
1653+ <|> (return $ return $ flip B.cite mempty [first])
1647bareloc :: Citation -> MarkdownParser (F [Citation])
1655bareloc :: Citation -> MarkdownParser (F [Citation])
1648bareloc c = try $ do
1656bareloc c = try $ do
@@ -1674,8 +1682,6 @@ citeKey = try $ do
1674 let internal p = try $ p >>~ lookAhead (letter <|> digit)
1682 let internal p = try $ p >>~ lookAhead (letter <|> digit)
1675 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~/")
1683 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~/")
1676 let key = first:rest
1684 let key = first:rest
1677− citations' <- map CSL.refId <$> getOption readerReferences
1678− guard $ key `elem` citations'
1679 return (suppress_author, key)
1685 return (suppress_author, key)
1681suffix :: MarkdownParser (F Inlines)
1687suffix :: MarkdownParser (F Inlines)