diff options
Diffstat (limited to 'PVCM/cama/.jupyter/custom')
| -rw-r--r-- | PVCM/cama/.jupyter/custom/custom.css | 74 | ||||
| -rw-r--r-- | PVCM/cama/.jupyter/custom/custom.js | 44 |
2 files changed, 118 insertions, 0 deletions
diff --git a/PVCM/cama/.jupyter/custom/custom.css b/PVCM/cama/.jupyter/custom/custom.css new file mode 100644 index 0000000..6034bbd --- /dev/null +++ b/PVCM/cama/.jupyter/custom/custom.css @@ -0,0 +1,74 @@ +<style> + @font-face { + font-family: "Computer Modern"; + src: url('http://9dbb143991406a7c655e-aa5fcb0a5a4ec34cff238a2d56ca4144.r56.cf5.rackcdn.com/cmunss.otf'); + } + @font-face { + font-family: "Computer Modern"; + font-weight: bold; + src: url('http://9dbb143991406a7c655e-aa5fcb0a5a4ec34cff238a2d56ca4144.r56.cf5.rackcdn.com/cmunsx.otf'); + } + @font-face { + font-family: "Computer Modern"; + font-style: oblique; + src: url('http://9dbb143991406a7c655e-aa5fcb0a5a4ec34cff238a2d56ca4144.r56.cf5.rackcdn.com/cmunsi.otf'); + } + @font-face { + font-family: "Computer Modern"; + font-weight: bold; + font-style: oblique; + src: url('http://9dbb143991406a7c655e-aa5fcb0a5a4ec34cff238a2d56ca4144.r56.cf5.rackcdn.com/cmunso.otf'); + } + div.cell{ + width:90%; + margin-left:5% !important; + margin-right:auto; + } + div.rendered_html code { + font-family: monospace, monospace; + font-size: 90%; + padding-top: 1px; + padding-left: 2px; + color: #803030; + } + div.text_cell_render{ + font-family: Computer Modern, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; + line-height: 110%; + font-size: 110%; + margin-left:0%; + margin-right:auto; + } + .container { width:95% !important; } + .warning{ + color: rgb( 240, 20, 20 ) + } + .rendered_html ol {list-style:decimal; margin: 1em 2em;} + + .rendered_html tr, .rendered_html th, .rendered_html td { + text-align: center; + } + .rendered_html :first-child { + text-align: left; + } + .rendered_html :last-child { + text-align: left; + } + .nav > li > .clusters_tab_link { + display:none; + } +</style> +<script> + MathJax.Hub.Config({ + TeX: { + extensions: ["AMSmath.js"] + }, + tex2jax: { + inlineMath: [ ['$','$'], ["\\(","\\)"] ], + displayMath: [ ['$$','$$'], ["\\[","\\]"] ] + }, + displayAlign: 'center', // Change this to 'center' to center equations. + "HTML-CSS": { + styles: {'.MathJax_Display': {"margin": 4}} + } + }); +</script> diff --git a/PVCM/cama/.jupyter/custom/custom.js b/PVCM/cama/.jupyter/custom/custom.js new file mode 100644 index 0000000..4b280ad --- /dev/null +++ b/PVCM/cama/.jupyter/custom/custom.js @@ -0,0 +1,44 @@ +import json +import os +import re +import ipykernel +import requests +from notebook.notebookapp import list_running_servers +from urllib.parse import urljoin +from IPython.display import display, Markdown + +def get_notebook_path(): + """ + Return the full path of the jupyter notebook. + """ + session = requests.Session() + session.trust_env = False + kernel_id = re.search('kernel-(.*).json', + ipykernel.connect.get_connection_file()).group(1) + servers = list_running_servers() + if + for ss in servers: + response = session.get(f"{ss['url']}api/sessions", + params={'token': ss['token']}) + for nn in json.loads(response.text): + if nn['kernel']['id'] == kernel_id: + try: + return os.envion['HOME_URL'] + 'notebooks/' + nn['notebook']['path'] + except: + return ss['url'] + 'notebooks/' + nn['notebook']['path'] + +def PreviousNext(url1, url2): + section = get_notebook_path() + section = section.replace('notebooks','tree') + section = section[:section.rfind('/')] + toc = "http://python3.mooc.lrde.epita.fr/notebooks/Table%20des%20mati%C3%A8res.ipynb" + text = 200 * " " + text += "<br/><center>" + text += f'<a href="{url1}">{url1[url1.rfind("/")+1:-6]}</a>' +# text += f' ← <a href="{section}" style="text-decoration:none"> △ </a> → ' + text += f' ← <a href="{toc}" style="text-decoration:none"> △ </a> → ' + text += f'<a href="{url2}">{url2[url2.rfind("/")+1:-6]}</a>' + text += '</center><br/>' + text += ' ' + return text + |
