Make out_path and template path relative to document

pull/202/head
Matti Pastell 2019-03-10 22:53:00 +02:00
parent 6f83f1abf5
commit 4338fc4b07
2 changed files with 7 additions and 5 deletions

View File

@ -95,8 +95,8 @@ or
```
syntax. Using the `j code` syntax you can insert code anywhere in a line and with
the `! syntax` the whole line after `!` will be executed. The code will be replaced
with the output of running the code.
the `!` syntax the whole line after `!` will be executed. The code will be replaced
with captured output in the weaved document.
If the code produces figures the filename or base64 encoded string will be
added to output e.g. to include a Plots figure in markdown you can use:
@ -105,7 +105,7 @@ added to output e.g. to include a Plots figure in markdown you can use:
![A plot](`j plot(1:10)`)
```
or to produce html output:
or to produce any html output:
```
! display("text/html", "Header from julia");

View File

@ -1,5 +1,3 @@
#Default options
const defaultParams =
Dict{Symbol,Any}(:storeresults => false,
@ -105,6 +103,7 @@ function header_args(doc::WeaveDoc)
informat = getvalue(args, "informat", :auto)
out_path = getvalue(args, "out_path", :doc)
out_path == ":pwd" && (out_path = :pwd)
isa(out_path, Symbol) || (out_path = joinpath(dirname(doc.source), out_path))
mod = Symbol(getvalue(args, "mod", :sandbox))
fig_path = getvalue(args, "fig_path", "figures")
fig_ext = getvalue(args, "fig_ext", nothing)
@ -112,6 +111,9 @@ function header_args(doc::WeaveDoc)
cache = Symbol(getvalue(args, "cache", :off))
throw_errors = getvalue(args, "throw_errors", false)
template = getvalue(args, "template", nothing)
if template != nothing && !isempty(template)
template = joinpath(dirname(doc.source), template)
end
highlight_theme = getvalue(args, "highlight_theme", nothing)
css = getvalue(args, "css", nothing)
pandoc_options = getvalue(args, "pandoc_options", String[])