@@ -34,7 +34,7 @@ module Text.Pandoc.Readers.Markdown (
34import Data.List ( transpose, isSuffixOf, sortBy, findIndex, intercalate )
34import Data.List ( transpose, isSuffixOf, sortBy, findIndex, intercalate )
35import qualified Data.Map as M
35import qualified Data.Map as M
36import Data.Ord ( comparing )
36import Data.Ord ( comparing )
37−import Data.Char ( isAlphaNum, isDigit )
37+import Data.Char ( isAlphaNum )
38import Data.Maybe
38import Data.Maybe
39import Text.Pandoc.Definition
39import Text.Pandoc.Definition
40import Text.Pandoc.Shared
40import Text.Pandoc.Shared
@@ -1319,23 +1319,12 @@ spnl = try $ do
1319 skipSpaces
1319 skipSpaces
1320 notFollowedBy (char '\n')
1320 notFollowedBy (char '\n')
1322−blankSpace :: GenParser Char st ()
1323−blankSpace = try $ do
1324− res <- many1 $ oneOf " \t\n"
1325− guard $ length res > 0
1326− guard $ length (filter (=='\n') res) <= 1
1328−noneOfUnlessEscaped :: [Char] -> GenParser Char st Char
1329−noneOfUnlessEscaped cs =
1330− try (char '\\' >> oneOf cs) <|> noneOf cs
1332textualCite :: GenParser Char ParserState [Citation]
1322textualCite :: GenParser Char ParserState [Citation]
1333textualCite = try $ do
1323textualCite = try $ do
1334 (_, key) <- citeKey
1324 (_, key) <- citeKey
1335 let first = Citation{ citationId = key
1325 let first = Citation{ citationId = key
1336 , citationPrefix = []
1326 , citationPrefix = []
1337 , citationSuffix = []
1327 , citationSuffix = []
1338− , citationLocator = ""
1339 , citationMode = AuthorInText
1328 , citationMode = AuthorInText
1340 , citationNoteNum = 0
1329 , citationNoteNum = 0
1341 , citationHash = 0
1330 , citationHash = 0
@@ -1349,12 +1338,11 @@ bareloc :: Citation -> GenParser Char ParserState [Citation]
1349bareloc c = try $ do
1338bareloc c = try $ do
1351 char '['
1340 char '['
1353 suff <- suffix
1341 suff <- suffix
1354 rest <- option [] $ try $ char ';' >> citeList
1342 rest <- option [] $ try $ char ';' >> citeList
1356 char ']'
1344 char ']'
1357− return $ c{ citationLocator = loc, citationSuffix = suff } : rest
1345+ return $ c{ citationSuffix = suff } : rest
1359normalCite :: GenParser Char ParserState [Citation]
1347normalCite :: GenParser Char ParserState [Citation]
1360normalCite = try $ do
1348normalCite = try $ do
@@ -1376,26 +1364,6 @@ citeKey = try $ do
1376 guard $ key `elem` stateCitations st
1364 guard $ key `elem` stateCitations st
1377 return (suppress_author, key)
1365 return (suppress_author, key)
1379−locator :: GenParser Char st String
1382− w <- many1 (noneOf " \t\n;,]")
1383− ws <- many (locatorWord <|> locatorComma)
1384− return $ unwords $ w:ws
1386−locatorWord :: GenParser Char st String
1387−locatorWord = try $ do
1389− wd <- many1 $ noneOfUnlessEscaped "];, \t\n"
1390− guard $ any isDigit wd
1393−locatorComma :: GenParser Char st String
1394−locatorComma = try $ do
1396− lookAhead $ locatorWord
1399suffix :: GenParser Char ParserState [Inline]
1367suffix :: GenParser Char ParserState [Inline]
1400suffix = try $ do
1368suffix = try $ do
@@ -1412,12 +1380,10 @@ citation :: GenParser Char ParserState Citation
1412citation = try $ do
1380citation = try $ do
1413 pref <- prefix
1381 pref <- prefix
1414 (suppress_author, key) <- citeKey
1382 (suppress_author, key) <- citeKey
1415− loc <- option "" $ try $ blankSpace >> locator
1416 suff <- suffix
1383 suff <- suffix
1417 return $ Citation{ citationId = key
1384 return $ Citation{ citationId = key
1418 , citationPrefix = pref
1385 , citationPrefix = pref
1419 , citationSuffix = suff
1386 , citationSuffix = suff
1420− , citationLocator = loc
1421 , citationMode = if suppress_author
1387 , citationMode = if suppress_author
1422 then SuppressAuthor
1388 then SuppressAuthor
1423 else NormalCitation
1389 else NormalCitation