Fix various typos

This commit is contained in:
Kovid Goyal 2009-07-06 12:49:45 -06:00
parent 3bd2627645
commit 4f1c599581
3 changed files with 9 additions and 6 deletions

View File

@ -40,7 +40,7 @@ class MOBIOutput(OutputFormatPlugin):
def check_for_periodical(self): def check_for_periodical(self):
if self.oeb.metadata.publication_type and \ if self.oeb.metadata.publication_type and \
self.oeb.metadata.publication_type[0].startswith('periodical:'): unicode(self.oeb.metadata.publication_type[0]).startswith('periodical:'):
self.periodicalize_toc() self.periodicalize_toc()
self.check_for_masthead() self.check_for_masthead()
self.opts.mobi_periodical = True self.opts.mobi_periodical = True
@ -54,7 +54,7 @@ class MOBIOutput(OutputFormatPlugin):
found = True found = True
break break
if not found: if not found:
self.oeb.debug('No masthead found, generating default one...') self.oeb.log.debug('No masthead found, generating default one...')
from calibre.resources import server_resources from calibre.resources import server_resources
try: try:
from PIL import Image as PILImage from PIL import Image as PILImage
@ -84,12 +84,16 @@ class MOBIOutput(OutputFormatPlugin):
sections[0].append(x) sections[0].append(x)
else: else:
sections = list(toc) sections = list(toc)
for x in sections:
x.klass = 'section'
for sec in sections: for sec in sections:
articles[id(sec)] = [] articles[id(sec)] = []
for a in list(sec): for a in list(sec):
a.klass = 'article'
articles[id(sec)].append(a) articles[id(sec)].append(a)
sec.nodes.remove(a) sec.nodes.remove(a)
root = TOC(klass='periodical', title=self.oeb.metadata.title[0]) root = TOC(klass='periodical',
title=unicode(self.oeb.metadata.title[0]))
for s in sections: for s in sections:
if articles[id(s)]: if articles[id(s)]:
for a in articles[id(s)]: for a in articles[id(s)]:

View File

@ -1820,7 +1820,6 @@ class MobiWriter(object):
# Process 'periodical', 'section' and 'article' # Process 'periodical', 'section' and 'article'
if node.klass is None : if node.klass is None :
return return
t = node.title if title is None else title t = node.title if title is None else title
t = self._clean_text_value(t) t = self._clean_text_value(t)
self._last_toc_entry = t self._last_toc_entry = t
@ -1982,7 +1981,7 @@ class MobiWriter(object):
elif self._periodicalCount and self._sectionCount > 1 : elif self._periodicalCount and self._sectionCount > 1 :
pt = None pt = None
if self._oeb.metadata.publication_type: if self._oeb.metadata.publication_type:
x = self._oeb.metadata.publication_type[0].split(':') x = unicode(self._oeb.metadata.publication_type[0]).split(':')
if len(x) > 1: if len(x) > 1:
pt = x[1] pt = x[1]
mobiType = {'newspaper':0x101}.get(pt, 0x103) mobiType = {'newspaper':0x101}.get(pt, 0x103)

View File

@ -47,7 +47,7 @@ XPNSMAP = {'h' : XHTML_NS, 'o1' : OPF1_NS, 'o2' : OPF2_NS,
'd09': DC09_NS, 'd10': DC10_NS, 'd11': DC11_NS, 'd09': DC09_NS, 'd10': DC10_NS, 'd11': DC11_NS,
'xsi': XSI_NS, 'dt' : DCTERMS_NS, 'ncx': NCX_NS, 'xsi': XSI_NS, 'dt' : DCTERMS_NS, 'ncx': NCX_NS,
'svg': SVG_NS, 'xl' : XLINK_NS, 're': RE_NS, 'svg': SVG_NS, 'xl' : XLINK_NS, 're': RE_NS,
'mbp': MBP_NS } 'mbp': MBP_NS, 'calibre': CALIBRE_NS }
OPF1_NSMAP = {'dc': DC11_NS, 'oebpackage': OPF1_NS} OPF1_NSMAP = {'dc': DC11_NS, 'oebpackage': OPF1_NS}
OPF2_NSMAP = {'opf': OPF2_NS, 'dc': DC11_NS, 'dcterms': DCTERMS_NS, OPF2_NSMAP = {'opf': OPF2_NS, 'dc': DC11_NS, 'dcterms': DCTERMS_NS,