mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Make the author_sort display tweak work in the content server
This commit is contained in:
parent
65e1c1cd98
commit
c68a36d3c1
@ -43,17 +43,17 @@ author_sort_copy_method = 'invert'
|
||||
|
||||
# Set which author field to display in the tags pane (the list of authors,
|
||||
# series, publishers etc on the left hand side). The choices are author and
|
||||
# author_sort. This tweak affects only the tags pane, and only what is displayed
|
||||
# under the authors category. Please note that if you set this to author_sort,
|
||||
# it is very possible to see duplicate names in the list becasue although it is
|
||||
# guaranteed that author names are unique, there is no such guarantee for
|
||||
# author_sort values. Showing duplicates won't break anything, but it could
|
||||
# lead to some confusion. When using 'author_sort', the tooltip will show the
|
||||
# author's name.
|
||||
# author_sort. This tweak affects only what is displayed under the authors
|
||||
# category in the tags pane and content server. Please note that if you set this
|
||||
# to author_sort, it is very possible to see duplicate names in the list because
|
||||
# although it is guaranteed that author names are unique, there is no such
|
||||
# guarantee for author_sort values. Showing duplicates won't break anything, but
|
||||
# it could lead to some confusion. When using 'author_sort', the tooltip will
|
||||
# show the author's name.
|
||||
# Examples:
|
||||
# tags_pane_use_field_for_author_name = 'author'
|
||||
# tags_pane_use_field_for_author_name = 'author_sort'
|
||||
tags_pane_use_field_for_author_name = 'author'
|
||||
# categories_use_field_for_author_name = 'author'
|
||||
# categories_use_field_for_author_name = 'author_sort'
|
||||
categories_use_field_for_author_name = 'author'
|
||||
|
||||
|
||||
# Set whether boolean custom columns are two- or three-valued.
|
||||
|
@ -412,7 +412,7 @@ class TagTreeItem(object): # {{{
|
||||
def tag_data(self, role):
|
||||
tag = self.tag
|
||||
if tag.category == 'authors' and \
|
||||
tweaks['tags_pane_use_field_for_author_name'] == 'author_sort':
|
||||
tweaks['categories_use_field_for_author_name'] == 'author_sort':
|
||||
name = tag.sort
|
||||
tt_author = True
|
||||
else:
|
||||
|
@ -15,7 +15,7 @@ from calibre import isbytestring, force_unicode, fit_image, \
|
||||
prepare_string_for_xml as xml
|
||||
from calibre.utils.ordered_dict import OrderedDict
|
||||
from calibre.utils.filenames import ascii_filename
|
||||
from calibre.utils.config import prefs
|
||||
from calibre.utils.config import prefs, tweaks
|
||||
from calibre.utils.icu import sort_key
|
||||
from calibre.utils.magick import Image
|
||||
from calibre.library.comments import comments_to_html
|
||||
@ -151,7 +151,11 @@ def get_category_items(category, items, restriction, datatype, prefix): # {{{
|
||||
'<div>{1}</div>'
|
||||
'<div>{2}</div></div>')
|
||||
rating, rstring = render_rating(i.avg_rating, prefix)
|
||||
name = xml(i.name)
|
||||
if i.category == 'authors' and \
|
||||
tweaks['categories_use_field_for_author_name'] == 'author_sort':
|
||||
name = xml(i.sort)
|
||||
else:
|
||||
name = xml(i.name)
|
||||
if datatype == 'rating':
|
||||
name = xml(_('%d stars')%int(i.avg_rating))
|
||||
id_ = i.id
|
||||
|
@ -22,6 +22,7 @@ from calibre.library.server.utils import format_tag_string, Offsets
|
||||
from calibre import guess_type, prepare_string_for_xml as xml
|
||||
from calibre.utils.icu import sort_key
|
||||
from calibre.utils.ordered_dict import OrderedDict
|
||||
from calibre.utils.config import tweaks
|
||||
|
||||
BASE_HREFS = {
|
||||
0 : '/stanza',
|
||||
@ -113,8 +114,13 @@ def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
|
||||
count = (_('%d books') if item.count > 1 else _('%d book'))%item.count
|
||||
if ignore_count:
|
||||
count = ''
|
||||
if item.category == 'authors' and \
|
||||
tweaks['categories_use_field_for_author_name'] == 'author_sort':
|
||||
name = xml(item.sort)
|
||||
else:
|
||||
name = xml(item.name)
|
||||
return E.entry(
|
||||
TITLE(item.name + ('' if not add_kind else ' (%s)'%item_kind)),
|
||||
TITLE(name + ('' if not add_kind else ' (%s)'%item_kind)),
|
||||
ID(id_),
|
||||
UPDATED(updated),
|
||||
E.content(count, type='text'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user