Skip to content

Commit af9443a

Browse files
committed
RST reader: correctly handle intraword emphasis.
Closes #11309.
1 parent 37b7bd3 commit af9443a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/Text/Pandoc/Readers/RST.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,11 +1536,12 @@ hyphens = do
15361536

15371537
escapedChar :: Monad m => RSTParser m Inlines
15381538
escapedChar = do c <- escaped anyChar
1539-
unless (canPrecedeOpener c) updateLastStrPos
1540-
return $ if c == ' ' || c == '\n' || c == '\r'
1541-
-- '\ ' is null in RST
1542-
then mempty
1543-
else B.str $ T.singleton c
1539+
if c == ' ' || c == '\n' || c == '\r'
1540+
-- '\ ' is null in RST
1541+
then return mempty
1542+
else do
1543+
unless (canPrecedeOpener c) updateLastStrPos
1544+
return $ B.str $ T.singleton c
15441545

15451546
canPrecedeOpener :: Char -> Bool
15461547
canPrecedeOpener c =

test/command/11309.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```
2+
% pandoc -f rst -t native
3+
Cho\ **co**\ late
4+
^D
5+
[ Para [ Str "Cho" , Strong [ Str "co" ] , Str "late" ] ]
6+
```

0 commit comments

Comments
 (0)