git.iko.soy/typeable/pandoc
on master help sign in
Markdown suffix parser fix.

If suffix doesn't begin with punctuation, include opening comma and space in result. Previously, @item [only a suffix] would result in something like Doe (2002only a suffix) because there was no opening delimiter.

commit0ca84f0d381639ca996eb037c9c4057b2de4ed2f authorJohn MacFarlane <jgm@berkeley.edu> dateFri 26 Nov 2010, 22:09 (16 years ago) parent0871a51
1 file changed+7−2
src/Text/Pandoc/Readers/Markdown.hs+7−2
src/Text/Pandoc/Readers/Markdown.hs+7−2
@@ -34,7 +34,7 @@ module Text.Pandoc.Readers.Markdown (
3434import Data.List ( transpose, isSuffixOf, sortBy, findIndex, intercalate )
3535import qualified Data.Map as M
3636import Data.Ord ( comparing )
37−import Data.Char ( isAlphaNum )
37+import Data.Char ( isAlphaNum, isPunctuation )
3838import Data.Maybe
3939import Text.Pandoc.Definition
4040import Text.Pandoc.Shared
@@ -1367,7 +1367,12 @@ citeKey = try $ do
13671367suffix :: GenParser Char ParserState [Inline]
13681368suffix = try $ do
13691369 spnl
1370− liftM normalizeSpaces $ many $ notFollowedBy (oneOf ";]") >> inline
1370+ res <- many $ notFollowedBy (oneOf ";]") >> inline
1371+ return $ case res of
1372+ [] -> []
1373+ (Str (y:_) : _) | isPunctuation y
1374+ -> res
1375+ _ -> Str "," : Space : res
13711376
13721377prefix :: GenParser Char ParserState [Inline]
13731378prefix = liftM normalizeSpaces $