diff options
| author | John MacFarlane <[email protected]> | 2024-09-03 22:19:04 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2024-09-03 22:19:04 -0700 |
| commit | 180d2b5a025362f7fdf20c68a8bc595e0938cb86 (patch) | |
| tree | 7558dfa058feebd1fc73e30a844f3ca127dce7ac /src | |
| parent | b3d721b4ab28a9aea3447db9e51968ca9434f175 (diff) | |
RTF reader: handle images inside shp contexts.
We look for the `pib` property and parse image data inside its value.
Closes #10145.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/RTF.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/RTF.hs b/src/Text/Pandoc/Readers/RTF.hs index 4426ab45d..7e1a779d0 100644 --- a/src/Text/Pandoc/Readers/RTF.hs +++ b/src/Text/Pandoc/Readers/RTF.hs @@ -431,9 +431,20 @@ processTok bs (Tok pos tok') = do Grouped (Tok _ (ControlSymbol '*') : toks@(firsttok:_)) -> case firsttok of Tok _ (ControlWord "shppict" _) -> inGroup (foldM processTok bs toks) + Tok _ (ControlWord "shpinst" _) -> inGroup (foldM processTok bs toks) _ -> bs <$ (do oldTextContent <- sTextContent <$> getState processTok mempty (Tok pos (Grouped toks)) updateState $ \st -> st{ sTextContent = oldTextContent }) + Grouped (Tok _ (ControlWord "shp" _) : toks) -> + inGroup (foldM processTok bs toks) + Grouped [ Tok _ (ControlWord "sp" _) + , Tok _ (Grouped [Tok _ (ControlWord "sn" _), + Tok _ (UnformattedText sn)]) + , Tok _ (Grouped (Tok _ (ControlWord "sv" _) : svtoks)) + ] -> + case sn of + "pib" -> inGroup (foldM processTok bs svtoks) + _ -> pure bs Grouped (Tok _ (ControlWord "fonttbl" _) : toks) -> inGroup $ do updateState $ \s -> s{ sFontTable = processFontTable toks } pure bs |
