mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Have palmdoc and ztxt pdb files use new txt parser.
This commit is contained in:
parent
a74210802b
commit
bfaa45c563
@ -13,8 +13,8 @@ import struct
|
|||||||
from calibre.ebooks.compression.palmdoc import compress_doc
|
from calibre.ebooks.compression.palmdoc import compress_doc
|
||||||
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
||||||
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
||||||
from calibre.ebooks.txt.writer import TxtNewlines
|
from calibre.ebooks.txt.txtml import TXTMLizer
|
||||||
from calibre.ebooks.txt.writer import TxtWriter
|
from calibre.ebooks.txt.newlines import TxtNewlines, specified_newlines
|
||||||
|
|
||||||
MAX_RECORD_SIZE = 4096
|
MAX_RECORD_SIZE = 4096
|
||||||
|
|
||||||
@ -45,8 +45,11 @@ class Writer(FormatWriter):
|
|||||||
out_stream.write(record)
|
out_stream.write(record)
|
||||||
|
|
||||||
def _generate_text(self, spine):
|
def _generate_text(self, spine):
|
||||||
txt_writer = TxtWriter(TxtNewlines('system').newline, self.log)
|
writer = TXTMLizer(log)
|
||||||
txt = txt_writer.dump(spine).encode(self.opts.output_encoding, 'replace')
|
txt = writer.extract_content(oeb_book, opts)
|
||||||
|
|
||||||
|
log.debug('\tReplacing newlines with selected type...')
|
||||||
|
txt = specified_newlines(TxtNewlines(opts.newline).newline, txt).encode(self.opts.output_encoding, 'replace')
|
||||||
|
|
||||||
txt_length = len(txt)
|
txt_length = len(txt)
|
||||||
|
|
||||||
|
@ -11,8 +11,9 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import struct, zlib
|
import struct, zlib
|
||||||
|
|
||||||
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
from calibre.ebooks.pdb.formatwriter import FormatWriter
|
||||||
from calibre.ebooks.txt.writer import TxtWriter, TxtNewlines
|
|
||||||
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
from calibre.ebooks.pdb.header import PdbHeaderBuilder
|
||||||
|
from calibre.ebooks.txt.txtml import TXTMLizer
|
||||||
|
from calibre.ebooks.txt.newlines import TxtNewlines, specified_newlines
|
||||||
|
|
||||||
MAX_RECORD_SIZE = 8192
|
MAX_RECORD_SIZE = 8192
|
||||||
|
|
||||||
@ -49,9 +50,12 @@ class Writer(FormatWriter):
|
|||||||
out_stream.write(record)
|
out_stream.write(record)
|
||||||
|
|
||||||
def _generate_text(self, spine):
|
def _generate_text(self, spine):
|
||||||
txt_writer = TxtWriter(TxtNewlines('system').newline, self.log)
|
writer = TXTMLizer(log)
|
||||||
txt = txt_writer.dump(spine).encode(self.opts.output_encoding, 'replace')
|
txt = writer.extract_content(oeb_book, opts)
|
||||||
|
|
||||||
|
log.debug('\tReplacing newlines with selected type...')
|
||||||
|
txt = specified_newlines(TxtNewlines(opts.newline).newline, txt).encode(self.opts.output_encoding, 'replace')
|
||||||
|
|
||||||
txt_length = len(txt)
|
txt_length = len(txt)
|
||||||
|
|
||||||
txt_records = []
|
txt_records = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user