mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix title sort problem correctly this time.
This commit is contained in:
parent
3d3bc6e8d7
commit
fd300956f4
@ -55,9 +55,9 @@ except:
|
|||||||
|
|
||||||
_ignore_starts = u'\'"'+u''.join(unichr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033])
|
_ignore_starts = u'\'"'+u''.join(unichr(x) for x in range(0x2018, 0x201e)+[0x2032, 0x2033])
|
||||||
|
|
||||||
def title_sort(title):
|
def title_sort(title, order='library_order'):
|
||||||
title = title.strip()
|
title = title.strip()
|
||||||
if tweaks['title_series_sorting'] == 'strictly_alphabetic':
|
if order == 'strictly_alphabetic':
|
||||||
return title
|
return title
|
||||||
if title and title[0] in _ignore_starts:
|
if title and title[0] in _ignore_starts:
|
||||||
title = title[1:]
|
title = title[1:]
|
||||||
|
@ -7,6 +7,7 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import os, traceback, cStringIO, re, shutil
|
import os, traceback, cStringIO, re, shutil
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
from calibre.constants import DEBUG
|
from calibre.constants import DEBUG
|
||||||
from calibre.utils.config import Config, StringConfig, tweaks
|
from calibre.utils.config import Config, StringConfig, tweaks
|
||||||
@ -139,8 +140,7 @@ class SafeFormat(TemplateFormatter):
|
|||||||
def get_components(template, mi, id, timefmt='%b %Y', length=250,
|
def get_components(template, mi, id, timefmt='%b %Y', length=250,
|
||||||
sanitize_func=ascii_filename, replace_whitespace=False,
|
sanitize_func=ascii_filename, replace_whitespace=False,
|
||||||
to_lowercase=False):
|
to_lowercase=False):
|
||||||
library_order = tweaks['save_template_title_series_sorting'] == 'library_order'
|
tsfmt = partial(title_sort, order=tweaks['save_template_title_series_sorting'])
|
||||||
tsfmt = title_sort if library_order else lambda x: x
|
|
||||||
format_args = FORMAT_ARGS.copy()
|
format_args = FORMAT_ARGS.copy()
|
||||||
format_args.update(mi.all_non_none_fields())
|
format_args.update(mi.all_non_none_fields())
|
||||||
if mi.title:
|
if mi.title:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user