-
Notifications
You must be signed in to change notification settings - Fork 132
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
Unable to set namespaces #17
Comments
Are you trying to render |
If you are using the 'use' element inside the svg, you have to specify the xlink namespace.
But I am not able to do this out of the box. Obviously, in the long run, there is likely a lot more to do to fully enable SVG support in this library (and I may end up submitting a pull for some of this functionality), but for now, allowing for the addition of this custom namespace is required. |
I have a similar requirements. But in the root html tag.
need a custom namespace for xmlns:t and xmlns:p I tried putting it as an attribute, but it gets rejected.
|
Okay for now i'm using a workaround by using String.replace to replace the xmlns to xmlns:t. |
I had a similar problem and needed to define two SVG graphics: <svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" xmlns="http://www.w3.org/2000/svg" height="0" width="0" style="position: absolute;">
<defs>
<g id="folder" fill="none">
<path d="M285.22 37.55h-142.6L110.9 0H31.7C14.25 0 0 16.9 0 37.55v75.1h316.92V75.1c0-20.65-14.26-37.55-31.7-37.55z" fill="#FFA000"></path>
<path d="M285.22 36H31.7C14.25 36 0 50.28 0 67.74v158.7c0 17.47 14.26 31.75 31.7 31.75H285.2c17.44 0 31.7-14.3 31.7-31.75V67.75c0-17.47-14.26-31.75-31.7-31.75z" fill="#FFCA28"></path>
</g>
<g id="file" stroke="#000" stroke-width="25" fill="#FFF" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<path d="M13 24.12v274.76c0 6.16 5.87 11.12 13.17 11.12H239c7.3 0 13.17-4.96 13.17-11.12V136.15S132.6 13 128.37 13H26.17C18.87 13 13 17.96 13 24.12z"></path>
<path d="M129.37 13L129 113.9c0 10.58 7.26 19.1 16.27 19.1H249L129.37 13z"></path>
</g>
</defs>
</svg> |
Got the same problem. I want to create epub files which require two namespaces in the header:
Trying to set either ´xmlns:ops´ or ´xml:lang´ via the attributes map results in an error ´Tag html has invalid attribute name´. Any way to set these two entries via the DSL? |
@henningBunk use raw() const val SVG = """
<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" height="0" width="0" style="position: absolute;">
<defs>
.........
</defs>
</svg>
"""
body {
unsafe { raw(SVG) }
} |
@XhstormR I don't get how this should work though since I will wrap my hardcoded string which represents the root element inside of the body which breaks the hierarchy. It should be the other way around. What am I missing? Also I would have to write a lot of the html/xml myself that way, which isnt the point of a DSL. I settled for a replacement method, but still wished it would be possible with the native DSL. buildString {
appendLine("""<?xml version="1.0" encoding="UTF-8"?>""")
appendLine("""<!DOCTYPE html>""")
appendHTML().html(
namespace = "http://www.w3.org/1999/xhtml"
) {
attributes["placeholder"] = "replace"
...
}
}.replace(
"""placeholder="replace"""".toRegex(),
"""xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="de""""
) |
I'm not able to properly render an SVG tag, because it is not possible to include the xmlns:xlink="http://www.w3.org/1999/xlink" attribute. The library complains that this is not a valid attribute name.
The text was updated successfully, but these errors were encountered: