git.iko.soy/typeable/pandoc
on master help sign in
Repairs to citation parser + citation test suite.
commit1fa2973da690ba81a80337d9d3f0f6e2c786b602 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 12 Nov 2010, 19:30 (16 years ago) parente88daeb
2 files changed+15−15
src/Text/Pandoc/Readers/Markdown.hs+8−8 tests/markdown-citations.plain+7−7
src/Text/Pandoc/Readers/Markdown.hs+8−8
@@ -1332,9 +1332,9 @@ textualCite = try $ do
13321332 spnl
13331333 char '['
13341334 spnl
1335− bareloc <- option "" locator
1335+ bareloc <- option "" $ notFollowedBy (oneOf "-@") >> locator
13361336 rest <- many $ try $ do
1337− char ';'
1337+ optional $ char ';'
13381338 spnl
13391339 citation
13401340 spnl
@@ -1366,10 +1366,10 @@ locator = try $ do
13661366 (char '\n' >> notFollowedBy blankline >> return ' ')
13671367
13681368prefix :: GenParser Char st String
1369−prefix = try $ liftM removeLeadingTrailingSpace $
1370− many $ (char '\\' >> anyChar) <|> noneOf "@]\n" <|>
1371− (char '-' >> notFollowedBy (char '@') >> return '-') <|>
1372− (char '\n' >> notFollowedBy blankline >> return ' ')
1369+prefix = liftM removeLeadingTrailingSpace $
1370+ many $ (char '\\' >> anyChar) <|> noneOf "-@]\n" <|>
1371+ (try $ char '-' >> notFollowedBy (char '@') >> return '-') <|>
1372+ (try $ char '\n' >> notFollowedBy blankline >> return ' ')
13731373
13741374citeList :: GenParser Char st [Citation]
13751375citeList = try $ do
@@ -1387,10 +1387,10 @@ citeList = try $ do
13871387
13881388citation :: GenParser Char st Citation
13891389citation = try $ do
1390− suppress_auth <- option False (char '-' >> return True)
13911390 pref <- prefix
1391+ suppress_auth <- option False (char '-' >> return True)
13921392 key <- citeKey
1393− loc <- locator
1393+ loc <- option "" locator
13941394 return $ Citation{ citationId = key
13951395 , citationPrefix = pref
13961396 , citationLocator = loc
tests/markdown-citations.plain+7−7
@@ -5,8 +5,8 @@ Pandoc with citeproc-hs
55
66@nonexistent
77
8−Doe (2005) says blah. Doe (2005, 30) says blah. Doe (2005; 2006,
9−30; see also Doe and Roe 2007) says blah.
8+Doe (2005) says blah. Doe (2005, 30) says blah. Doe
9+(2005; 2006, 30; see also Doe and Roe 2007) says blah.
1010
1111In a note.[^1] A citation group
1212(see Doe 2005, 34-35; also Doe and Roe 2007, chap. 3). Another one
@@ -26,12 +26,12 @@ Doe, John, and Jenny Roe. 2007. Why Water Is Wet. In Third Book,
2626ed. Sam Smith. Oxford: Oxford University Press.
2727
2828[^1]:
29− A citation without locators [Doe and Roe (2007)].
29+ A citation without locators (Doe and Roe 2007).
3030
3131[^2]:
32− Some citations (see Doe 2006, chap. 3; Doe and Roe 2007; Doe
33− 2005).
32+ Some citations
33+ (see Doe 2006, chap. 3; Doe and Roe 2007; Doe 2005).
3434
3535[^3]:
36− Like a citation without author: (2005), and now Doe with a
37− locator (2006, 44).
36+ Like a citation without author: (2005), and now Doe with a locator
37+ (2006, 44).