Explorar o código

Fix syntax highlighting for collapsible code
Document language option

Jörg Dietrich %!s(int64=10) %!d(string=hai) anos
pai
achega
0b8aa3a59b
Modificáronse 2 ficheiros con 6 adicións e 3 borrados
  1. 4 1
      liquid_tags/notebook.py
  2. 2 2
      liquid_tags/pelicanhtml_3.tpl

+ 4 - 1
liquid_tags/notebook.py

@@ -6,7 +6,7 @@ notebook in a blog post.
 
 Syntax
 ------
-{% notebook filename.ipynb [ cells[start:end] ]%}
+{% notebook filename.ipynb [ cells[start:end] language[language] ]%}
 
 The file should be specified relative to the ``notebooks`` subdirectory of the
 content directory.  Optionally, this subdirectory can be specified in the
@@ -17,6 +17,9 @@ config file:
 The cells[start:end] statement is optional, and can be used to specify which
 block of cells from the notebook to include.
 
+The language statement is obvious and can be used to specify whether ipython2
+or ipython3 syntax highlighting should be used.
+
 Requirements
 ------------
 - The plugin requires IPython version 1.0 or above.  It no longer supports the

+ 2 - 2
liquid_tags/pelicanhtml_3.tpl

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