diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 8 | ||||
-rw-r--r-- | test/command/4635.md | 4 | ||||
-rw-r--r-- | test/command/5099.md | 13 | ||||
-rw-r--r-- | test/command/md-abbrevs.md | 11 |
4 files changed, 17 insertions, 19 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))) diff --git a/test/command/4635.md b/test/command/4635.md index 320b83956..ad9af9c67 100644 --- a/test/command/4635.md +++ b/test/command/4635.md @@ -19,7 +19,7 @@ foo) cf. foo ^D -[Para [Str "cf.\160foo"]] +[Para [Str "cf.",SoftBreak,Str "foo"]] ``` ``` @@ -27,5 +27,5 @@ foo a cf. foo ^D -[Para [Str "a",SoftBreak,Str "cf.\160foo"]] +[Para [Str "a",Space,Str "cf.",SoftBreak,Str "foo"]] ``` diff --git a/test/command/5099.md b/test/command/5099.md new file mode 100644 index 000000000..ab49b9a59 --- /dev/null +++ b/test/command/5099.md @@ -0,0 +1,13 @@ +``` +% pandoc -t native +(@citation +^D +[Para [Str "(",Cite [Citation {citationId = "citation", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 0, citationHash = 0}] [Str "@citation"]]] +``` + +``` +% pandoc -t native +('asd') +^D +[Para [Str "(",Quoted SingleQuote [Str "asd"],Str ")"]] +``` diff --git a/test/command/md-abbrevs.md b/test/command/md-abbrevs.md index 15f4d6a9a..15ab8a728 100644 --- a/test/command/md-abbrevs.md +++ b/test/command/md-abbrevs.md @@ -9,17 +9,6 @@ Mr. Bob [Para [Str "Mr.\160Bob"]] ``` -Here pandoc readjusts the softbreak so that the nonbreaking -space can be inserted: - -``` -% pandoc -t native -Hi Mr. -Bob -^D -[Para [Str "Hi",SoftBreak,Str "Mr.\160Bob"]] -``` - If you don't want this to happen you can escape the period: ``` |