summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-26 17:14:10 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-26 17:14:10 -0700
commitc3cb27f2f2b8f3671097f0344b9a1a0762cc86d0 (patch)
tree947877cf920b1856f5b4d4674d941536866d2d49 /src/Text
parent6397c10dec06c7ff983b2a52e6dbc0ac83d849fd (diff)
parent8af168a7fe0553b8d240118edf1dd0592b258da6 (diff)
Merge pull request #2141 from DigitalPublishingToolkit/icml-images
Fix image URIs in ICML output
Diffstat (limited to 'src/Text')
-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)]