summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgohai <gottfried.haider@gmail.com>2015-05-11 15:49:36 +0200
committergohai <gottfried.haider@gmail.com>2015-05-11 15:49:36 +0200
commit8af168a7fe0553b8d240118edf1dd0592b258da6 (patch)
treed6d311cc8fc6e8545c9c0eafa592e1878eee845c /src
parent4b251e93b4012f220586f0f878f0edac363e3c3a (diff)
Fix image URIs in ICML output (v2)
InDesign expects LinkResourceURI to start with "file:" for local filenames, and won't render/link the image without.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/ICML.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
index 6af4b7aa3..f42d26614 100644
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -25,6 +25,7 @@ import Data.List (isPrefixOf, isInfixOf, stripPrefix)
import Data.Text as Text (breakOnAll, pack)
import Data.Monoid (mappend)
import Control.Monad.State
+import Network.URI (isURI)
import qualified Data.Set as Set
type Style = [String]
@@ -499,6 +500,7 @@ imageICML _ style _ (linkURI, _) =
hh = show $ imgHeight `div` 2
qw = show $ imgWidth `div` 4
qh = show $ imgHeight `div` 4
+ uriPrefix = if isURI linkURI then "" else "file:"
(stlStr, attrs) = styleToStrAttr style
props = inTags True "Properties" [] $ inTags True "PathGeometry" []
$ inTags True "GeometryPathType" [("PathOpen","false")]
@@ -518,7 +520,7 @@ imageICML _ style _ (linkURI, _) =
$ vcat [
inTags True "Properties" [] $ inTags True "Profile" [("type","string")] $ text "$ID/Embedded"
$$ selfClosingTag "GraphicBounds" [("Left","0"), ("Top","0"), ("Right", hw), ("Bottom", hh)]
- , selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", linkURI)]
+ , selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", uriPrefix++linkURI)]
]
doc = inTags True "CharacterStyleRange" attrs
$ inTags True "Rectangle" [("Self","uec"), ("ItemTransform", "1 0 0 1 "++qw++" -"++qh)]