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:
31
pdf/formatting.py
Normal file
31
pdf/formatting.py
Normal 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
|
||||
Reference in New Issue
Block a user