Browse Source

Fix template for collapsable code

Benjamin ABEL 10 years ago
parent
commit
4ee106ac8f

+ 2 - 2
liquid_tags/Readme.md

@@ -161,8 +161,8 @@ The notebook tag also has two optional arguments: ``cells`` and ``language``.
 ### Collapsible Code in IPython Notebooks
 ### Collapsible Code in IPython Notebooks
 
 
 The plugin also enables collapsible code input boxes. For this to work
 The plugin also enables collapsible code input boxes. For this to work
-you first need to copy the file ``pelicanhtml_1.tpl`` (for IPython
-1.x) ``pelicanhtml_2.tpl`` (for IPython 2.x) to the top level of your
+you first need to copy the file ``pelicanhtml_3.tpl`` (for IPython
+3.x, ``pelicanhtml_2.tpl`` (for IPython 2.x)...) to the top level of your
 Pelican blog. Notebook input cells containing the comment line ``#
 Pelican blog. Notebook input cells containing the comment line ``#
 <!-- collapse=True -->`` will be collapsed when the html page is
 <!-- collapse=True -->`` will be collapsed when the html page is
 loaded and can be expanded by clicking on them. Cells containing the
 loaded and can be expanded by clicking on them. Cells containing the

+ 2 - 2
liquid_tags/pelicanhtml_3.tpl

@@ -34,13 +34,13 @@
 
 
 {% block input %}
 {% block input %}
 {% if "# <!-- collapse=True -->" in cell.source %}
 {% if "# <!-- collapse=True -->" in cell.source %}
-<div class="inner_cell"><span style="font-weight: bold;">Expand Code</span>
+<div class="collapseheader inner_cell"><span style="font-weight: bold;">Expand Code</span>
 <div class="input_area" style="display:none">
 <div class="input_area" style="display:none">
 {{ cell.source.replace("# <!-- collapse=True -->\n", "") | highlight2html(metadata=cell.metadata) }}
 {{ cell.source.replace("# <!-- collapse=True -->\n", "") | highlight2html(metadata=cell.metadata) }}
 </div>
 </div>
 </div>
 </div>
 {% elif "# <!-- collapse=False -->" in cell.source %}
 {% elif "# <!-- collapse=False -->" in cell.source %}
-<div class="inner_cell"><span style="font-weight: bold;">Collapse Code</span>
+<div class="collapseheader inner_cell"><span style="font-weight: bold;">Collapse Code</span>
 <div class="input_area">
 <div class="input_area">
 {{ cell.source.replace("# <!-- collapse=False -->\n", "") | highlight2html(metadata=cell.metadata) }}
 {{ cell.source.replace("# <!-- collapse=False -->\n", "") | highlight2html(metadata=cell.metadata) }}
 </div>
 </div>

+ 2 - 0
liquid_tags/test_data/content/notebooks/test_nbformat4.ipynb

@@ -47,6 +47,7 @@
     }
     }
    ],
    ],
    "source": [
    "source": [
+    "# <!-- collapse=True -->\n",
     "a = 1\n",
     "a = 1\n",
     "b = 1.0\n",
     "b = 1.0\n",
     "\n",
     "\n",
@@ -85,6 +86,7 @@
     }
     }
    ],
    ],
    "source": [
    "source": [
+    "# <!-- collapse=False -->\n",
     "a = 'Mon texte'\n",
     "a = 'Mon texte'\n",
     "b = \"Mon deuxième texte\"\n",
     "b = \"Mon deuxième texte\"\n",
     "\n",
     "\n",