Playing with html generation

I think I prefer just letting nbconvert generating static files,
but if I want to switch to using Bokeh or other javascript based
rendering I'll need the HTML conversion facility.
This commit is contained in:
Roger Labbe
2015-03-07 22:41:39 -08:00
parent c258dd12f6
commit 0343c45445
5 changed files with 246 additions and 27 deletions

31
pdf/formatting.py Normal file
View File

@@ -0,0 +1,31 @@
from __future__ import print_function
import io
import IPython.nbformat as nbformat
import sys
def remove_formatting(nb):
cells = nb['cells']
for i in range (len(cells)):
if 'source' in cells[i].keys():
if cells[i]['source'][0:16] == '#format the book':
del cells[i]
return
def remove_links(nb):
c = nb['cells']
for i in range (len(c)):
if 'source' in c[i].keys():
if c[i]['source'][0:19] == '[Table of Contents]':
del c[i]
return
def remove_links_add_appendix(nb):
c = nb['cells']
for i in range (len(c)):
if 'source' in c[i].keys():
if c[i]['source'][0:19] == '[Table of Contents]':
c[i]['source'] = '\\appendix'
return