Quote:
Originally Posted by marie44
Series & index information are all correct - that was the first thing I checked back when my first adjustments didn't work.
When I sort by the new column, #sony_sort, everything appears how it should appear - i.e. how I want it to appear on the 650. (With one exception of the prequel marked 0.50 - it shows up last rather than first, and yes, it does sort correctly when I sort by Calibre's default series column - but that's not directly related to the problem at hand). Stated another way - the #sony_sort order and how series display on the 650 do not match for the series I'm having problems with.
|
The first (unrelated) problem is my fault.

I gave you the wrong template string for #sony_sort. It should be
Code:
{series}{series_index:0>2s| | - }{title}
Note the new zero in front of the > character and the space between the two vertical bars. As it was, series with indices more than 10 would not sort correctly. This change will fix some of the problems, but ...
Your unrelated example points out a much more serious issue, one that I am surprised hasn't come up before as the problem has been there for months (at least). The problem: series_index formatting does not work correctly for series numbers that contain decimal points. For example, using {series_index:0>2s}, we get values:
Code:
Series Index Formatted value
1 01
1.1 1.10
2 02
10 10
With these formatted values, 1.1 will sort after 2 but before 10. The results get worse in some cases. There is no fix for this problem in the current release of calibre other than possibly some very complicated regexp that would reformat the answer.
What we need to do is to produce a formatted value for a series index that takes into account that it is really a number, so that 1 < 1.1 < 2. I am changing the template processing to accomplish this.
Once the changes are available (should be next release), then the template would use {series_index:0>5.2f} (note the 'f' instead of 's' at the end). With this template we will get the values:
Code:
Series Index Formatted value
1 01.00
1.1 01.10
2 02.00
10 10.00
These will sort correctly because the decimal point is aligned at the third character.
For those of you who are technically minded, the template processor now accepts any formatting string that python's format function accepts. If the type specifier wants an integer or floating point number, calibre attempts to convert the input string (from any field) to the correct type, tossing an exception if the conversion fails. If conversion succeeds, then calibre applies the format and returns the string result.