@@ -312,7 +312,7 @@ withNewStyle a = proc x -> do
313 isCodeStyle :: StyleName -> Bool
313 isCodeStyle :: StyleName -> Bool
314 isCodeStyle "Source_Text" = True
314 isCodeStyle "Source_Text" = True
315− isCodeStyle _ = False
315+ isCodeStyle _ = False
317 inlineCode :: Inlines -> Inlines
317 inlineCode :: Inlines -> Inlines
318 inlineCode = code . intercalate "" . map stringify . toList
318 inlineCode = code . intercalate "" . map stringify . toList
@@ -415,12 +415,18 @@ constructPara reader = proc blocks -> do
415 fStyle <- readStyleByName -< blocks
415 fStyle <- readStyleByName -< blocks
416 case fStyle of
416 case fStyle of
417 Left _ -> reader -< blocks
417 Left _ -> reader -< blocks
418+ Right (styleName, _) | isTableCaptionStyle styleName -> do
419+ blocks' <- reader -< blocks
420+ arr tableCaptionP -< blocks'
418 Right (_, style) -> do
421 Right (_, style) -> do
419 let modifier = getParaModifier style
422 let modifier = getParaModifier style
420− blocks' <- reader -< blocks
423+ blocks' <- reader -< blocks
421− arr modifier -<< blocks'
424+ arr modifier -<< blocks'
423−
426+ isTableCaptionStyle :: StyleName -> Bool
427+ isTableCaptionStyle "Table" = True
428+ isTableCaptionStyle _ = False
429+ tableCaptionP b = divWith ("", ["caption"], []) b
425type ListConstructor = [Blocks] -> Blocks
431type ListConstructor = [Blocks] -> Blocks
@@ -904,6 +910,15 @@ read_text = matchChildContent' [ read_header
913+post_process :: Pandoc -> Pandoc
914+post_process (Pandoc m blocks) =
915+ Pandoc m (post_process' blocks)
917+post_process' :: [Block] -> [Block]
918+post_process' ((Table _ a w h r) : (Div ("", ["caption"], _) [Para inlines] ) : xs) =
919+ (Table inlines a w h r) : ( post_process' xs )
920+post_process' bs = bs
907read_body :: OdtReader _x (Pandoc, MediaBag)
922read_body :: OdtReader _x (Pandoc, MediaBag)
908read_body = executeIn NsOffice "body"
923read_body = executeIn NsOffice "body"
909 $ executeIn NsOffice "text"
924 $ executeIn NsOffice "text"
@@ -911,4 +926,4 @@ read_body = executeIn NsOffice "body"
911 $ proc inlines -> do
926 $ proc inlines -> do
912 txt <- read_text -< inlines
927 txt <- read_text -< inlines
913 state <- getExtraState -< ()
928 state <- getExtraState -< ()
914− returnA -< (txt, getMediaBag state)
929+ returnA -< (post_process txt, getMediaBag state)