mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #780728 (RTF to mobi conversion fails)
This commit is contained in:
parent
fa0c8702b0
commit
534af919a5
@ -86,7 +86,7 @@ class RTFInput(InputFormatPlugin):
|
|||||||
run_lev = 4
|
run_lev = 4
|
||||||
self.log('Running RTFParser in debug mode')
|
self.log('Running RTFParser in debug mode')
|
||||||
except:
|
except:
|
||||||
pass
|
self.log.warn('Impossible to run RTFParser in debug mode')
|
||||||
parser = ParseRtf(
|
parser = ParseRtf(
|
||||||
in_file = stream,
|
in_file = stream,
|
||||||
out_file = ofile,
|
out_file = ofile,
|
||||||
|
@ -197,8 +197,8 @@ class ProcessTokens:
|
|||||||
# character info => ci
|
# character info => ci
|
||||||
'b' : ('ci', 'bold______', self.bool_st_func),
|
'b' : ('ci', 'bold______', self.bool_st_func),
|
||||||
'blue' : ('ci', 'blue______', self.color_func),
|
'blue' : ('ci', 'blue______', self.color_func),
|
||||||
'caps' : ('ci', 'caps______', self.bool_st_func),
|
'caps' : ('ci', 'caps______', self.bool_st_func),
|
||||||
'cf' : ('ci', 'font-color', self.default_func),
|
'cf' : ('ci', 'font-color', self.colorz_func),
|
||||||
'chftn' : ('ci', 'footnot-mk', self.bool_st_func),
|
'chftn' : ('ci', 'footnot-mk', self.bool_st_func),
|
||||||
'dn' : ('ci', 'font-down_', self.divide_by_2),
|
'dn' : ('ci', 'font-down_', self.divide_by_2),
|
||||||
'embo' : ('ci', 'emboss____', self.bool_st_func),
|
'embo' : ('ci', 'emboss____', self.bool_st_func),
|
||||||
@ -624,6 +624,11 @@ class ProcessTokens:
|
|||||||
num = 'true'
|
num = 'true'
|
||||||
return 'cw<%s<%s<nu<%s\n' % (pre, token, num)
|
return 'cw<%s<%s<nu<%s\n' % (pre, token, num)
|
||||||
|
|
||||||
|
def colorz_func(self, pre, token, num):
|
||||||
|
if num is None:
|
||||||
|
num = '0'
|
||||||
|
return 'cw<%s<%s<nu<%s\n' % (pre, token, num)
|
||||||
|
|
||||||
def __list_type_func(self, pre, token, num):
|
def __list_type_func(self, pre, token, num):
|
||||||
type = 'arabic'
|
type = 'arabic'
|
||||||
if num is None:
|
if num is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user