Skip to content

Commit

Permalink
DOC/BLD: Update to use IPython 1.0. Closes #1006.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseabold committed Aug 14, 2013
1 parent 7ae4873 commit 7b4c4da
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions tools/nbgenerate.py
Expand Up @@ -31,20 +31,11 @@

from IPython.config import Config
try:
from nbconvert.converters.template import ConverterTemplate
from nbconvert.converters.rst import ConverterRST
from IPython.nbconvert.exporters import HTMLExporter
except ImportError:
if os.path.exists("/home/skipper/src/nbconvert"):
if not os.path.exists(os.path.join(cur_dir, "nbconvert")):
os.symlink("/home/skipper/src/nbconvert",
os.path.join(cur_dir, "nbconvert"))
from nbconvert.converters.template import ConverterTemplate
from nbconvert.converters.rst import ConverterRST
else:
from warnings import warn
warn("Notebook examples not built. Add nbconvert to path or update "
"paths in tools/nbgenerate.py")
sys.exit(0)
from warnings import warn
warn("Notebook examples not built. You need IPython 1.0.")
sys.exit(0)

import hash_funcs

Expand Down Expand Up @@ -212,17 +203,18 @@ def nb2html(nb):
Cribbed from nbviewer
"""
config = Config()
config.ConverterTemplate.template_file = 'basichtml'
config.HTMLExporter.template_file = 'basic'
config.NbconvertApp.fileext = "html"
config.CSSHtmlHeaderTransformer.enabled = False

C = ConverterTemplate(config=config)
return C.convert(nb)[0]
C = HTMLExporter(config=config)
return C.from_notebook_node(nb)[0]

def nb2rst(nb, files_dir):
"""
nb should be a NotebookNode
"""
#NOTE: This does not currently work. Needs to be update to IPython 1.0.
config = Config()
C = ConverterRST(config=config)
# bastardize how this is supposed to be called
Expand Down

0 comments on commit 7b4c4da

Please sign in to comment.