ali-ramadhan / DocumenterCitations.jl

DocumenterCitations.jl uses Bibliography.jl to add support for BibTeX citations and references in documentation pages generated by Documenter.jl.
https://ali-ramadhan.github.io/DocumenterCitations.jl/dev
MIT License
65 stars 10 forks source link

Sorting of bibliography entries #28

Closed simonbyrne closed 3 years ago

simonbyrne commented 3 years ago

Can they be sorted by author-year?

c.f. https://github.com/CliMA/ClimateMachine.jl/pull/1687#issuecomment-720598681

ali-ramadhan commented 3 years ago

Don't think would would be super hard to implement. The bibliography is an ordered dict I think so we just have to iterate over the entries of the dict sorted by xnames or something:

https://github.com/ali-ramadhan/DocumenterCitations.jl/blob/4ccfced7749b7bc785dee018b0ffec7b1066f6f5/src/bibliography.jl#L42

fingolfin commented 3 years ago

This would be great to have. Currently, our bibliography looks like a random mess: https://oscar-system.github.io/Oscar.jl/dev/references/

Azzaare commented 3 years ago

New tag version on the way for Bibliography.jl that adds sorting option(s) thanks to @LazyScholar

I suppose long term would need a lot of different sorting options, but it is a great start that should help in making the output of DocumenterCitations.jl less messy

LazyScholar commented 3 years ago

Merged #39 which brings a documentation entry on how to use the sorting for now. Sorting is still rudimentary so have a look if it is good enough for now or if some adjustments are necessary (if so please direct issues at Bibliography.jl or BibInternal.jl as the sorting mechanics are handled there). https://github.com/Humans-of-Julia/Bibliography.jl/issues/17

LazyScholar commented 3 years ago

Sorry i was too fast... For some reason https://github.com/ali-ramadhan/DocumenterCitations.jl/blob/8606536a10cd2c6328fd91cf0d4de180dad3b3a8/src/DocumenterCitations.jl#L27 recreates the Dictionary/OrderedDict and the ordering is lost. I have to investigate how to insert it into the Documenter.Plugin structure without loosing the ordering.

LazyScholar commented 3 years ago

Tested it on my tiny project It should work now.