git.iko.soy/typeable/pandoc
on master help sign in
Image with a caption needs special formatting

Latex Writer only handles captions if the image's title is prefixed with 'fig:'.

commitdd799df0aed2df843c6881cec296869b622c0780 authorHubert Plociniczak <hubert.plociniczak@gmail.com> dateWed 19 Oct 2016, 11:40 (10 years ago) parent4a2a7a2
3 files changed+8−4
src/Text/Pandoc/Readers/Odt/ContentReader.hs+6−2 tests/odt/native/imageIndex.native+1−1 tests/odt/native/imageWithCaption.native+1−1
src/Text/Pandoc/Readers/Odt/ContentReader.hs+6−2
@@ -779,8 +779,12 @@ read_frame_text_box = matchingElement NsDraw "text-box"
779779 arr read_img_with_caption -< toList paragraphs
780780
781781read_img_with_caption :: [Block] -> Inlines
782−read_img_with_caption ((Para ((Image attr _ target) : txt)) : _) =
783− singleton (Image attr txt target) -- override caption with the text that follows
782+read_img_with_caption ((Para ((Image attr alt (src,title)) : [])) : _) =
783+ singleton (Image attr alt (src, 'f':'i':'g':':':title)) -- no text, default caption
784+read_img_with_caption ((Para ((Image attr _ (src,title)) : txt)) : _) =
785+ singleton (Image attr txt (src, 'f':'i':'g':':':title) ) -- override caption with the text that follows
786+read_img_with_caption ( (Para (_ : xs)) : ys) =
787+ read_img_with_caption ((Para xs) : ys)
784788read_img_with_caption _ =
785789 mempty
786790
tests/odt/native/imageIndex.native+1−1
@@ -1 +1 @@
1−[Para [Image ("",[],[("width","5.292cm"),("height","5.292cm")]) [Str "Abbildung",Space,Str "1:",Space,Str "Image",Space,Str "caption"] ("Pictures/10000000000000FA000000FAD6A15225.jpg","")]]
1+[Para [Image ("",[],[("width","5.292cm"),("height","5.292cm")]) [Str "Abbildung",Space,Str "1:",Space,Str "Image",Space,Str "caption"] ("Pictures/10000000000000FA000000FAD6A15225.jpg","fig:")]]
tests/odt/native/imageWithCaption.native+1−1
@@ -1 +1 @@
1−[Para [Image ("",[],[("width","5.292cm"),("height","5.292cm")]) [Str "Abbildung",Space,Str "1:",Space,Str "Image",Space,Str "caption"] ("Pictures/10000000000000FA000000FAD6A15225.jpg","")]]
1+[Para [Image ("",[],[("width","5.292cm"),("height","5.292cm")]) [Str "Abbildung",Space,Str "1:",Space,Str "Image",Space,Str "caption"] ("Pictures/10000000000000FA000000FAD6A15225.jpg","fig:")]]