Fine-tuned prefix layout for MOBI

This commit is contained in:
GRiker 2012-08-09 07:40:44 -06:00
parent 2ac38d5eec
commit adf0eb8e7d
2 changed files with 15 additions and 9 deletions

View File

@ -194,6 +194,7 @@ def render_jacket(mi, output_profile,
args[key] = escape(val)
args[key+'_label'] = escape(display_name)
except:
# if the val (custom column contents) is None, don't add to args
pass
if False:

View File

@ -3252,17 +3252,22 @@ Author '{0}':
def formatPrefix(self,prefix_char,soup):
# Generate the HTML for the prefix portion of the listing
spanTag = Tag(soup, "span")
if prefix_char is None:
spanTag['style'] = "color:white"
spanTag.insert(0,NavigableString(self.defaultPrefix))
# 2e3a is 'two-em dash', which matches width in Kindle Previewer
# too wide in calibre viewer
# minimal visual distraction
# spanTag.insert(0,NavigableString(u'\u2e3a'))
# Kindle Previewer doesn't properly handle style=color:white
# MOBI does a better job allocating blank space with <code>
if self.opts.fmt == 'mobi':
codeTag = Tag(soup, "code")
if prefix_char is None:
codeTag.insert(0,NavigableString('&nbsp;'))
else:
codeTag.insert(0,NavigableString(prefix_char))
return codeTag
else:
spanTag = Tag(soup, "span")
if prefix_char is None:
spanTag['style'] = "color:white"
prefix_char = self.defaultPrefix
spanTag.insert(0,NavigableString(prefix_char))
return spanTag
return spanTag
def generateAuthorAnchor(self, author):
# Strip white space to ''