Merge pull request #110 from jseabold/ipython-fixes

IPython cleanup
This commit is contained in:
Justin Mayer
2013-11-16 15:59:17 -08:00
2 changed files with 7 additions and 12 deletions

View File

@@ -80,13 +80,7 @@ config file:
Because the conversion and rendering of notebooks is rather involved, there
are a few extra steps required for this plugin:
- First, the plugin requires that the nbconvert package [1]_ to be in the
python path. For example, in bash, this can be set via
>$ export PYTHONPATH=/path/to/nbconvert/
The nbconvert package is still in development, so we recommend using the
most recent version.
- First, you will need to install IPython >= 1.0 [1]_
- After typing "make html" when using the notebook tag, a file called
``_nb_header.html`` will be produced in the main directory. The content
@@ -104,4 +98,4 @@ are a few extra steps required for this plugin:
this will insert the proper css formatting into your document.
[1] https://github.com/ipython/nbconvert
[1] http://ipython.org/

View File

@@ -48,8 +48,9 @@ import re
import os
from .mdx_liquid_tags import LiquidTags
from distutils.version import LooseVersion
import IPython
if IPython.__version__.split('.')[0] != '1':
if not LooseVersion(IPython.__version__) >= '1.0':
raise ValueError("IPython version 1.0+ required for notebook tag")
from IPython import nbconvert
@@ -166,16 +167,16 @@ class SubCell(Transformer):
nbc = deepcopy(nb)
for worksheet in nbc.worksheets :
cells = worksheet.cells[:]
worksheet.cells = cells[self.start:self.end]
worksheet.cells = cells[self.start:self.end]
return nbc, resources
#----------------------------------------------------------------------
# Customize the html template:
# This changes the <pre> tags in basic_html.tpl to <pre class="ipynb"
pelican_loader = DictLoader({'pelicanhtml.tpl':
pelican_loader = DictLoader({'pelicanhtml.tpl':
"""
{%- extends 'basichtml.tpl' -%}
{%- extends 'basichtml.tpl' -%}
{% block stream_stdout -%}
<div class="box-flex1 output_subarea output_stream output_stdout">