Weave.jl/src/types.jl

89 lines
2.0 KiB
Julia
Raw Normal View History

2020-05-09 17:01:49 +02:00
# TODO: concreate typing
2017-12-31 13:02:28 +01:00
abstract type WeaveChunk end
2016-12-26 19:06:03 +01:00
2017-12-31 13:02:28 +01:00
mutable struct WeaveDoc
2016-04-11 17:40:18 +02:00
source::AbstractString
basename::AbstractString
path::AbstractString
2020-05-09 17:01:49 +02:00
chunks::Vector{WeaveChunk}
2016-04-11 17:40:18 +02:00
cwd::AbstractString
2020-05-08 16:39:17 +02:00
format::Any
2016-04-11 17:40:18 +02:00
doctype::AbstractString
header_script::String
header::Dict
2020-05-08 16:39:17 +02:00
template::Union{AbstractString,Mustache.MustacheTokens}
css::AbstractString
2020-03-26 09:35:05 +01:00
highlight_theme::Type{<:Highlights.AbstractTheme}
2016-12-23 07:34:54 +01:00
fig_path::AbstractString
chunk_defaults::Dict{Symbol,Any}
end
2017-12-31 13:02:28 +01:00
struct ChunkOutput
2016-04-11 17:40:18 +02:00
code::AbstractString
stdout::AbstractString
displayed::AbstractString
rich_output::AbstractString
2020-05-09 17:01:49 +02:00
figures::Vector{AbstractString}
end
2017-12-31 13:02:28 +01:00
mutable struct CodeChunk <: WeaveChunk
2016-04-11 17:40:18 +02:00
content::AbstractString
number::Int
result_no::Int
start_line::Int
optionstring::AbstractString
2020-05-08 16:39:17 +02:00
options::Dict{Symbol,Any}
2016-04-11 17:40:18 +02:00
output::AbstractString
rich_output::AbstractString
2020-05-09 17:01:49 +02:00
figures::Vector{AbstractString}
result::Vector{ChunkOutput}
function CodeChunk(content, number, start_line, optionstring, options)
2020-05-08 16:39:17 +02:00
new(
rstrip(content) * "\n",
number,
0,
start_line,
optionstring,
options,
"",
"",
AbstractString[],
ChunkOutput[],
)
end
end
abstract type Inline end
2017-12-31 13:02:28 +01:00
mutable struct DocChunk <: WeaveChunk
content::Vector{Inline}
number::Int
start_line::Int
2016-12-26 19:06:03 +01:00
end
2017-12-31 13:02:28 +01:00
mutable struct InlineText <: Inline
2016-12-26 19:06:03 +01:00
content::AbstractString
2016-12-27 20:43:13 +01:00
si::Int
ei::Int
number::Int
end
2017-12-31 13:02:28 +01:00
mutable struct InlineCode <: Inline
2016-12-26 19:06:03 +01:00
content::AbstractString
2016-12-27 20:43:13 +01:00
si::Int
ei::Int
number::Int
ctype::Symbol
2016-12-26 20:21:55 +01:00
output::AbstractString
rich_output::AbstractString
2020-05-09 17:01:49 +02:00
figures::Vector{AbstractString}
function InlineCode(content, si, ei, number, ctype)
new(content, si, ei, number, ctype, "", "", AbstractString[])
2016-12-26 20:21:55 +01:00
end
2016-12-26 19:06:03 +01:00
end
2020-03-18 02:50:01 +01:00
struct TermResult end
struct ScriptResult end
struct CollectResult end