Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 2.23 KB

README.md

File metadata and controls

42 lines (32 loc) · 2.23 KB

ipynb2LiterateJulia

NBConverter stuff to convert Jupyter Notebooks in to Literate.jl files (This is the opposite of Literate.jl)

Demo

  1. We start with this notebook: ODEIntroduction.ipynb
  2. we run bash literate_run_nbconvert.sh demo/ODEIntroduction.ipynb to generate this Literate julia file: ODEIntroduction.jl
  3. we run the Literate.jl script to generate the markdown, notebook and script files in literate_output/:
julia> Literate.markdown("demo/ODEIntroduction.jl", "demo/literate_output/")
[ Info: generating markdown page from `~/.julia/environments/WeaveAwayNotebooks/demo/ODEIntroduction.jl`
[ Info: not running on Travis, skipping links will not be correct.
[ Info: writing result to `~/.julia/environments/WeaveAwayNotebooks/demo/literate_output/ODEIntroduction.md`
"/home/wheel/oxinabox/.julia/environments/WeaveAwayNotebooks/demo/literate_output/ODEIntroduction.md"

julia> Literate.notebook("demo/ODEIntroduction.jl", "demo/literate_output/"; execute=false) # executing require packages to be installed
[ Info: generating notebook from `~/.julia/environments/WeaveAwayNotebooks/demo/ODEIntroduction.jl`
[ Info: not running on Travis, skipping links will not be correct.
[ Info: writing result to `~/.julia/environments/WeaveAwayNotebooks/demo/literate_output/ODEIntroduction.ipynb`
"/home/wheel/oxinabox/.julia/environments/WeaveAwayNotebooks/demo/literate_output/ODEIntroduction.ipynb"

julia> Literate.script("demo/ODEIntroduction.jl", "demo/literate_output/"; execute=false)
[ Info: generating plain script file from `~/.julia/environments/WeaveAwayNotebooks/demo/ODEIntroduction.jl`
[ Info: not running on Travis, skipping links will not be correct.
[ Info: writing result to `~/.julia/environments/WeaveAwayNotebooks/demo/literate_output/ODEIntroduction.jl`
"/home/wheel/oxinabox/.julia/environments/WeaveAwayNotebooks/demo/literate_output/ODEIntroduction.jl"

julia script

We also provide a short and simple Julia script for running the process. It is in the file [literate_run_nbconvert.jl]. Step 2 above can be replaced with:

julia> include("literate_run_nbconvert.jl")
literate_run_nbconvert

julia> literate_run_nbconvert("demo/")