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

Handle spaces in URIs #15

Open
drmacro opened this issue Dec 3, 2015 · 1 comment
Open

Handle spaces in URIs #15

drmacro opened this issue Dec 3, 2015 · 1 comment

Comments

@drmacro
Copy link
Contributor

drmacro commented Dec 3, 2015

From Radu Coravu:

One more suggestion to make mathml refs properly work even when the mathml equation is in a folder structure with spaces in it.
In the file relpath_util.xsl the function "relpath:toUrl" should be slightly modified like:

        <xsl:function name="relpath:toUrl" as="xs:string">
            <xsl:param name="filepath" as="xs:string"/>
            <xsl:variable name="url" as="xs:string"
                select="if (contains($filepath, '\'))
                then translate($filepath, '\', '/')
                else $filepath
                "
            />
            <xsl:variable name="fileUrl" as="xs:string"
                select="
                if (matches($url, '^[a-zA-Z]:'))
                then concat('file:/', $url)
                else if(starts-with($url, '/')) then concat('file:', $url) else $url"
            />
            <xsl:sequence select="replace($fileUrl, ' ', '%20')"/>
        </xsl:function>

so that it does two extra things:

  1. If the initial URL fragment starts with "/", it means it is a Linux file path and we need to prepend file: to it.
  2. Replace simple spaces with url encoded version.

This worked for me.

drmacro added a commit that referenced this issue Dec 29, 2015
@drmacro
Copy link
Contributor Author

drmacro commented Dec 29, 2015

Fix committed on develop branch.

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