Sorting of @index should ignore case
At least that's how an index normally works in a book, and it's also what I would expect.
I naively tried to achieve this with this patch, but it didn't work out; but I didn't dig deeper
diff --git a/src/Documents.jl b/src/Documents.jl
index 1e90d66c0..cc9d6957e 100644
--- a/src/Documents.jl
+++ b/src/Documents.jl
@@ -413,7 +413,7 @@ function populate!(index::IndexNode, document::Document)
(x = _compare(pagesmap, 3, a, b)) == 0 || return x < 0 # page
(x = _compare(modulesmap, 4, a, b)) == 0 || return x < 0 # module
(x = _compare(ordermap, 5, a, b)) == 0 || return x < 0 # category
- string(a[1].binding) < string(b[1].binding) # object name
+ lowercase(string(a[1].binding)) < lowercase(string(b[1].binding)) # object name
end
sort!(index.elements, lt = comparison)
return index
I believe we first sort according to category (type, module, function, const, etc.)? So I am not sure if what you're seeing is really due to case.
Ahhhh, thank you for clarifying! That's it then.
Personally, I find this very confusing and unexpected (and anecdotally, I am not alone, as my colleagues had the same confusion) -- I'd prefer if it either only sorted by name (like a regular index does).
But if people prefer the current way, perhaps "section headings" could be inserted to make this clearer (i.e.: show "Types" before the index of types, then "Modules" before the index of modules, etc. -- presumably the heading should only be shown for non-empty sections)
But if people prefer the current way, perhaps "section headings" could be inserted to make this clearer
This actually sounds like could be a good idea for long indices. Either way, controlling the sorting we could definitely have a few more options that could be passed to at-index to control the sorting.