-
-
Notifications
You must be signed in to change notification settings - Fork 94
/
config.jl
64 lines (56 loc) · 1.67 KB
/
config.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Default options
const defaultParams = Dict{Symbol,Any}(
:storeresults => false,
:chunk_defaults => Dict{Symbol,Any}(
:echo => true,
:results => "markup",
:hold => false,
:fig => true,
:include => true,
:eval => true,
:tangle => true,
:cache => false,
:fig_cap => nothing,
# Size in inches
:fig_width => 6,
:fig_height => 4,
:fig_path => DEFAULT_FIG_PATH,
:dpi => 96,
:term => false,
:display => false,
:prompt => "\njulia> ",
:label => nothing,
:wrap => true,
:line_width => 75,
:engine => "julia",
# :option_AbstractString=> "",
# Defined in formats
:fig_ext => nothing,
:fig_pos => nothing,
:fig_env => nothing,
:out_width => nothing,
:out_height => nothing,
:skip => false,
),
)
# This one can be changed at runtime, initially a copy of defaults
const rcParams = deepcopy(defaultParams)
"""
set_chunk_defaults!(opts::Dict{Symbol, Any})
Set default options for code chunks, use [`get_chunk_defaults`](@ref) to see the current values.
E.g.: set default `dpi` to `200` and `fig_width` to `8`
```julia
julia> set_chunk_defaults!(Dict(:dpi => 200, :fig_width => 8))
```
"""
set_chunk_defaults!(opts::Dict{Symbol,Any}) = merge!(rcParams[:chunk_defaults], opts)
"""
get_chunk_defaults()
Get default options used for code chunks.
"""
get_chunk_defaults() = rcParams[:chunk_defaults]
"""
restore_chunk_defaults!()
Restore Weave.jl default chunk options.
"""
restore_chunk_defaults!() = rcParams[:chunk_defaults] = defaultParams[:chunk_defaults]