{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Remarkuple 3 examples\n", "\n", "Import remarkuple module:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from remarkuple import helper as h, table, svg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Basic HTML" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "
text link bold italic
\n" ] }, { "data": { "text/html": [ "
text link bold italic
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t = h.div('text ', h.a(\"link\"), h.b(\" bold\"), h.i(\" italic\"))\n", "print (t)\n", "t" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## HTML table" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
Contacts
TitleNamePhone
Mr.John07868785831
MissLinda0141-2244-5566
MasterJack0142-1212-1234
Mr.Bush911-911-911
" ], "text/plain": [ ".table at 0x1067fc470>" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "csv = \"\"\"Title,Name,Phone\n", "Mr.,John,07868785831\n", "Miss,Linda,0141-2244-5566\n", "Master,Jack,0142-1212-1234\n", "Mr.,Bush,911-911-911\"\"\"\n", "\n", "tbl = table()\n", "tbl.addCaption(\"Contacts\")\n", "for idx, row in enumerate(csv.split(\"\\n\")):\n", " if idx:\n", " tbl.addBodyRow(h.tr(*[h.td(x) for x in row.split(\",\")]))\n", " else:\n", " tbl.addHeadRow(h.tr(*[h.th(x) for x in row.split(\",\")]))\n", "\n", "tbl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## SVG graphics" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ ".svg at 0x1067ebac8>" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s = svg().set_axes(False).set_grid(True)\n", "s.set_circle(r=100, fill=\"green\", style=\"fill-opacity: 50%\")\n", "print (s)\n", "h.br\n", "s" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "print (svg())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The [MIT](http://choosealicense.com/licenses/mit/) License\n", "\n", "Copyright (c) 2016 Marko Manninen" ] } ], "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.5.1" } }, "nbformat": 4, "nbformat_minor": 0 }