This (partially) resolves a long-standing problem with using the series as a part of the name of the E-book (as shown by dumb readers). There are two problems when one tries to implement this:
- The built-in function for number formatting is too brain-damaged — so one needs to write an “actual program”. (For example, as done in this thread.)
- The readers use the default Unicode sorting rules TR10 which are not designed to be compatible with numerical sorting (at least I could not find any trick to make sorting “compatible” with these rules¹⁾).
¹⁾ To check sorting rules, write test strings to a file, and use the command
Code:
env LANG=en_US.UTF-8 YOUR-FILE-NAME
Fortunately, before I understood the second problem, I made several experiments with an actual Kindle v5.10.1.3. It turns out that (contrary to
TR10) it has a very felicitous bug: it does not ignore “funny characters” before²⁾ a decimal dot!
²⁾ Unfortunately, the funny characters are ignored before a number. In particular, one does need leading 0s for the numerical-order-preserving sort.
—————————————————
To make the long story short, use the following chunk in a plugboard (I direct the result to the
author field):
Code:
program: re(re(finish_formatting(field('series_index'), '0>5s', '', ''), '^0+(?=\d\d($|\.))', ''), '\.', ".")
Warning: Do not try to retype this! There is (an
invisible) zero-width space before the period in the replacement string. For example, for my usage the whole plugboard rule looks like this:
Code:
program: strcat(field('author'),finish_formatting(field('series'), '', ' [', strcat(finish_formatting(re(re(finish_formatting(field('series_index'), '0>5s', '', ''), '^0+(?=\d\d($|\.))', ''), '\.', "."), '', '-', ''), ']')))'\.', ".")