Created
March 29, 2016 16:28
-
-
Save lbustelo/ebb9e7e10bb03c4a169b to your computer and use it in GitHub Desktop.
Example of using juicy-html and jupyter-declarativewidgets notebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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