From 32ebdb7961973ffaa8323a5f8e70e39f9dd4df72 Mon Sep 17 00:00:00 2001 From: Hugo Kerstens <hugokk@hotmail.nl> Date: Mon, 6 May 2019 20:57:09 +0200 Subject: [PATCH] Merge plotly init cell with main init cell --- extra_markdown.tpl | 18 +++++------------- src/12_band_structures_in_higher_dimensions.md | 2 -- src/1_einstein_model.md | 2 -- src/9_crystal_structure.md | 2 -- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/extra_markdown.tpl b/extra_markdown.tpl index 3aec3fa9..ee7443ba 100644 --- a/extra_markdown.tpl +++ b/extra_markdown.tpl @@ -11,22 +11,14 @@ {% endblock %} {% block display_data %} -{% if cell.metadata.attributes and cell.metadata.attributes.editable == 'false' and not cell.metadata.attributes.plotly %} +{% if cell.metadata.attributes and cell.metadata.attributes.editable == 'false' and not cell.metadata.attributes.initialize %} {{ super() }} -{% elif cell.metadata.attributes and cell.metadata.attributes.plotly %} -<div class="thebelab-init-code"> - <pre class="thebelab-code" data-executable="true" data-language="python"> - {{cell.source}} - </pre> -</div> +{% elif cell.metadata.attributes and cell.metadata.attributes.initialize %} +{% if output.data['text/html'] %} <div> -{{ output.data['text/html'] }} -</div> -{% elif output.data['text/html'] %} -<pre class="thebelab-code" data-executable="true" data-language="python">{{cell.source}}</pre> -<div class="thebelab-output" data-output="true"> -{{ output.data['text/html'] }} + {{ output.data['text/html'] }} </div> +{% endif %} {% else %} <pre class="thebelab-code" data-executable="true" data-language="python">{{cell.source}}</pre> <div class="thebelab-output" data-output="true" markdown="1"> diff --git a/src/12_band_structures_in_higher_dimensions.md b/src/12_band_structures_in_higher_dimensions.md index ff0121dd..c233b9d5 100644 --- a/src/12_band_structures_in_higher_dimensions.md +++ b/src/12_band_structures_in_higher_dimensions.md @@ -4,9 +4,7 @@ import plotly.offline as py import plotly.graph_objs as go pi = np.pi -``` -```{python plotly=true} py.init_notebook_mode(connected=True) ``` diff --git a/src/1_einstein_model.md b/src/1_einstein_model.md index 092a7c3e..4d0dfd50 100644 --- a/src/1_einstein_model.md +++ b/src/1_einstein_model.md @@ -26,9 +26,7 @@ import plotly.graph_objs as go from common import draw_classic_axes, configure_plotting configure_plotting() -``` -```{python plotly=true} py.init_notebook_mode(connected=True) ``` diff --git a/src/9_crystal_structure.md b/src/9_crystal_structure.md index 03565678..d345c654 100644 --- a/src/9_crystal_structure.md +++ b/src/9_crystal_structure.md @@ -24,9 +24,7 @@ import plotly.offline as py import plotly.graph_objs as go configure_plotting() -``` -```{python plotly=true} py.init_notebook_mode(connected=True) ``` -- GitLab