Exportable extension

Resolves #38. This pull request supersedes #159.
I ended up removing the test. The SVG version of the legend is destroyed before the test would be able to check it. Maybe there's another way to test, or maybe for now it's sufficient.