Skip to content
Merged
Changes from all commits
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
24 changes: 17 additions & 7 deletions doc/src/manual/unicode-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ function fix_combining_chars(char)
return cat == 6 || cat == 8 ? "$NBSP$char$NBSP" : "$char"
end


function table_entries(completions, unicode_dict)
entries = [[
"Code point(s)", "Character(s)",
"Tab completion sequence(s)", "Unicode name(s)"
entries = Any[Any[
["Code point(s)"],
["Character(s)"],
["Tab completion sequence(s)"],
["Unicode name(s)"],
]]
for (chars, inputs) in sort!(collect(completions), by = first)
code_points, unicode_names, characters = String[], String[], String[]
Expand All @@ -65,12 +66,21 @@ function table_entries(completions, unicode_dict)
push!(unicode_names, get(unicode_dict, UInt32(char), "(No Unicode name)"))
push!(characters, isempty(characters) ? fix_combining_chars(char) : "$char")
end
inputs_md = []
for (i, input) in enumerate(inputs)
i > 1 && push!(inputs_md, ", ")
push!(inputs_md, Markdown.Code("", input))
end
push!(entries, [
join(code_points, " + "), join(characters),
join(inputs, ", "), join(unicode_names, " + ")
[join(code_points, " + ")],
[join(characters)],
inputs_md,
[join(unicode_names, " + ")],
])
end
return Markdown.Table(entries, [:l, :l, :l, :l])
table = Markdown.Table(entries, [:l, :c, :l, :l])
# We also need to wrap the Table in a Markdown.MD "document"
return Markdown.MD([table])
end

table_entries(
Expand Down