def tag_coffee_compile(self, caller):
        """{% coffee compile %} script {% endcoffee %}

        - Compiles script with top-level function and returns JavaScript.
        """
        return coffee.compile(
          caller(), bare=self.environment.coffee_compile_bare)
def coffeescript(options_text, cell_text):
    """The %%coffeescript cell magic function.
    """
    # import locally to NOT stick with old objects
    # after %reload_ext coffeetools
    from coffeetools import coffee, CoffeeError
    try:
        javascript = coffee.compile(cell_text)
    except CoffeeError as e:
        sys.stderr.write(str(e))
        sys.stderr.flush()
    else:
        display(Javascript(javascript))
# import pandas

# bokeh.plotting.output_notebook()

# In[60]:

# "https://gist.github.com/tonyfast/a8f64cb2b8ce1c9eee32137ef15f8cb4"

# In[61]:

jssource = coffee.compile("""
window.record ?= 
    ct: 0
    fps: 100
    frames: []
        
if window.RECORD? and window.RECORD and window.record.ct % window.record.fps 
    el = "#modelid_"+p.get('id')+" canvas"
    window.record.frames.push jQuery(el)[0].toDataURL('image/png')
window.record.ct += 1""")

# In[62]:


def recorder(p):
    p.x_range.callback = bokeh.models.CustomJS(
        args={
            'x': p.x_range,
            'y': p.y_range,
            'p': p,
        },
    def tag_coffee_compile_bare(self, caller):
        """{% coffee compile bare %} script {% endcoffee %}

        - Compiles script without top-level function and returns JavaScript.
        """
        return coffee.compile(caller(), bare=True)