<commit_before># TODO: concreate typing

abstract type WeaveChunk end
abstract type Inline end

mutable struct WeaveDoc
    source::AbstractString
    basename::AbstractString
    path::AbstractString
    chunks::Vector{WeaveChunk}
    cwd::AbstractString
    format::Any
    doctype::String
    header_script::String
    header::Dict
    chunk_defaults::Dict{Symbol,Any}
end

struct ChunkOutput
    code::AbstractString
    stdout::AbstractString
    displayed::AbstractString
    rich_output::AbstractString
    figures::Vector{AbstractString}
end

mutable struct CodeChunk <: WeaveChunk
    content::AbstractString
    number::Int
    result_no::Int
    start_line::Int
    optionstring::AbstractString
    options::Dict{Symbol,Any}
    output::AbstractString
    rich_output::AbstractString
    figures::Vector{AbstractString}
    result::Vector{ChunkOutput}
    function CodeChunk(content, number, start_line, optionstring, options)
        new(
            string(rstrip(content), '\n'), # normalize end of chunk
            number,
            0,
            start_line,
            optionstring,
            options,
            "",
            "",
            AbstractString[],
            ChunkOutput[],
        )
    end
end

mutable struct DocChunk <: WeaveChunk
    content::Vector{Inline}
    number::Int
    start_line::Int
end

struct InlineText <: Inline
    content::String
    number::Int
end

mutable struct InlineCode <: Inline
    content::String
    number::Int
    ctype::Symbol
    output::String
    rich_output::String
    figures::Vector{String}
end
InlineCode(content, number, ctype) = InlineCode(content, number, ctype, "", "", String[])

struct TermResult end
struct ScriptResult end
struct CollectResult end<commit_msg>improve type definition of CodeChunk<commit_after># TODO: concreate typing

abstract type WeaveChunk end
abstract type Inline end

mutable struct WeaveDoc
    source::AbstractString
    basename::AbstractString
    path::AbstractString
    chunks::Vector{WeaveChunk}
    cwd::AbstractString
    format::Any
    doctype::String
    header_script::String
    header::Dict
    chunk_defaults::Dict{Symbol,Any}
end

struct ChunkOutput
    code::AbstractString
    stdout::AbstractString
    displayed::AbstractString
    rich_output::AbstractString
    figures::Vector{AbstractString}
end

mutable struct CodeChunk <: WeaveChunk
    content::String
    number::Int
    result_no::Int
    start_line::Int
    optionstring::String
    options::Dict{Symbol,Any}
    output::AbstractString
    rich_output::AbstractString
    figures::Vector{String}
    result::Vector{ChunkOutput}
end

function CodeChunk(content, number, start_line, optionstring, options)
    return CodeChunk(
        string(rstrip(content), '\n'), # normalize end of chunk)
        number,
        0,
        start_line,
        optionstring,
        options,
        "",
        "",
        AbstractStringString[],
        ChunkOutput[]
    )
end

mutable struct DocChunk <: WeaveChunk
    content::Vector{Inline}
    number::Int
    start_line::Int
end

struct InlineText <: Inline
    content::String
    number::Int
end

mutable struct InlineCode <: Inline
    content::String
    number::Int
    ctype::Symbol
    output::String
    rich_output::String
    figures::Vector{String}
end
InlineCode(content, number, ctype) = InlineCode(content, number, ctype, "", "", String[])

struct TermResult end
struct ScriptResult end
struct CollectResult end
{'fraction_non_alphanumeric': 0.09004329004329005, 'fraction_numerical': 0.0005772005772005772, 'mean_word_length': 3.4040660736975856, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7167749', 'n_tokens_mistral': 956, 'n_tokens_neox': 966, 'n_words': 226}