mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:14:33 +02:00
TXT Output: clean ascii characters. Textile output remove span attributes.
This commit is contained in:
parent
6548dbd33c
commit
1aa66f42fe
2 changed files with 3 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
|||
from calibre.ebooks.txt.txtml import TXTMLizer
|
||||
from calibre.ebooks.txt.newlines import TxtNewlines, specified_newlines
|
||||
from calibre.ptempfile import TemporaryDirectory, TemporaryFile
|
||||
from calibre.utils.cleantext import clean_ascii_chars
|
||||
from calibre.utils.zipfile import ZipFile
|
||||
|
||||
class TXTOutput(OutputFormatPlugin):
|
||||
|
|
@ -79,6 +80,7 @@ def convert(self, oeb_book, output_path, input_plugin, opts, log):
|
|||
writer = TXTMLizer(log)
|
||||
|
||||
txt = writer.extract_content(oeb_book, opts)
|
||||
txt = clean_ascii_chars(txt)
|
||||
|
||||
log.debug('\tReplacing newlines with selected type...')
|
||||
txt = specified_newlines(TxtNewlines(opts.newline).newline, txt)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ def mlize_spine(self):
|
|||
html = re.sub(r'<\s*img[^>]*>', '', html)
|
||||
|
||||
text = html2textile(html)
|
||||
text = text.replace('%', '')
|
||||
|
||||
# Ensure the section ends with at least two new line characters.
|
||||
# This is to prevent the last paragraph from a section being
|
||||
|
|
|
|||
Loading…
Reference in a new issue