Skip to content

Commit

Permalink
Merge pull request #159 from JuliaImGui/docstring-escape
Browse files Browse the repository at this point in the history
Escape null-terminators properly in docstrings
  • Loading branch information
JamesWrigley authored Dec 22, 2024
2 parents eccc819 + 403eb7b commit 3d6df46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions gen/generator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function create_docstring(func_name, overload)

comment = get(overload, :comment, "")
if !isempty(comment)
comment = replace(comment, "\\0" => "\\\\0")
formatted_comment = chopprefix(comment, "//") |> strip |> uppercasefirst
if !isempty(formatted_comment) && formatted_comment[end] ('.', '!', '?')
formatted_comment *= "."
Expand Down Expand Up @@ -561,10 +562,10 @@ function generate()
for w in wrappers
write(io,
"""
\"\"\"
$(w.docstring)
\"\"\"
""")
\"\"\"
$(w.docstring)
\"\"\"
""")
write(io, string(w.expr), "\n\n")
end

Expand Down
2 changes: 1 addition & 1 deletion src/wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ Combo(
"""
$(TYPEDSIGNATURES)
Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0".
Separate items with \\0 within a string, end item-list with \\0\\0. e.g. "One\\0Two\\0Three\\0".
[Upstream link](https://github.com/ocornut/imgui/blob/v1.91.6-docking/imgui.h#L585).
"""
Expand Down

0 comments on commit 3d6df46

Please sign in to comment.