mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Changes to save_to_disk to use title_sort instead of recomputing it.
This commit is contained in:
parent
70636b42c4
commit
83cde4af65
@ -126,27 +126,31 @@ sort_columns_at_startup = None
|
|||||||
gui_pubdate_display_format = 'MMM yyyy'
|
gui_pubdate_display_format = 'MMM yyyy'
|
||||||
gui_timestamp_display_format = 'dd MMM yyyy'
|
gui_timestamp_display_format = 'dd MMM yyyy'
|
||||||
|
|
||||||
#: Control how title and series names are formatted when saving to disk/sending
|
#: Control sorting of titles and series in the library display
|
||||||
# to device. The behavior depends on the field being processed. If processing
|
# Control title and series sorting in the library view. If set to
|
||||||
# title, then if set to 'library_order', the title will be replaced with
|
# 'library_order', the title sort field will be used instead of the title.
|
||||||
# title_sort. If set to 'strictly_alphabetic', then the title is left unchanged.
|
# Unless you have manually edited the title sort field, leading articles such as
|
||||||
# If processing series, then if set to 'library_order', articles such as 'The'
|
# The and A will be ignored. If set to 'strictly_alphabetic', the titles will be
|
||||||
# and 'An' will be moved to the end. If set to 'strictly_alphabetic', the series
|
# sorted as-is (sort by title instead of title sort). For example, with
|
||||||
# will be sent without change. For example, with library_order, "The Lord of the
|
# library_order, The Client will sort under 'C'. With strictly_alphabetic, the
|
||||||
# Rings" will become "Lord of the Rings, The". With strictly_alphabetic, it
|
# book will sort under 'T'.
|
||||||
# would remain "The Lord of the Rings".
|
# This flag affects Calibre's library display. It has no effect on devices. In
|
||||||
|
# addition, titles for books added before changing the flag will retain their
|
||||||
|
# order until the title is edited. Double-clicking on a title and hitting return
|
||||||
|
# without changing anything is sufficient to change the sort.
|
||||||
title_series_sorting = 'library_order'
|
title_series_sorting = 'library_order'
|
||||||
|
|
||||||
#: Control formatting of title and series when used in templates
|
#: Control formatting of title and series when used in templates
|
||||||
# Control how title and series names are formatted when saving to disk/sending
|
# Control how title and series names are formatted when saving to disk/sending
|
||||||
# to device. The behavior depends on the field being processed. If processing
|
# to device. The behavior depends on the field being processed. If processing
|
||||||
# title, then if set to 'library_order', the title will be replaced with
|
# title, then if this tweak is set to 'library_order', the title will be
|
||||||
# title_sort. If set to 'strictly_alphabetic', then the title is left unchanged.
|
# replaced with title_sort. If it is set to 'strictly_alphabetic', then the
|
||||||
# If processing series, then if set to 'library_order', articles such as 'The'
|
# title will not be changed. If processing series, then if set to
|
||||||
# and 'An' will be moved to the end. If set to 'strictly_alphabetic', the series
|
# 'library_order', articles such as 'The' and 'An' will be moved to the end. If
|
||||||
# will be sent without change. For example, with library_order, "The Lord of the
|
# set to 'strictly_alphabetic', the series will be sent without change.
|
||||||
# Rings" will become "Lord of the Rings, The". With strictly_alphabetic, it
|
# For example, if the tweak is set to library_order, "The Lord of the Rings"
|
||||||
# would remain "The Lord of the Rings".
|
# will become "Lord of the Rings, The". If the tweak is set to
|
||||||
|
# strictly_alphabetic, it would remain "The Lord of the Rings".
|
||||||
save_template_title_series_sorting = 'library_order'
|
save_template_title_series_sorting = 'library_order'
|
||||||
|
|
||||||
#: Set the list of words considered to be "articles" for sort strings
|
#: Set the list of words considered to be "articles" for sort strings
|
||||||
|
@ -147,8 +147,14 @@ def get_components(template, mi, id, timefmt='%b %Y', length=250,
|
|||||||
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:
|
||||||
format_args['title'] = mi.title if tsorder == 'strictly_alphabetic' \
|
if tsorder == 'strictly_alphabetic':
|
||||||
else mi.get('title_sort', title_sort(mi.title, order='library_order'))
|
v = mi.title
|
||||||
|
else:
|
||||||
|
# title_sort might be missing or empty. Check both conditions
|
||||||
|
v = mi.get('title_sort', None)
|
||||||
|
if not v:
|
||||||
|
v = title_sort(mi.title, order=tsorder)
|
||||||
|
format_args['title'] = v
|
||||||
if mi.authors:
|
if mi.authors:
|
||||||
format_args['authors'] = mi.format_authors()
|
format_args['authors'] = mi.format_authors()
|
||||||
format_args['author'] = format_args['authors']
|
format_args['author'] = format_args['authors']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user