diff options
-rw-r--r-- | data/reference.docx | bin | 9763 -> 9757 bytes | |||
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 9 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 8 |
3 files changed, 10 insertions, 7 deletions
diff --git a/data/reference.docx b/data/reference.docx Binary files differindex 9caa9c21a..b1d0ab15d 100644 --- a/data/reference.docx +++ b/data/reference.docx diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index af912c28e..f35d1ebf5 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -498,12 +498,15 @@ inlineCommands = M.fromList $ [ "noindent", "index", "nocite" ] mkImage :: String -> LP Inlines -mkImage src = +mkImage src = do + -- try for a caption + alt <- option (str "image") $ try $ spaces >> + controlSeq "caption" >> optional (char '*') >> grouped inline case takeExtension src of "" -> do defaultExt <- getOption readerDefaultImageExtension - return $ image (addExtension src defaultExt) "" (str "image") - _ -> return $ image src "" (str "image") + return $ image (addExtension src defaultExt) "" alt + _ -> return $ image src "" alt inNote :: Inlines -> Inlines inNote ils = diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index c3148aae4..39b5a716d 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -655,7 +655,7 @@ inlineToOpenXML opts (Note bs) = do notes <- gets stFootnotes notenum <- getUniqueId let notemarker = mknode "w:r" [] - [ mknode "w:rPr" [] (rStyle "FootnoteReference") + [ mknode "w:rPr" [] (rStyle "FootnoteRef") , mknode "w:footnoteRef" [] () ] let notemarkerXml = RawInline "openxml" $ ppElement notemarker let insertNoteRef (Plain ils : xs) = Plain (notemarkerXml : ils) : xs @@ -672,15 +672,15 @@ inlineToOpenXML opts (Note bs) = do let newnote = mknode "w:footnote" [("w:id", notenum)] $ contents modify $ \s -> s{ stFootnotes = newnote : notes } return [ mknode "w:r" [] - [ mknode "w:rPr" [] (rStyle "FootnoteReference") + [ mknode "w:rPr" [] (rStyle "FootnoteRef") , mknode "w:footnoteReference" [("w:id", notenum)] () ] ] -- internal link: inlineToOpenXML opts (Link txt ('#':xs,_)) = do - contents <- withTextProp (rStyle "Hyperlink") $ inlinesToOpenXML opts txt + contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt return [ mknode "w:hyperlink" [("w:anchor",xs)] contents ] -- external link: inlineToOpenXML opts (Link txt (src,_)) = do - contents <- withTextProp (rStyle "Hyperlink") $ inlinesToOpenXML opts txt + contents <- withTextProp (rStyle "Link") $ inlinesToOpenXML opts txt extlinks <- gets stExternalLinks id' <- case M.lookup src extlinks of Just i -> return i |