Ordering non-standard call numbers
I have been approached by a colleague about the ordering of the call numbers which seems to have changed recently. They use non-standard call numbers in the form
M 1
M 2
M 10 a
M 11
M 100 b
But currently the ordering in Zotero is not respecting the increasing numbers in the middle. It is output in the wrong (alphabethical) order like: M 1, M 10 a, M 100 b, M 11, M 2.
This is not any standard call number like LC or Dewey, but some house-made schema for the call numbers.
Could this probably fixed by just expanding the last else case code in the
with something like
?
Note: My tests with Int.Collator (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator) showed that this could work, but I haven't tested (and can't) that this code within Zotero would work and lead to the desired output. Any alternative approach for this is also appreciated.
M 1
M 2
M 10 a
M 11
M 100 b
But currently the ordering in Zotero is not respecting the increasing numbers in the middle. It is output in the wrong (alphabethical) order like: M 1, M 10 a, M 100 b, M 11, M 2.
This is not any standard call number like LC or Dewey, but some house-made schema for the call numbers.
Could this probably fixed by just expanding the last else case code in the
compareCallNumbers
function? I mean in line 1070 (https://github.com/zotero/utilities/blob/master/utilities_item.js#L1070) replacereturn (fieldA > fieldB) ? 1 : (fieldA < fieldB) ? -1 : 0;
with something like
return Zotero.localeCompare(fieldA, fieldB);
?
Note: My tests with Int.Collator (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator) showed that this could work, but I haven't tested (and can't) that this code within Zotero would work and lead to the desired output. Any alternative approach for this is also appreciated.
The new sorting works.
But only as long as there are no spaces in the sorting.
So
M11, M12, M110 .....
M 11, M 110, M 12 ....
Is there a way to ignore spaces or handle them differently?