Fantastic sleuthing, I never would've found that. It works like a charm for getting the scripts out.
The only issue now is this line <https://github.com/dcjones/Compose.jl/blob/264d87d87d74857437cc05690bbfa53e70cadd96/src/svg.jl#L338>. Node.js provides its own require function, so when the script runs I get an error about require expecting a string. You'll know better than me how to fix that, but I figure a try/catch would do the trick if nothing else. Beyond that we should be golden. A dark theme for Gadfly would be awesome, especially if it plays well with June Night <https://github.com/one-more-minute/June-LT> :) Theming is a bit tricky at the moment, though, especially because I want to support both light and dark themes well across the board. My preferred solution would be to have both themes in CSS like so: .gadfly { // Default, will apply in IPython etc. background: white; } .dark .gadfly { // These will take over when the containing element has the "dark" class background: black; } Does that seem reasonable? If you're not using CSS to style Gadfly already I do think it would make sense – it'd be nice if people could easily produce custom themes. Of course, if this isn't feasible that's fine too – I haven't done much in the way of allowing custom display methods yet, but I'm happy to do whatever's best for you. On 23 June 2014 17:32, Daniel Jones <[email protected]> wrote: > > Sorry to break Jewel support. I did a little digging in MDN. Here > <https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement> it > says that the text field is a concatenation of contents of all the child > text nodes. Now, text elements have a field wholeText > <https://developer.mozilla.org/en-US/docs/Web/API/Text.wholeText> which > gives the concatenation of all the text node siblings. So I'm thinking it > should be equivalent, and standards-compliant to to do: > > script.childNodes.length > 0 ? script.childNodes[0].wholeText : "" > > And that should work for HTMLScriptElement and SVGScriptElement. Also, if > it turns out not to be practical to eval the SVGScriptElement nodes, it > should be completely possible to move the script tags out of the SVG. > > I would like to have a custom theme for plots when displaying on > LightTable, to make them jive better with a dark background. I'm guessing > that would I would have to import Jewel and define a special display method? > > > On Monday, June 23, 2014 9:02:05 AM UTC-7, Mike Innes wrote: >> >> Turns out that I can't eval the Gadfly scripts because they are now >> inside SVGScriptElement blocks (as opposed to HTMLScriptElement), which >> don't have a .text property. Any javascript wizards around who know of a >> way around this? >> >> On Monday, 23 June 2014 09:45:43 UTC+1, Mike Innes wrote: >>> >>> This looks great. Unfortunately it did break the interactivity on Light >>> Table as predicted, but hopefully that'll be easy to fix. But the plots now >>> display properly even without JS, which is nice. >>> >>> One issue is that plots don't show up well against dark backgrounds – >>> you might want to consider adding a white background to them. If not I can >>> always add in some custom CSS though. >>> >>> On Friday, 20 June 2014 23:24:14 UTC+1, Daniel Jones wrote: >>>> >>>> I've just merged branches in Gadfly and Compose that I've been working >>>> on for a while, and I'm going to tag a new version relatively soon. >>>> >>>> For the most part things should work as before. But if you are >>>> explicitly using the D3 backend or Compose, then I'm about to break your >>>> code. Sorry. >>>> >>>> Here's a brief explanation of the changes: http://nbviewer.ipython.org/ >>>> gist/dcjones/4d3088d74db6a83b12d3 >>>> >>>> If you run into problems after the update, please let me know. I >>>> realize I've been a little inattentive to issues lately, but with this out >>>> of the way, I'm going to focus on working through those. >>>> >>>
