From 4205866b998f0092dc8d64a9fc3edfc64ea399d9 Mon Sep 17 00:00:00 2001 From: Uwe Schmitt <uwe.schmitt@id.ethz.ch> Date: Wed, 17 Apr 2019 16:35:12 +0200 Subject: [PATCH] simplified custom.css handling in script 05 --- 05_classifiers_overview.ipynb | 358 +++++++++++----------------------- 1 file changed, 118 insertions(+), 240 deletions(-) diff --git a/05_classifiers_overview.ipynb b/05_classifiers_overview.ipynb index d589fa6..0b4b515 100644 --- a/05_classifiers_overview.ipynb +++ b/05_classifiers_overview.ipynb @@ -1,5 +1,123 @@ { "cells": [ + { + "cell_type": "code", + "execution_count": 73, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "<style>\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Kameron');\n", + " @import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Lato');\n", + " @import url('http://fonts.googleapis.com/css?family=Source+Sans+Pro');\n", + " \n", + " @import url('http://fonts.googleapis.com/css?family=Lora'); \n", + "\n", + " \n", + " body {\n", + " font-family: 'Lora', Consolas, sans-serif;\n", + " \n", + " -webkit-print-color-adjust: exact important !;\n", + " \n", + " \n", + " \n", + " }\n", + " \n", + " .alert-block {\n", + " width: 95%;\n", + " margin: auto;\n", + " }\n", + " \n", + " .rendered_html code\n", + " {\n", + " color: black;\n", + " background: #eaf0ff;\n", + " background: #f5f5f5; \n", + " padding: 1pt;\n", + " font-family: 'Source Code Pro', Consolas, monocco, monospace;\n", + " }\n", + " \n", + " p {\n", + " line-height: 140%;\n", + " }\n", + " \n", + " strong code {\n", + " background: red;\n", + " }\n", + " \n", + " .rendered_html strong code\n", + " {\n", + " background: #f5f5f5;\n", + " }\n", + " \n", + " .CodeMirror pre {\n", + " font-family: 'Source Code Pro', monocco, Consolas, monocco, monospace;\n", + " }\n", + " \n", + " .cm-s-ipython span.cm-keyword {\n", + " font-weight: normal;\n", + " }\n", + " \n", + " strong {\n", + " background: #f5f5f5;\n", + " margin-top: 4pt;\n", + " margin-bottom: 4pt;\n", + " padding: 2pt;\n", + " border: 0.5px solid #a0a0a0;\n", + " font-weight: bold;\n", + " color: darkred;\n", + " }\n", + " \n", + " \n", + " div #notebook {\n", + " # font-size: 10pt; \n", + " line-height: 145%;\n", + " }\n", + " \n", + " li {\n", + " line-height: 145%;\n", + " }\n", + "\n", + " div.output_area pre {\n", + " background: #fff9d8 !important;\n", + " padding: 5pt;\n", + " \n", + " -webkit-print-color-adjust: exact; \n", + " \n", + " }\n", + " \n", + " \n", + " \n", + " h1, h2, h3, h4 {\n", + " font-family: Kameron, arial;\n", + "\n", + "\n", + " }\n", + " \n", + " div#maintoolbar {display: none !important;}\n", + "</style>\n" + ], + "text/plain": [ + "<IPython.core.display.HTML object>" + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# IGNORE THIS LINE WHICH MODIFIES LAYOUT AND STYLING OF THE NOTEBOOK !\n", + "from IPython.core.display import HTML; HTML(open(\"custom.html\", \"r\").read())" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1801,252 +1919,12 @@ "</table>\n" ] }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/mikolajr/Workspace/courses/machinelearning-introduction-workshop/.venv/lib/python3.7/site-packages/ipykernel_launcher.py:9: UserWarning: get_ipython_dir has moved to the IPython.paths module since IPython 4.0.\n", - " if __name__ == '__main__':\n" - ] - }, - { - "data": { - "text/html": [ - "<style>\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Kameron');\n", - " @import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Lato');\n", - " @import url('http://fonts.googleapis.com/css?family=Source+Sans+Pro');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Lora'); \n", - "\n", - " body {\n", - " font-family: 'Lora', Consolas, sans-serif;\n", - " \n", - " -webkit-print-color-adjust: exact important !;\n", - " \n", - " \n", - " \n", - " }\n", - "\n", - " .alert-block {\n", - " width: 95%;\n", - " margin: auto;\n", - " }\n", - " \n", - " .rendered_html code\n", - " {\n", - " color: black;\n", - " background: #eaf0ff;\n", - " background: #f5f5f5; \n", - " padding: 1pt;\n", - " font-family: 'Source Code Pro', Consolas, monocco, monospace;\n", - " }\n", - " \n", - " p {\n", - " line-height: 140%;\n", - " }\n", - " \n", - " strong code {\n", - " background: red;\n", - " }\n", - " \n", - " em {\n", - " color: green;\n", - " }\n", - " \n", - " .rendered_html strong code\n", - " {\n", - " background: #f5f5f5;\n", - " }\n", - " \n", - " .CodeMirror pre {\n", - " font-family: 'Source Code Pro', monocco, Consolas, monocco, monospace;\n", - " }\n", - " \n", - " .cm-s-ipython span.cm-keyword {\n", - " font-weight: normal;\n", - " }\n", - " \n", - " strong {\n", - " background: #f5f5f5;\n", - " margin-top: 4pt;\n", - " margin-bottom: 4pt;\n", - " padding: 2pt;\n", - " border: 0.5px solid #a0a0a0;\n", - " font-weight: bold;\n", - " color: darkred;\n", - " }\n", - " \n", - " \n", - " div #notebook {\n", - " # font-size: 10pt; \n", - " line-height: 145%;\n", - " }\n", - " \n", - " li {\n", - " line-height: 145%;\n", - " }\n", - "\n", - " div.output_area pre {\n", - " background: #fff9d8 !important;\n", - " padding: 5pt;\n", - " \n", - " -webkit-print-color-adjust: exact; \n", - " \n", - " }\n", - " \n", - " \n", - " \n", - " h1, h2, h3, h4 {\n", - " font-family: Kameron, arial;\n", - " }\n", - " \n", - " div#maintoolbar {display: none !important;}\n", - " </style>" - ], - "text/plain": [ - "<IPython.core.display.HTML object>" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "#REMOVEBEGIN\n", - "# THE LINES BELOW ARE JUST FOR STYLING THE CONTENT ABOVE !\n", - "\n", - "from IPython import utils\n", - "from IPython.core.display import HTML\n", - "import os\n", - "def css_styling():\n", - " \"\"\"Load default custom.css file from ipython profile\"\"\"\n", - " base = utils.path.get_ipython_dir()\n", - " styles = \"\"\"<style>\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Source+Code+Pro');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Kameron');\n", - " @import url('http://fonts.googleapis.com/css?family=Crimson+Text');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Lato');\n", - " @import url('http://fonts.googleapis.com/css?family=Source+Sans+Pro');\n", - " \n", - " @import url('http://fonts.googleapis.com/css?family=Lora'); \n", - "\n", - " body {\n", - " font-family: 'Lora', Consolas, sans-serif;\n", - " \n", - " -webkit-print-color-adjust: exact important !;\n", - " \n", - " \n", - " \n", - " }\n", - "\n", - " .alert-block {\n", - " width: 95%;\n", - " margin: auto;\n", - " }\n", - " \n", - " .rendered_html code\n", - " {\n", - " color: black;\n", - " background: #eaf0ff;\n", - " background: #f5f5f5; \n", - " padding: 1pt;\n", - " font-family: 'Source Code Pro', Consolas, monocco, monospace;\n", - " }\n", - " \n", - " p {\n", - " line-height: 140%;\n", - " }\n", - " \n", - " strong code {\n", - " background: red;\n", - " }\n", - " \n", - " em {\n", - " color: green;\n", - " }\n", - " \n", - " .rendered_html strong code\n", - " {\n", - " background: #f5f5f5;\n", - " }\n", - " \n", - " .CodeMirror pre {\n", - " font-family: 'Source Code Pro', monocco, Consolas, monocco, monospace;\n", - " }\n", - " \n", - " .cm-s-ipython span.cm-keyword {\n", - " font-weight: normal;\n", - " }\n", - " \n", - " strong {\n", - " background: #f5f5f5;\n", - " margin-top: 4pt;\n", - " margin-bottom: 4pt;\n", - " padding: 2pt;\n", - " border: 0.5px solid #a0a0a0;\n", - " font-weight: bold;\n", - " color: darkred;\n", - " }\n", - " \n", - " \n", - " div #notebook {\n", - " # font-size: 10pt; \n", - " line-height: 145%;\n", - " }\n", - " \n", - " li {\n", - " line-height: 145%;\n", - " }\n", - "\n", - " div.output_area pre {\n", - " background: #fff9d8 !important;\n", - " padding: 5pt;\n", - " \n", - " -webkit-print-color-adjust: exact; \n", - " \n", - " }\n", - " \n", - " \n", - " \n", - " h1, h2, h3, h4 {\n", - " font-family: Kameron, arial;\n", - " }\n", - " \n", - " div#maintoolbar {display: none !important;}\n", - " </style>\"\"\"\n", - " return HTML(styles)\n", - "css_styling()\n", - "#REMOVEEND" - ] - }, { "cell_type": "markdown", "metadata": {}, "source": [ "Copyright (C) 2019 ETH Zurich, SIS ID" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { -- GitLab