invoking weave.jl from the shell
What would be required to successfully invoke weave.jl from the shell using julia 1.1.0?
I made some of the more obvious changes to get it to run, but am a bit lost in a series of type errors between ::AbstractString vs. ::String.
Thus:
~/.julia/packages/Weave/L0NNS/bin/weave.jl test.jmd
returns:
ERROR: LoadError: MethodError: no method matching weave(::String; doctype=:auto, informat=:auto, fig_ext=nothing, plotlib="Gadfly", out_path=:doc, fig_path="figures") Closest candidates are: weave(::AbstractString, !Matched::AbstractString) at src/Weave.jl:170 got unsupported keyword arguments "doctype", "informat", "fig_ext", "plotlib", "out_path", "fig_path" weave(::Any; doctype, informat, out_path, args, mod, fig_path, fig_ext, cache_path, cache, throw_errors, template, highlight_theme, css, pandoc_options, latex_cmd) at src/Weave.jl:100 got unsupported keyword argument "plotlib"
I made some simple attempts to make the various types and arguments match, but without success thus far.
Create the file ~/.local/bin/weavejl (or somewhere else in your $PATH) and paste in the following contents.
#!/bin/bash
# get file name and extension
filename=$1
file_ext=$(echo $filename |awk -F . '{if (NF>1) {print $NF}}')
# check valid file is passed
if [ -z "$filename" ]
then
echo -e "No Julia Markdown doc passed - exiting."
exit
elif [ "$file_ext" != "jmd" ]
then
echo -e "Weave.jl cannot process \"$file_ext\" docs."
echo -e "Pass a Julia Markdown doc (*.jmd)."
exit
fi
# weave julia markdown files
julia --project -O0 -e "
using Weave;
weave(normpath(@__DIR__, \"$filename\"))
"
Now you can call weavejl your_file.jmd if the file lives in a Julia project where Weave.jl has been added to the Project.toml. If not then replace julia --project -O0 -e " with julia -O0 -e " and make sure Weave.jl is added to your default environment.