Skip to content

Instantly share code, notes, and snippets.

@lbustelo
Created March 29, 2016 16:28
Show Gist options
  • Save lbustelo/ebb9e7e10bb03c4a169b to your computer and use it in GitHub Desktop.
Save lbustelo/ebb9e7e10bb03c4a169b to your computer and use it in GitHub Desktop.
Example of using juicy-html and jupyter-declarativewidgets notebook
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<link rel='import' is='urth-core-import' \n",
" href='urth_components/juicy-html/juicy-html.html' package='Juicy/juicy-html'></link>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<link rel='import' is='urth-core-import' \n",
" href='urth_components/juicy-html/juicy-html.html' package='Juicy/juicy-html'></link>\n"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def toHTML( list=[] ):\n",
" return \"<ul>\" + \"\".join(map( lambda item: \"<li>{}</li>\".format(item), list)) + \"</ul>\""
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<template is=\"dom-bind\">\n",
" <input value=\"{{list::change}}\"></input>\n",
" <urth-core-function ref=\"toHTML\" arg-list=\"{{list}}\" result=\"{{res}}\" auto></urth-core-function>\n",
" <template id=\"juice\" is=\"juicy-html\" content$=\"{{res}}\"></template>\n",
"</template>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<template is=\"dom-bind\">\n",
" <input value=\"{{list::change}}\"></input>\n",
" <urth-core-function ref=\"toHTML\" arg-list=\"{{list}}\" result=\"{{res}}\" auto></urth-core-function>\n",
" <template id=\"juice\" is=\"juicy-html\" content$=\"{{res}}\"></template>\n",
"</template>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment