Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 05-18-2023, 12:59 AM   #1
ilyaz
Junior Member
ilyaz began at the beginning.
 
Posts: 1
Karma: 10
Join Date: May 2023
Device: none
Plugboard for series numbering (decimals & no decimals): exploit the Kindle’s bug

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($|\.))', ''), '\.', "​."), '', '-', ''), ']')))'\.', "​.")
ilyaz is offline   Reply With Quote
Reply

Tags
decimals, plugboard, regexp, series_index, unicode


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Font with decimals in the interface dunhill Calibre 2 01-26-2023 04:37 PM
How to set the number of decimals in a custom column sekhemty Library Management 3 04-28-2017 09:06 AM
Plugboard for series numbering (decimals & no decimals) lina.w Library Management 30 01-29-2016 03:56 AM
How to have 3 decimals Arrow Library Management 3 12-16-2014 07:42 AM
Kindle Annotations vs Plugboard rename Title with series initials/numbering Gwen Morse Devices 2 09-05-2011 12:58 PM


All times are GMT -4. The time now is 05:38 PM.


MobileRead.com is a privately owned, operated and funded community.