mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
TXT Output: Textile don't blindly remove %'s, modify html2textile to not write % from spans.
This commit is contained in:
parent
b814809d9f
commit
dbc133be13
@ -41,7 +41,6 @@ class TextileMLizer(object):
|
|||||||
html = re.sub(r'<\s*img[^>]*>', '', html)
|
html = re.sub(r'<\s*img[^>]*>', '', html)
|
||||||
|
|
||||||
text = html2textile(html)
|
text = html2textile(html)
|
||||||
text = text.replace('%', '')
|
|
||||||
|
|
||||||
# Ensure the section ends with at least two new line characters.
|
# Ensure the section ends with at least two new line characters.
|
||||||
# This is to prevent the last paragraph from a section being
|
# This is to prevent the last paragraph from a section being
|
||||||
|
@ -77,7 +77,7 @@ class EchoTarget:
|
|||||||
new_tag = '~'
|
new_tag = '~'
|
||||||
newline = ''
|
newline = ''
|
||||||
elif tag == 'span':
|
elif tag == 'span':
|
||||||
new_tag = '%'
|
new_tag = ''
|
||||||
newline = ''
|
newline = ''
|
||||||
elif tag == 'a':
|
elif tag == 'a':
|
||||||
self.block = True
|
self.block = True
|
||||||
@ -147,7 +147,7 @@ class EchoTarget:
|
|||||||
elif tag == 'sub':
|
elif tag == 'sub':
|
||||||
self.final_output.append('~')
|
self.final_output.append('~')
|
||||||
elif tag == 'span':
|
elif tag == 'span':
|
||||||
self.final_output.append('%')
|
self.final_output.append('')
|
||||||
elif tag == 'a':
|
elif tag == 'a':
|
||||||
if self.a_part['title']:
|
if self.a_part['title']:
|
||||||
textilized = ' "%s (%s)":%s ' % (
|
textilized = ' "%s (%s)":%s ' % (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user