aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-11-30 12:16:40 +0100
committerJohn MacFarlane <[email protected]>2025-11-30 12:16:40 +0100
commitaf9443a981063ab0aad27e96a039de2ca5543c99 (patch)
treee7cba25c2a4b2e0958ea08ff666ce6a59f54feae
parent37b7bd3b38d1fdf6a38a420fa2f76843bbb6881b (diff)
RST reader: correctly handle intraword emphasis.
Closes #11309.
-rw-r--r--src/Text/Pandoc/Readers/RST.hs11
-rw-r--r--test/command/11309.md6
2 files changed, 12 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 72f7dbe11..5d5e176ee 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -1536,11 +1536,12 @@ hyphens = do
escapedChar :: Monad m => RSTParser m Inlines
escapedChar = do c <- escaped anyChar
- unless (canPrecedeOpener c) updateLastStrPos
- return $ if c == ' ' || c == '\n' || c == '\r'
- -- '\ ' is null in RST
- then mempty
- else B.str $ T.singleton c
+ if c == ' ' || c == '\n' || c == '\r'
+ -- '\ ' is null in RST
+ then return mempty
+ else do
+ unless (canPrecedeOpener c) updateLastStrPos
+ return $ B.str $ T.singleton c
canPrecedeOpener :: Char -> Bool
canPrecedeOpener c =
diff --git a/test/command/11309.md b/test/command/11309.md
new file mode 100644
index 000000000..ae743ed70
--- /dev/null
+++ b/test/command/11309.md
@@ -0,0 +1,6 @@
+```
+% pandoc -f rst -t native
+Cho\ **co**\ late
+^D
+[ Para [ Str "Cho" , Strong [ Str "co" ] , Str "late" ] ]
+```