module jspy.render_nb_json
¶
Short summary¶
module jyquickhelper.jspy.render_nb_json
Helpers around JSON
Classes¶
class |
truncated documentation |
---|---|
Renders JSON using javascript, outputs only HTML. |
|
Renders JSON using javascript. |
|
Renders JSON in a notebook using renderjson. |
Functions¶
function |
truncated documentation |
---|---|
Inspired from Pretty JSON Formatting in IPython Notebook. … |
Methods¶
method |
truncated documentation |
---|---|
|
Initialize with a JSON data. |
|
Initialize with a JSON data. |
Initialize with a JSON data. |
|
|
If self.local, copies javascript dependencies in the local folder. |
|
If self.local, copies javascript dependencies in the local folder. |
If self.local, copies javascript dependencies in the local folder. |
|
|
Overloads method _ipython_display_. … |
|
Overloads method _ipython_display_. … |
Overloads method _ipython_display_. … |
Documentation¶
Helpers around JSON
- 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:
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).
- 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.
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.
- _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.
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.
- _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.
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.
- __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.
- _copy_local(local)¶
If self.local, copies javascript dependencies in the local folder.
- generate_html()¶
Overloads method _ipython_display_.