mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Oops
This commit is contained in:
parent
a0d6df759d
commit
78601341a3
@ -175,8 +175,8 @@ def add_pipeline_options(parser, plumber):
|
|||||||
if rec.level < rec.HIGH:
|
if rec.level < rec.HIGH:
|
||||||
option_recommendation_to_cli_option(add_option, rec)
|
option_recommendation_to_cli_option(add_option, rec)
|
||||||
|
|
||||||
option_recommendation_to_cli_option(parser.add_option,
|
parser.add_option('--list-recipes', default=False, action='store_true',
|
||||||
plumber.get_option_by_name('list_recipes'))
|
help=_('List builtin recipes'))
|
||||||
|
|
||||||
def option_parser():
|
def option_parser():
|
||||||
return OptionParser(usage=USAGE)
|
return OptionParser(usage=USAGE)
|
||||||
|
@ -107,10 +107,10 @@ class MOBIOutput(OutputFormatPlugin):
|
|||||||
sections = list(toc)
|
sections = list(toc)
|
||||||
for i,x in enumerate(sections):
|
for i,x in enumerate(sections):
|
||||||
x.klass = 'section'
|
x.klass = 'section'
|
||||||
articles = list(x)
|
articles_ = list(x)
|
||||||
if articles:
|
if articles_:
|
||||||
self.oeb.manifest.remove(self.oeb.manifest.hrefs[x.href])
|
self.oeb.manifest.remove(self.oeb.manifest.hrefs[x.href])
|
||||||
x.href = articles[0].href
|
x.href = articles_[0].href
|
||||||
|
|
||||||
|
|
||||||
for sec in sections:
|
for sec in sections:
|
||||||
|
@ -190,7 +190,7 @@ class Serializer(object):
|
|||||||
path = urldefrag(ref.href)[0]
|
path = urldefrag(ref.href)[0]
|
||||||
if hrefs[path].media_type not in OEB_DOCS:
|
if hrefs[path].media_type not in OEB_DOCS:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
buffer.write('<reference type="')
|
buffer.write('<reference type="')
|
||||||
if ref.type.startswith('other.') :
|
if ref.type.startswith('other.') :
|
||||||
self.serialize_text(ref.type.replace('other.',''), quot=True)
|
self.serialize_text(ref.type.replace('other.',''), quot=True)
|
||||||
@ -204,7 +204,7 @@ class Serializer(object):
|
|||||||
self.serialize_href(ref.href)
|
self.serialize_href(ref.href)
|
||||||
# Space required or won't work, I kid you not
|
# Space required or won't work, I kid you not
|
||||||
buffer.write(' />')
|
buffer.write(' />')
|
||||||
|
|
||||||
buffer.write('</guide>')
|
buffer.write('</guide>')
|
||||||
|
|
||||||
def serialize_href(self, href, base=None):
|
def serialize_href(self, href, base=None):
|
||||||
@ -656,7 +656,7 @@ class MobiWriter(object):
|
|||||||
thisRecordPrime = thisRecord
|
thisRecordPrime = thisRecord
|
||||||
if (offset + length) // RECORD_SIZE > thisRecord :
|
if (offset + length) // RECORD_SIZE > thisRecord :
|
||||||
thisRecordPrime = (offset + length) // RECORD_SIZE
|
thisRecordPrime = (offset + length) // RECORD_SIZE
|
||||||
|
|
||||||
sectionChangesInThisRecord = True
|
sectionChangesInThisRecord = True
|
||||||
sectionChangedInRecordNumber = thisRecordPrime
|
sectionChangedInRecordNumber = thisRecordPrime
|
||||||
self._currentSectionIndex += 1 # <<<
|
self._currentSectionIndex += 1 # <<<
|
||||||
@ -678,10 +678,10 @@ class MobiWriter(object):
|
|||||||
continue
|
continue
|
||||||
else :
|
else :
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
# If no one has taken the openingNode slot, it must be us
|
# If no one has taken the openingNode slot, it must be us
|
||||||
# This could happen before detecting a section change
|
# This could happen before detecting a section change
|
||||||
if self._HTMLRecords[thisRecord].openingNode == -1 :
|
if self._HTMLRecords[thisRecord].openingNode == -1 :
|
||||||
self._HTMLRecords[thisRecord].openingNode = myIndex
|
self._HTMLRecords[thisRecord].openingNode = myIndex
|
||||||
self._HTMLRecords[thisRecord].openingNodeParent = self._currentSectionIndex
|
self._HTMLRecords[thisRecord].openingNodeParent = self._currentSectionIndex
|
||||||
@ -1315,15 +1315,6 @@ class MobiWriter(object):
|
|||||||
else :
|
else :
|
||||||
raise NotImplementedError('Indexing for mobitype 0x%X not implemented' % booktype)
|
raise NotImplementedError('Indexing for mobitype 0x%X not implemented' % booktype)
|
||||||
|
|
||||||
# Dump the current HTML Record Data / TBS
|
|
||||||
# GR diagnostics
|
|
||||||
if False :
|
|
||||||
self._HTMLRecords[nrecords].dumpData(nrecords, self._oeb)
|
|
||||||
outstr = ''
|
|
||||||
for eachbyte in self._tbSequence:
|
|
||||||
outstr += '0x%02X ' % ord(eachbyte)
|
|
||||||
self._oeb.logger.info(' Trailing Byte Sequence: %s\n' % outstr)
|
|
||||||
|
|
||||||
# Write the sequence
|
# Write the sequence
|
||||||
record.write(self._tbSequence)
|
record.write(self._tbSequence)
|
||||||
|
|
||||||
@ -1386,7 +1377,7 @@ class MobiWriter(object):
|
|||||||
self._generate_end_records()
|
self._generate_end_records()
|
||||||
'''
|
'''
|
||||||
self._generate_end_records()
|
self._generate_end_records()
|
||||||
|
|
||||||
record0 = StringIO()
|
record0 = StringIO()
|
||||||
# The PalmDOC Header
|
# The PalmDOC Header
|
||||||
record0.write(pack('>HHIHHHH', self._compression, 0,
|
record0.write(pack('>HHIHHHH', self._compression, 0,
|
||||||
@ -1522,19 +1513,13 @@ class MobiWriter(object):
|
|||||||
# - 0x4: <uncrossable breaks><size>
|
# - 0x4: <uncrossable breaks><size>
|
||||||
# GR: Use 7 for indexed files, 5 for unindexed
|
# GR: Use 7 for indexed files, 5 for unindexed
|
||||||
# Setting bit 2 (0x4) disables <guide><reference type="start"> functionality
|
# Setting bit 2 (0x4) disables <guide><reference type="start"> functionality
|
||||||
'''
|
|
||||||
if INDEXING and self._indexable :
|
|
||||||
record0.write(pack('>I', 7))
|
|
||||||
else:
|
|
||||||
record0.write(pack('>I', 5))
|
|
||||||
'''
|
|
||||||
|
|
||||||
trailingDataFlags = 1
|
trailingDataFlags = 1
|
||||||
if self._indexable :
|
if self._indexable :
|
||||||
trailingDataFlags |= 2
|
trailingDataFlags |= 2
|
||||||
if WRITE_PBREAKS :
|
if WRITE_PBREAKS :
|
||||||
trailingDataFlags |= 4
|
trailingDataFlags |= 4
|
||||||
record0.write(pack('>I', trailingDataFlags))
|
record0.write(pack('>I', trailingDataFlags))
|
||||||
|
|
||||||
# 0xe4 - 0xe7 : Primary index record
|
# 0xe4 - 0xe7 : Primary index record
|
||||||
record0.write(pack('>I', 0xffffffff if self._primary_index_record is
|
record0.write(pack('>I', 0xffffffff if self._primary_index_record is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user