Right now, there is no way to easily traverse the org-mode syntax tree. I recommend a function be implemented to query the child elements of an OrgComponent in a generic way, e.g.
children(o::OrgComponent) = OrgComponent[]
children(o::FootnoteReference) = begin
isnothing(o.definition) && return OrgComponent[]
o.definition
end
# ,,,
Such an interface would allow one to do a DFS of the syntax tree. If bringin in dependencies is acceptable, implementing the AbstractTrees.jl traits would be convenient.
Some type definitions may need to be adjusted, e.g. from
mutable struct CitationReference <: Object
prefix::Vector{Object}
key::AbstractString
suffix::Vector{Object}
end
to
mutable struct CitationReference <: Object
prefix::CitationReferencePrefix
key::AbstractString
suffix::CitationReferenceSuffix
end
struct CitationReferencePrefix <: Object
contents::Vector{Object}
end
struct CitationReferenceSuffix <: Object
contents::Vector{Object}
end
children(o::CitationReference) = [o.prefix, o.suffix]
children(o::CitrationReferencePrefix) = o.contents
children(o::CitrationReferencePrefix) = o.contents
Right now, there is no way to easily traverse the org-mode syntax tree. I recommend a function be implemented to query the child elements of an OrgComponent in a generic way, e.g.
Such an interface would allow one to do a DFS of the syntax tree. If bringin in dependencies is acceptable, implementing the AbstractTrees.jl traits would be convenient.
Some type definitions may need to be adjusted, e.g. from
to