git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: trim trailing whitespace.
commit788cb6e9a19d575666436197e77e8e17679753ed authorJesse Rosenthal <jrosenthal@jhu.edu> dateFri 23 Feb 2018, 11:54 (9 years ago) parentaadac3c
1 file changed+14−14
src/Text/Pandoc/Writers/Docx.hs+14−14
src/Text/Pandoc/Writers/Docx.hs+14−14
@@ -1276,8 +1276,8 @@ inlineToOpenXML' opts (Link _ txt (src,_)) = do
12761276 return [ mknode "w:hyperlink" [("r:id",id')] contents ]
12771277inlineToOpenXML' opts (Image attr alt (src, title)) = do
12781278 pageWidth <- asks envPrintWidth
1279− imgs <- gets stImages
1280− let
1279+ imgs <- gets stImages
1280+ let
12811281 stImage = M.lookup src imgs
12821282 generateImgElt (ident, _, _, img) =
12831283 let
@@ -1296,7 +1296,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
12961296 blipFill = mknode "pic:blipFill" []
12971297 [ mknode "a:blip" [("r:embed",ident)] ()
12981298 , mknode "a:stretch" [] $
1299− mknode "a:fillRect" [] ()
1299+ mknode "a:fillRect" [] ()
13001300 ]
13011301 xfrm = mknode "a:xfrm" []
13021302 [ mknode "a:off" [("x","0"),("y","0")] ()
@@ -1316,7 +1316,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
13161316 [ mknode "pic:pic" []
13171317 [ nvPicPr
13181318 , blipFill
1319− , spPr
1319+ , spPr
13201320 ]
13211321 ]
13221322 imgElt = mknode "w:r" [] $
@@ -1325,24 +1325,24 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
13251325 [ mknode "wp:extent" [("cx",show xemu),("cy",show yemu)] ()
13261326 , mknode "wp:effectExtent"
13271327 [("b","0"),("l","0"),("r","0"),("t","0")] ()
1328− , mknode "wp:docPr"
1328+ , mknode "wp:docPr"
13291329 [ ("descr", stringify alt)
13301330 , ("title", title)
13311331 , ("id","1")
13321332 , ("name","Picture")
13331333 ] ()
13341334 , graphic
1335− ]
1335+ ]
13361336 in
1337− imgElt
1338−
1337+ imgElt
1338+
13391339 case stImage of
13401340 Just imgData -> return $ [generateImgElt imgData]
1341− Nothing -> ( do --try
1341+ Nothing -> ( do --try
13421342 (img, mt) <- P.fetchItem src
13431343 ident <- ("rId"++) `fmap` getUniqueId
1344−
1345− let
1344+
1345+ let
13461346 imgext = case mt >>= extensionFromMimeType of
13471347 Just x -> '.':x
13481348 Nothing -> case imageType img of
@@ -1353,12 +1353,12 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
13531353 Just Eps -> ".eps"
13541354 Just Svg -> ".svg"
13551355 Just Emf -> ".emf"
1356− Nothing -> ""
1356+ Nothing -> ""
13571357 imgpath = "media/" ++ ident ++ imgext
13581358 mbMimeType = mt <|> getMimeType imgpath
1359−
1359+
13601360 imgData = (ident, imgpath, mbMimeType, img)
1361−
1361+
13621362 if null imgext
13631363 then -- without an extension there is no rule for content type
13641364 inlinesToOpenXML opts alt -- return alt to avoid corrupted docx