module jspy.render_nb_json

Inheritance diagram of jyquickhelper.jspy.render_nb_json

Short summary

module jyquickhelper.jspy.render_nb_json

Helpers around JSON

source on GitHub

Classes

class

truncated documentation

RenderJSON

Renders JSON using javascript, outputs only HTML.

RenderJSONObj

Renders JSON using javascript.

RenderJSONRaw

Renders JSON in a notebook using renderjson.

Functions

function

truncated documentation

JSONJS

Inspired from Pretty JSON Formatting in IPython Notebook. …

Methods

method

truncated documentation

__init__

Initialize with a JSON data.

__init__

Initialize with a JSON data.

__init__

Initialize with a JSON data.

_copy_local

If self.local, copies javascript dependencies in the local folder.

_copy_local

If self.local, copies javascript dependencies in the local folder.

_copy_local

If self.local, copies javascript dependencies in the local folder.

_ipython_display_

_repr_html_

generate_html

Overloads method _ipython_display_. …

generate_html

Overloads method _ipython_display_. …

generate_html

Overloads method _ipython_display_. …

Documentation

Helpers around JSON

source on GitHub

jyquickhelper.jspy.render_nb_json.JSONJS(data, only_html=True, show_to_level=None, local=False)

Inspired from Pretty JSON Formatting in IPython Notebook.

Parameters:
  • data – dictionary or json string

  • show_to_level – show first level

  • local – use local files

Returns:

RenderJSON

The function uses library renderjson. It returns an object with overwrite method _ipython_display_. If local is true, javascript dependency are copied in the local folder.

Persistent javascript in a conververted notebook

After a couple of tries, it appears that it is more efficient to render the javascript inside a section <script>...</script> when the notebook is converted to RST (only_html=True).

source on GitHub

class jyquickhelper.jspy.render_nb_json.RenderJSON(json_data, width='100%', height='100%', divid=None, show_to_level=None, local=False)

Bases: RenderJSONRaw

Renders JSON using javascript, outputs only HTML.

source on GitHub

Initialize with a JSON data.

Parameters:
  • json_data – dictionary or string

  • width – (str) width

  • height – (str) height

  • divid – (str|None) id of the div

  • show_to_level – (int|None) show first level

  • local – (bool|False) use local javascript files

If local, local javascript files are copied in the current folder.

source on GitHub

_repr_html_()
class jyquickhelper.jspy.render_nb_json.RenderJSONObj(json_data, width='100%', height='100%', divid=None, show_to_level=None, local=False)

Bases: RenderJSONRaw

Renders JSON using javascript.

source on GitHub

Initialize with a JSON data.

Parameters:
  • json_data – dictionary or string

  • width – (str) width

  • height – (str) height

  • divid – (str|None) id of the div

  • show_to_level – (int|None) show first level

  • local – (bool|False) use local javascript files

If local, local javascript files are copied in the current folder.

source on GitHub

_ipython_display_()
class jyquickhelper.jspy.render_nb_json.RenderJSONRaw(json_data, width='100%', height='100%', divid=None, show_to_level=None, local=False)

Bases: object

Renders JSON in a notebook using renderjson.

source on GitHub

Initialize with a JSON data.

Parameters:
  • json_data – dictionary or string

  • width – (str) width

  • height – (str) height

  • divid – (str|None) id of the div

  • show_to_level – (int|None) show first level

  • local – (bool|False) use local javascript files

If local, local javascript files are copied in the current folder.

source on GitHub

__init__(json_data, width='100%', height='100%', divid=None, show_to_level=None, local=False)

Initialize with a JSON data.

Parameters:
  • json_data – dictionary or string

  • width – (str) width

  • height – (str) height

  • divid – (str|None) id of the div

  • show_to_level – (int|None) show first level

  • local – (bool|False) use local javascript files

If local, local javascript files are copied in the current folder.

source on GitHub

_copy_local(local)

If self.local, copies javascript dependencies in the local folder.

source on GitHub

generate_html()

Overloads method _ipython_display_.

source on GitHub