File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1
1
ARG BASE_CONTAINER=tlinnet/csharp-notebook
2
2
FROM $BASE_CONTAINER
3
3
4
+ USER root
5
+
6
+ ADD "README.md" $HOME
4
7
ADD "Example_Jupyter_Notebook_with_C#.ipynb" $HOME
5
8
ADD Exam_Ref_70-483_Programming_in_C#_2nd_Edition $HOME/Exam_Ref_70-483_Programming_in_C#_2nd_Edition
9
+
10
+ ADD "dev/convert_md_to_ipynb.py" $HOME/dev/convert_md_to_ipynb.py
11
+ RUN echo "Change mod and convert" && \
12
+ cd $HOME && \
13
+ echo $PWD && \
14
+ fix-permissions README.md && \
15
+ fix-permissions Exam_Ref_70-483_Programming_in_C#_2nd_Edition && \
16
+ cd $HOME/dev && \
17
+ python convert_md_to_ipynb.py && \
18
+ cd $HOME && \
19
+ rm -rf dev && \
20
+ find . -type f -name "*.md" -exec rm -f {} \;
21
+
22
+ USER $NB_USER
Original file line number Diff line number Diff line change
1
+ import glob
2
+ import os
3
+ import nbformat as nbf
4
+
5
+ files1 = glob .glob ('../*.md' , recursive = True )
6
+ files2 = glob .glob ('../*/*.md' , recursive = True )
7
+
8
+ files = files1 + files2
9
+
10
+ for f in files :
11
+ fname = f [:- 3 ]
12
+
13
+ nb = nbf .v4 .new_notebook ()
14
+ s = open (f , "r" ).read ()
15
+ s = s .replace (".md" , ".ipynb" )
16
+ nb ['cells' ].append (nbf .v4 .new_markdown_cell (s ))
17
+ nbf .write (nb , fname + ".ipynb" )
You can’t perform that action at this time.
0 commit comments