CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download
Project: test
Views: 91872
1
from __future__ import print_function
2
import io
3
import IPython.nbformat as nbformat
4
import sys
5
6
7
def remove_formatting(nb):
8
cells = nb['cells']
9
for i in range (len(cells)):
10
if 'source' in cells[i].keys():
11
if cells[i]['source'][0:16] == '#format the book':
12
del cells[i]
13
return
14
15
16
def remove_links(nb):
17
c = nb['cells']
18
for i in range (len(c)):
19
if 'source' in c[i].keys():
20
if c[i]['source'][0:19] == '[Table of Contents]':
21
del c[i]
22
return
23
24
25
def remove_links_add_appendix(nb):
26
c = nb['cells']
27
for i in range (len(c)):
28
if 'source' in c[i].keys():
29
if c[i]['source'][0:19] == '[Table of Contents]':
30
c[i]['source'] = '\\appendix'
31
return
32
33