Open abelew opened 5 years ago
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.
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:
returns:
I made some simple attempts to make the various types and arguments match, but without success thus far.