Parsing.hs (pandoc-2.11.1.1) | : | Parsing.hs (pandoc-2.11.2) | ||
---|---|---|---|---|
skipping to change at line 800 | skipping to change at line 800 | |||
return (Decimal, fromMaybe 1 $ safeRead $ T.pack num) | return (Decimal, fromMaybe 1 $ safeRead $ T.pack num) | |||
-- | Parses a '@' and optional label and | -- | Parses a '@' and optional label and | |||
-- returns (DefaultStyle, [next example number]). The next | -- returns (DefaultStyle, [next example number]). The next | |||
-- example number is incremented in parser state, and the label | -- example number is incremented in parser state, and the label | |||
-- (if present) is added to the label table. | -- (if present) is added to the label table. | |||
exampleNum :: Stream s m Char | exampleNum :: Stream s m Char | |||
=> ParserT s ParserState m (ListNumberStyle, Int) | => ParserT s ParserState m (ListNumberStyle, Int) | |||
exampleNum = do | exampleNum = do | |||
char '@' | char '@' | |||
lab <- T.pack <$> many (alphaNum <|> satisfy (\c -> c == '_' || c == '-')) | lab <- mconcat . map T.pack <$> | |||
many (many1 alphaNum <|> | ||||
try (do c <- char '_' <|> char '-' | ||||
cs <- many1 alphaNum | ||||
return (c:cs))) | ||||
st <- getState | st <- getState | |||
let num = stateNextExample st | let num = stateNextExample st | |||
let newlabels = if T.null lab | let newlabels = if T.null lab | |||
then stateExamples st | then stateExamples st | |||
else M.insert lab num $ stateExamples st | else M.insert lab num $ stateExamples st | |||
updateState $ \s -> s{ stateNextExample = num + 1 | updateState $ \s -> s{ stateNextExample = num + 1 | |||
, stateExamples = newlabels } | , stateExamples = newlabels } | |||
return (Example, num) | return (Example, num) | |||
-- | Parses a '#' returns (DefaultStyle, 1). | -- | Parses a '#' returns (DefaultStyle, 1). | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |