From 30300f295b25394bd4518d67789159ef01b5f100 Mon Sep 17 00:00:00 2001 From: jverzani Date: Fri, 27 Jun 2025 20:55:42 -0400 Subject: [PATCH] adjust plots --- adjust_plotly.jl | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 adjust_plotly.jl diff --git a/adjust_plotly.jl b/adjust_plotly.jl new file mode 100644 index 0000000..34a0d01 --- /dev/null +++ b/adjust_plotly.jl @@ -0,0 +1,43 @@ +# The issue with `PlotlyLight` appears to be that +# the `str` below is called *after* the inclusion of `require.min.js` +# (That str is included in the `.qmd` file to be included in the header +# but the order of inclusion appears not to be adjustable) +# This little script just adds a line *before* the require call +# which seems to make it all work. The line number 83 might change. + +#alternatives/plotly_plotting.html +function _add_plotly(f) + lineno = 117 + +str = """ + +""" + + r = readlines(f) + open(f, "w") do io + for (i,l) ∈ enumerate(r) + i == lineno && println(io, str) + println(io, l) + end + end +end + + + +function (@main)(args...) + for (root, dirs, files) in walkdir("_book") + for fᵢ ∈ files + f = joinpath(root, fᵢ) + if endswith(f, ".html") + _add_plotly(f) + end + end + end + + #f = "_book/integrals/center_of_mass.html" + #_add_plotly(f) + + return 1 +end + + ["ODEs", "alternatives", "derivatives", "differentiable_vector_calculus", "integral_vector_calculus", "integrals", "limits", "misc", "precalc", "site_libs"]