Skip to content

Commit f3c7bf5

Browse files
committed
svg fixes
1 parent d4b4759 commit f3c7bf5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/Example.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ jobs:
4141
run: pip install jupyter nbconvert
4242

4343
- name: "Execute notebook"
44+
env:
45+
FILE: examples/jupyter-src/${{ matrix.file-name }}.ipynb
46+
run: jupyter nbconvert --ExecutePreprocessor.kernel_name="julia-${{ matrix.julia-version }}" --to notebook --inplace --execute ${{ env.FILE }}
47+
48+
- name: "Fix SVGs" # on notebook (json) level: removes all cells, that have the tag "text/html" AND have "<?xml " within their content
49+
run: julia -e 'using Pkg; Pkg.add("JSON"); using JSON; data = JSON.parsefile(joinpath("examples", "jupyter-src", "${{ matrix.file-name }}.ipynb"); use_mmap=false); function search_and_remove!(json, tag, content=""); if typeof(json) == Vector{Any}; for e in json; search_and_remove!(e, tag, content); end; elseif typeof(json) == Dict{String, Any}; for (t, c) in json; if contains(t, tag) && (content == "" || any([contains(line, content) for line in c])); pop!(json, t); else; search_and_remove!(c, tag, content); end; end; end; end; search_and_remove!(data, "text/html", "<?xml "); open(joinpath("examples", "jupyter-src", "tmp_${{ matrix.file-name }}.ipynb"),"w") do f; JSON.print(f, data, 1); end; mv(joinpath("examples", "jupyter-src", "tmp_${{ matrix.file-name }}.ipynb"), joinpath("examples", "jupyter-src", "${{ matrix.file-name }}.ipynb"); force=true);'
50+
51+
- name: "Export notebook to jl and md"
4452
env:
4553
FILE: examples/jupyter-src/${{ matrix.file-name }}.ipynb
4654
run: |
47-
jupyter nbconvert --ExecutePreprocessor.kernel_name="julia-${{ matrix.julia-version }}" --to notebook --inplace --execute ${{ env.FILE }}
4855
jupyter nbconvert --to script ${{ env.FILE }}
4956
jupyter nbconvert --to markdown ${{ env.FILE }}
5057

0 commit comments

Comments
 (0)