From 9cdc99cb7d748b5edf8f0aeb091bebc66ac77ebe Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 27 Jul 2024 20:08:55 +0300 Subject: RTF reader: handle `\*\shppict` without dropping image. Closes #10025. --- src/Text/Pandoc/Readers/RTF.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/RTF.hs b/src/Text/Pandoc/Readers/RTF.hs index 8bf653fc1..4426ab45d 100644 --- a/src/Text/Pandoc/Readers/RTF.hs +++ b/src/Text/Pandoc/Readers/RTF.hs @@ -428,10 +428,12 @@ processTok bs (Tok pos tok') = do UnformattedText{} -> return () _ -> updateState $ \s -> s{ sEatChars = 0 } case tok' of - Grouped (Tok _ (ControlSymbol '*') : toks) -> - bs <$ (do oldTextContent <- sTextContent <$> getState - processTok mempty (Tok pos (Grouped toks)) - updateState $ \st -> st{ sTextContent = oldTextContent }) + Grouped (Tok _ (ControlSymbol '*') : toks@(firsttok:_)) -> + case firsttok of + Tok _ (ControlWord "shppict" _) -> inGroup (foldM processTok bs toks) + _ -> bs <$ (do oldTextContent <- sTextContent <$> getState + processTok mempty (Tok pos (Grouped toks)) + updateState $ \st -> st{ sTextContent = oldTextContent }) Grouped (Tok _ (ControlWord "fonttbl" _) : toks) -> inGroup $ do updateState $ \s -> s{ sFontTable = processFontTable toks } pure bs -- cgit v1.2.3