From d74e8d14a565a359126b6b1633c074f4591dc7c3 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 9 Nov 2011 13:18:01 -0800 Subject: Markdown citations: don't strip off initial space in locator. Previously `[@item1 and nowhere else]` yielded the locator ", and nowhere else", or, with the new citeproc-hs, "and nowhere else". Now it yields " and nowhere else". --- src/Text/Pandoc/Readers/Markdown.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index f04ea88c4..ab146bdd0 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1321,8 +1321,12 @@ citeKey = try $ do suffix :: GenParser Char ParserState [Inline] suffix = try $ do + hasSpace <- option False (notFollowedBy nonspaceChar >> return True) spnl - liftM normalizeSpaces $ many $ notFollowedBy (oneOf ";]") >> inline + rest <- liftM normalizeSpaces $ many $ notFollowedBy (oneOf ";]") >> inline + return $ if hasSpace + then Space : rest + else rest prefix :: GenParser Char ParserState [Inline] prefix = liftM normalizeSpaces $ -- cgit v1.2.3