Kalman-and-Bayesian-Filters.../pdf/formatting.py
Roger Labbe 0343c45445 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.
2015-03-07 22:41:39 -08:00

32 lines
808 B
Python

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