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

Metadata support #94

Closed
edemaine opened this issue Sep 22, 2022 · 0 comments
Closed

Metadata support #94

edemaine opened this issue Sep 22, 2022 · 0 comments

Comments

@edemaine
Copy link
Owner

edemaine commented Sep 22, 2022

SVG supports several metadata tags that can appear at the top level: <title>, <desc>, <metadata>, and I guess <style> and <script>.

svgtiler.afterRender is a decent way to add these:

svgtiler.afterRender -> <desc>Made with SVG Tiler!</desc>
svgtiler.afterRender ({drawing}) -> <title>{drawing.filename}</title>
svgtiler.afterRender (render) -> <style>...some dynamic style depending on render...</style>

However, currently these get wrapped in <svg> which is probably not ideal.

We can instead call svgtiler.def(...).force(), but this will assign them an id.

I also wonder whether it makes sense to add an svgtiler.metadata callback (similar to svgtiler.def) that just takes the tag as an argument, and adds that content without any wrapper or id. It could still be called within svgtiler.afterRender (in which case it gets added directly to the render), or not for static content (like the <desc> above, in which case it gets attached to the mapping). Alternatively, if we restrict to this being called in beforeRender/afterRender/tile (not at top level of mapping), then it could be a method of the render object, e.g., svgtiler.currentRender().add().

Related, I wonder whether a svgtiler.afterRender callback should be calling an svgtiler.overlay() or render.add() function instead of just returning VDOM content for that overlay. This would also allow calling it in svgtiler.beforeRender. (We could also support svgtiler.beforeRender returning VDOM content, but it's a bit annoying in CoffeeScript to make sure you don't accidentally return something... though arguably that's an issue with CoffeeScript, not SVG Tiler.) Then all render modifications would be naturally wrapped in svgtiler.{def,metadata,overlay}.

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