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] = escape(val)
args[key+'_label'] = escape(display_name) args[key+'_label'] = escape(display_name)
except: except:
# if the val (custom column contents) is None, don't add to args
pass pass
if False: if False:

View File

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