patches added, more readme
This commit is contained in:
parent
3c7c3219eb
commit
06f45f613c
7
.gitignore
vendored
7
.gitignore
vendored
@ -17,5 +17,10 @@ site_libs/
|
||||
fonts/atkinson*
|
||||
fonts/quicksand*
|
||||
fonts/ubuntu*
|
||||
|
||||
*.old
|
||||
Untitled*.*
|
||||
index.ipynb
|
||||
index.md
|
||||
Julia*tex
|
||||
xelatex.py
|
||||
/.luarc.json
|
||||
|
21
Readme.md
21
Readme.md
@ -1,6 +1,19 @@
|
||||
<!--
|
||||
This 'Quarto Book'https://quarto.org/ about Julia Programming in German is online at https://www.math.uni-leipzig.de/~hellmund/juliabook/ https://www.math.uni-leipzig.de/~hellmund/juliabook/
|
||||
# Julia für Numerik
|
||||
|
||||
It uses the `julia-color` Quarto extension https://gitea.math.uni-leipzig.de/hellmund/julia-color
|
||||
Source code for the website and PDF ["Julia für Numerik"](https://www.math.uni-leipzig.de/~hellmund/juliabook/)
|
||||
|
||||
-->
|
||||
- It uses the [Quarto publishing system](https://quarto.org/).
|
||||
- It uses the Quarto extension [julia-color](https://gitea.math.uni-leipzig.de/hellmund/julia-color) to support
|
||||
the conversion of Jupyter code output cells with ANSI escape sequences to HTML and LaTEX/PDF
|
||||
|
||||
Since the `julia-color` extension needs a patched `Quarto` anyway, we use two more patches.
|
||||
|
||||
- `patch-quarto-julia` reduces the `startup.jl` used by quarto to a minimum.
|
||||
- `patch-quarto-stacktrace` adds the julia stacktrace to the output of code cells with julia errors. See e.g. the second code cell [here](https://www.math.uni-leipzig.de/~hellmund/juliabook/chapters/syntax.html#arithmetische-vergleiche)
|
||||
|
||||
```shell
|
||||
cd quarto-cli
|
||||
patch -p1 < patch-quarto-julia
|
||||
patch -p1 < patch-quarto-stacktrace
|
||||
```
|
||||
All content & code licenced under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).
|
||||
|
65
patch-quarto-julia
Normal file
65
patch-quarto-julia
Normal file
@ -0,0 +1,65 @@
|
||||
diff --git a/src/resources/jupyter/lang/julia/setup.jl b/src/resources/jupyter/lang/julia/setup.jl
|
||||
index 5d092330f..94687394f 100644
|
||||
--- a/src/resources/jupyter/lang/julia/setup.jl
|
||||
+++ b/src/resources/jupyter/lang/julia/setup.jl
|
||||
@@ -28,30 +28,6 @@ end
|
||||
fig_width = fig_width * fig_dpi
|
||||
fig_height = fig_height * fig_dpi
|
||||
|
||||
-# Intialize Plots w/ default fig width/height
|
||||
-try
|
||||
- import Plots
|
||||
-
|
||||
- # Plots.jl doesn't support PDF output for versions < 1.28.1
|
||||
- # so use png (if the DPI remains the default of 300 then set to 96)
|
||||
- if (Plots._current_plots_version < v"1.28.1") & (fig_format == :pdf)
|
||||
- Plots.gr(size=(fig_width, fig_height), fmt = :png, dpi = fig_dpi)
|
||||
- else
|
||||
- Plots.gr(size=(fig_width, fig_height), fmt = fig_format, dpi = fig_dpi)
|
||||
- end
|
||||
-catch e
|
||||
- # @warn "Plots init" exception=(e, catch_backtrace())
|
||||
-end
|
||||
-
|
||||
-# Initialize CairoMakie with default fig width/height
|
||||
-try
|
||||
- import CairoMakie
|
||||
-
|
||||
- CairoMakie.activate!(type = string(fig_format))
|
||||
- CairoMakie.update_theme!(resolution=(fig_width, fig_height))
|
||||
-catch e
|
||||
- # @warn "CairoMakie init" exception=(e, catch_backtrace())
|
||||
-end
|
||||
|
||||
# Set run_path if specified
|
||||
try
|
||||
@@ -71,29 +47,5 @@ function isinstalled(pkg::String)
|
||||
any(x -> x.name == pkg && x.is_direct_dep, values(Pkg.dependencies()))
|
||||
end
|
||||
|
||||
-# ojs_define
|
||||
-if isinstalled("JSON") && isinstalled("DataFrames")
|
||||
- import JSON, DataFrames
|
||||
- global function ojs_define(; kwargs...)
|
||||
- convert(x) = x
|
||||
- convert(x::DataFrames.AbstractDataFrame) = Tables.rows(x)
|
||||
- content = Dict("contents" => [Dict("name" => k, "value" => convert(v)) for (k, v) in kwargs])
|
||||
- tag = "<script type='ojs-define'>$(JSON.json(content))</script>"
|
||||
- IJulia.display(MIME("text/html"), tag)
|
||||
- end
|
||||
-elseif isinstalled("JSON")
|
||||
- import JSON
|
||||
- global function ojs_define(; kwargs...)
|
||||
- content = Dict("contents" => [Dict("name" => k, "value" => v) for (k, v) in kwargs])
|
||||
- tag = "<script type='ojs-define'>$(JSON.json(content))</script>"
|
||||
- IJulia.display(MIME("text/html"), tag)
|
||||
- end
|
||||
-else
|
||||
- global function ojs_define(; kwargs...)
|
||||
- @warn "JSON package not available. Please install the JSON.jl package to use ojs_define."
|
||||
- end
|
||||
-end
|
||||
-
|
||||
-
|
||||
# don't return kernel dependencies (b/c Revise should take care of dependencies)
|
||||
nothing
|
14
patch-quarto-stacktrace
Normal file
14
patch-quarto-stacktrace
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/src/core/jupyter/jupyter.ts b/src/core/jupyter/jupyter.ts
|
||||
index 4a1d04963..2fbda1d12 100644
|
||||
--- a/src/core/jupyter/jupyter.ts
|
||||
+++ b/src/core/jupyter/jupyter.ts
|
||||
@@ -1575,7 +1575,7 @@ function mdOutputStream(output: JupyterOutputStream) {
|
||||
}
|
||||
|
||||
function mdOutputError(output: JupyterOutputError) {
|
||||
- return mdCodeOutput([output.ename + ": " + output.evalue]);
|
||||
+ return mdCodeOutput([output.ename + ": " + output.traceback.join('\n')]);
|
||||
}
|
||||
|
||||
async function mdOutputDisplayData(
|
||||
|
Loading…
Reference in New Issue
Block a user