git.iko.soy/typeable/pandoc
on master help sign in
Revert "Citation changes."

This reverts commit d46f434d4b8906ae3b983e568549213de94fd1a2.

commit57e4f5644f149c0ba326241f10afc1cfcdae443e authorJohn MacFarlane <fiddlosopher@gmail.com> dateWed 6 Feb 2013, 13:14 (14 years ago) parent8dfbe3b
2 files changed+9−17
src/Text/Pandoc/Readers/Markdown.hs+8−14 src/Text/Pandoc/Writers/Markdown.hs+1−3
src/Text/Pandoc/Readers/Markdown.hs+8−14
@@ -1248,7 +1248,6 @@ inline = choice [ whitespace
12481248 , emph
12491249 , note
12501250 , cite
1251− , textCite
12521251 , link
12531252 , image
12541253 , math
@@ -1631,12 +1630,12 @@ rawHtmlInline = do
16311630cite :: MarkdownParser (F Inlines)
16321631cite = do
16331632 guardEnabled Ext_citations
1634− citations <- normalCite
1633+ getOption readerReferences >>= guard . not . null
1634+ citations <- textualCite <|> normalCite
16351635 return $ flip B.cite mempty <$> citations
16361636
1637−textCite :: MarkdownParser (F Inlines)
1638−textCite = try $ do
1639− guardEnabled Ext_citations
1637+textualCite :: MarkdownParser (F [Citation])
1638+textualCite = try $ do
16401639 (_, key) <- citeKey
16411640 let first = Citation{ citationId = key
16421641 , citationPrefix = []
@@ -1647,15 +1646,8 @@ textCite = try $ do
16471646 }
16481647 mbrest <- option Nothing $ try $ spnl >> Just <$> normalCite
16491648 case mbrest of
1650− Just rest -> return $ (flip B.cite mempty . (first:)) <$> rest
1651− Nothing -> (do cites <- bareloc first
1652− return $ flip B.cite mempty <$> cites)
1653− <|> (do guardEnabled Ext_example_lists
1654− st <- getState
1655− case M.lookup key (stateExamples st) of
1656− Just n -> return $ return $ B.str (show n)
1657− Nothing -> mzero)
1658− <|> (return $ return $ flip B.cite mempty [first])
1649+ Just rest -> return $ (first:) <$> rest
1650+ Nothing -> option (return [first]) $ bareloc first
16591651
16601652bareloc :: Citation -> MarkdownParser (F [Citation])
16611653bareloc c = try $ do
@@ -1687,6 +1679,8 @@ citeKey = try $ do
16871679 let internal p = try $ p >>~ lookAhead (letter <|> digit)
16881680 rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~/")
16891681 let key = first:rest
1682+ citations' <- map CSL.refId <$> getOption readerReferences
1683+ guard $ key `elem` citations'
16901684 return (suppress_author, key)
16911685
16921686suffix :: MarkdownParser (F Inlines)
src/Text/Pandoc/Writers/Markdown.hs+1−3
@@ -614,9 +614,7 @@ inlineToMarkdown opts (LineBreak)
614614 | otherwise = return $ " " <> cr
615615inlineToMarkdown _ Space = return space
616616inlineToMarkdown opts (Cite (c:cs) lst)
617− | writerCiteMethod opts == Citeproc && not (null lst) &&
618− case lst of { RawInline "latex" _ : _ -> False; _ -> True} =
619− inlineListToMarkdown opts lst
617+ | writerCiteMethod opts == Citeproc = inlineListToMarkdown opts lst
620618 | citationMode c == AuthorInText = do
621619 suffs <- inlineListToMarkdown opts $ citationSuffix c
622620 rest <- mapM convertOne cs