aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-11-25 21:57:18 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2018-11-25 22:29:54 -0800
commitedc651059ee617cf36b511de080a646d2e6513a4 (patch)
tree0f02030d9b7cb94a9cc56322ef744fa971569614 /src
parent839bd3cfe61ef83e0a32c1d30138744a5ddc1aeb (diff)
downloadpandoc-edc651059ee617cf36b511de080a646d2e6513a4.tar.gz
Fix parsing of citations and quotes after parentheses.
Starting with pandoc 2.4, citations and quoted inlines were no longer recognized after parentheses. This is because of commit 9b0bd4ec6f5c9125efb3e36232e6d1f6ac08a728, which is reverted here. The point of that commit was to allow relocation of soft line breaks to before an abbreviation, so that a nonbreaking space could be added after the abbreviation. Now we simply leave the soft line break in place, even though this means that we won't get a nonbreaking space after "Mr." at the end of a line (and in LaTeX this may result in a longer intersentential space). Those who care about this issue should take care not to end lines with an abbreviation, or to insert nonbreaking spaces manually. Closes #5099.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 5944ecf82..94d1157a6 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1586,7 +1586,6 @@ symbol = do
<|> try (do lookAhead $ char '\\'
notFollowedBy' (() <$ rawTeXBlock)
char '\\')
- updateLastStrPos
return $ return $ B.str [result]
-- parses inline code, between n `s and n `s
@@ -1633,7 +1632,7 @@ enclosure c = do
3 -> three c
2 -> two c mempty
1 -> one c mempty
- _ -> updateLastStrPos >> return (return $ B.str cs)
+ _ -> return (return $ B.str cs)
ender :: PandocMonad m => Char -> Int -> MarkdownParser m ()
ender c n = try $ do
@@ -1717,13 +1716,12 @@ nonEndline = satisfy (/='\n')
str :: PandocMonad m => MarkdownParser m (F Inlines)
str = do
- canRelocateSpace <- notAfterString
result <- many1 (alphaNum <|> try (char '.' <* notFollowedBy (char '.')))
updateLastStrPos
(do guardEnabled Ext_smart
abbrevs <- getOption readerAbbreviations
if not (null result) && last result == '.' && result `Set.member` abbrevs
- then try (do ils <- whitespace <|> endline
+ then try (do ils <- whitespace
-- ?? lookAhead alphaNum
-- replace space after with nonbreaking space
-- if softbreak, move before abbrev if possible (#4635)
@@ -1732,8 +1730,6 @@ str = do
case B.toList ils' of
[Space] ->
return (B.str result <> B.str "\160")
- [SoftBreak] | canRelocateSpace ->
- return (ils' <> B.str result <> B.str "\160")
_ -> return (B.str result <> ils'))
<|> return (return (B.str result))
else return (return (B.str result)))