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

Make getParent() and getName() work when publishing on Windows #19

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

raducoravu
Copy link
Contributor

No description provided.

@raducoravu
Copy link
Contributor Author

Reason for this would be that when publishing with DITA OT 2.x on Windows, in the graphics map XML file the input-url attribute values end up looking like this:

   <gmap:graphic-map-item id="image-list-item-1" input-url="file:/D:/projects/eXml/samples/dita/flowers/images\Lilac.jpg"

so they contain back slashes in the value path, then the Relpath utilities for obtaining the parent and name of the URL fail.

@drmacro
Copy link
Contributor

drmacro commented May 20, 2016

Hmm. relpath already has functions for going from file paths to URLs that should address any Windows-specific issues. So the better solution may simply be to use that in the graphic map code.

On the other hand, it probably makes sense for those functions to just do the right thing. But at least originally I was trying to be pure about the file path/URI distinction and not have too much "magic".

@raducoravu
Copy link
Contributor Author

I understand if you want to approach this another way. Right now the images are not getting copied where they should.
I'm also looking into the problem of determining the images widths and heights, even with these fixes there still seem to be some errors reported for this in the console.

@raducoravu
Copy link
Contributor Author

Had more time to look into this, so on Windows the image.list contains such content:

        images\Lilac.jpg
        images\Gardeniaflower.jpg
        images\Snowdrop.jpg
        images\Iris_sanguinea.jpg
        images\Gerbera.jpg

and the template which matches each line of the file:

   <xsl:template mode="map2graphicmap:handleImageListFile" match="text()">

does this at some point:

<xsl:variable name="absoluteUrl" as="xs:string"
  select="relpath:newFile($inputdirUrl, concat($uplevels, .))"
/>

and it could also apply a toURL conversion on the entire value:

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

So maybe you could do this change to fix the problem instead.
So you can skip this pull request if you want. But I think also that my proposed changes would also make the processing more robust to such type of problems. Maybe if in those places where I replaced '' with '/' we could also output an xsl:message that states that the URL should not have contained windows-style slashes at that point.

@drmacro
Copy link
Contributor

drmacro commented May 25, 2016

I was not aware of this aspect of the image list--I'll definitely fix that.

I'll have to think more about accommodating backslashes in what should be URLs. Handling with a message seems like a reasonable compromise.

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

Successfully merging this pull request may close these issues.

2 participants