https://bugs.kde.org/show_bug.cgi?id=460315

            Bug ID: 460315
           Summary: Sorting in output file
    Classification: Applications
           Product: KBibTeX
           Version: 0.10
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Loading/saving files
          Assignee: fisc...@unix-ag.uni-kl.de
          Reporter: nobodyinper...@posteo.de
  Target Milestone: ---

SUMMARY

It would be nice to have an option (or defaulting) to sorting the BibTeX output
file by identifier and the keys as well.

STEPS TO REPRODUCE
1. open an unsorted BibTeX file with KBibTeX
2. save it@comment{x-kbibtex-encoding=utf-8}

OBSERVED RESULT

BibTeX file maintains original unsorted state

EXPECTED RESULT

BibTeX file is sorted alphabetically by identifier and keys within an entry as
well

ADDITIONAL INFORMATION

Benefits from this:

- Easier diffing when tracking the BibTeX file
- Consistency when working with multiple people on a BibTeX file
- Takes the much of the arbitrariness away from the file formatting (same as
strict code formatters like Python's black e.g.)

I guess this is just a couple of lines of sorting in fileexporterbibtex.cpp but
I got really confused browsing through the code as I don't know any Qt... 😔

I don't know if people might get annoyed if KBibTeX sorts their files, maybe a
checkbox in the File Settings widget could help. We would need a way to persist
this setting though, maybe a preamble like `@comment{x-kbibtex-encoding=utf-8}`
for the file encoding could be used for that (e.g.
`@comment{x-kbibtex-sorting=ascending|descending}`).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to