Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphics not copied #66

Open
bcolborn opened this issue May 3, 2017 · 1 comment
Open

graphics not copied #66

bcolborn opened this issue May 3, 2017 · 1 comment

Comments

@bcolborn
Copy link

bcolborn commented May 3, 2017

With the d4p-html5 plugin (RC26 from Nov 14, 2016) on OT 2.4.5, images aren't copied. fileset/@dir in copy-graphics.xml is empty.

I tried to resolve the issue with Radu's solution from dita4publishers/org.dita4publishers.epub#71 but with no progress. I also tried OT properties like args.input.dir likewise with no progress.

Ultimately I was able to get the images to copy by modifying $absoluteUrl in xsl:template mode="map2graphicmap:handleImageListFile" match="text()" in map2graphicMap.xsl:

     <xsl:variable name="absoluteUrl" as="xs:string"
-      select="relpath:newFile($inputdirUrl, concat(replace($uplevels, '\\', '/'), .))"
+      select="relpath:toUrl(relpath:newFile($inputdir, concat(replace($uplevels, '\\', '/'), .)))"
     />

But even so, results are inconsistent. Some maps get all their images copied, some don't.

@bcolborn
Copy link
Author

bcolborn commented Aug 8, 2017

I've figured out a workaround in two pieces (now with OT 2.5.2).

First, two modifications to the map2graphicmap:handleImageListFile template:

     <xsl:variable name="absoluteUrl" as="xs:string"
-      select="relpath:toUrl(relpath:newFile($inputdir, concat(replace($uplevels, '\\', '/'), .)))" />
+      select="relpath:newFile($inputdirUrl, concat(replace($uplevels, '\\', '/'), .))" />
     <gmap:graphic-map-item id="image-list-item-{$position}" input-url="{$absoluteUrl}"
-      output-url="{relpath:toUrl(relpath:newFile($imagesOutputPath, relpath:getName($absoluteUrl)))}" />
+      output-url="{relpath:toUrl(relpath:newFile($imagesOutputPath, relpath:getName(replace($absoluteUrl, '\\', '/'))))}" />

I really don't see why these changes to $absoluteUrl make a difference because it looks logically equivalent to the original construction. But in the original, the value of $inputdir is missing.

Which brings me to the second part of the workaround. dita.input.dirname has to be specified on the command-line, which I don't think should be required. Furthermore a bogus directory has to be tacked on because the last segment disappears somewhere along the way. If I specify the actual location e.g. C:/users/ben/documents/documentation then it gets truncated to C:/users/ben/documents which is not correct.

So while I'm unblocked I'm not comfortable with the solution and would be interested in something tidier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant