Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow documentation callbacks #386

Merged
merged 9 commits into from
Oct 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/generator/documentation.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@

function print_documentation(io::IO, node::ExprNode, indent, options, members::Bool=false; kwargs...)
print_documentation(io, node.cursor, indent, options, members; kwargs...)
end

const ESCAPE_PATTERN = r"""(\$|\\|"(?=""))"""

function print_documentation(io::IO, cursor::CLCursor, indent, options, members::Bool=false;
function print_documentation(io::IO, node::ExprNode, indent, options, members::Bool=false;
prologue::Vector{String}=String[], epilogue::Vector{String}=String[])

fold_single_line_comment = get(options, "fold_single_line_comment", false)
Expand All @@ -14,15 +9,19 @@ function print_documentation(io::IO, cursor::CLCursor, indent, options, members:
ids = get(options, "DAG_ids", Dict())

if extract_c_comment_style == "doxygen"
doc = format_doxygen(cursor, options, members)
doc = format_doxygen(node.cursor, options, members)
elseif extract_c_comment_style == "raw"
doc = format_raw(cursor, members)
doc = format_raw(node.cursor, members)
else
return
if (callback_documentation = get(options, "callback_documentation", nothing)) ≢ nothing
doc = callback_documentation(node)
t-bltg marked this conversation as resolved.
Show resolved Hide resolved
else
return
end
end

if show_c_function_prototype && cursor isa Clang.CLFunctionDecl
prototype = ["### Prototype", "```c", get_prototype(cursor), "```"]
t-bltg marked this conversation as resolved.
Show resolved Hide resolved
if show_c_function_prototype && node.cursor isa Clang.CLFunctionDecl
prototype = ["### Prototype", "```c", get_prototype(node), "```"]
else
prototype = String[]
end
Expand Down