mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
convert docstrings comments (extra-edit)
This commit is contained in:
parent
0ce6645f15
commit
b2c90ff460
@ -111,13 +111,11 @@ class Bookmark: # {{{
|
|||||||
# Switch location to start (0x08:0x0c)
|
# Switch location to start (0x08:0x0c)
|
||||||
start, = unpack('>I', data[eo+8:eo+12])
|
start, = unpack('>I', data[eo+8:eo+12])
|
||||||
user_notes[start] = user_notes[end_loc]
|
user_notes[start] = user_notes[end_loc]
|
||||||
'''
|
# print(" %s: swapping 0x%x (%d) to 0x%x (%d)" % (user_notes[end_loc]['type'],
|
||||||
print(" %s: swapping 0x%x (%d) to 0x%x (%d)" % (user_notes[end_loc]['type'],
|
# end_loc,
|
||||||
end_loc,
|
# end_loc/MAGIC_MOBI_CONSTANT + 1,
|
||||||
end_loc/MAGIC_MOBI_CONSTANT + 1,
|
# start,
|
||||||
start,
|
# start//MAGIC_MOBI_CONSTANT + 1))
|
||||||
start//MAGIC_MOBI_CONSTANT + 1))
|
|
||||||
'''
|
|
||||||
user_notes[start]['displayed_location'] = start // MAGIC_MOBI_CONSTANT + 1
|
user_notes[start]['displayed_location'] = start // MAGIC_MOBI_CONSTANT + 1
|
||||||
user_notes.pop(end_loc)
|
user_notes.pop(end_loc)
|
||||||
else:
|
else:
|
||||||
@ -225,37 +223,36 @@ class Bookmark: # {{{
|
|||||||
e_base = 0x0d
|
e_base = 0x0d
|
||||||
self.pdf_page_offset = 0
|
self.pdf_page_offset = 0
|
||||||
while current_entry < entries:
|
while current_entry < entries:
|
||||||
'''
|
# location, = unpack('>I', data[e_base+2:e_base+6])
|
||||||
location, = unpack('>I', data[e_base+2:e_base+6])
|
# text = None
|
||||||
text = None
|
# text_len, = unpack('>I', data[e_base+0xA:e_base+0xE])
|
||||||
text_len, = unpack('>I', data[e_base+0xA:e_base+0xE])
|
# e_type, = unpack('>B', data[e_base+1])
|
||||||
e_type, = unpack('>B', data[e_base+1])
|
# if e_type == 0:
|
||||||
if e_type == 0:
|
# e_type = 'Bookmark'
|
||||||
e_type = 'Bookmark'
|
# elif e_type == 1:
|
||||||
elif e_type == 1:
|
# e_type = 'Highlight'
|
||||||
e_type = 'Highlight'
|
# text = get_topaz_highlight(location/MAGIC_TOPAZ_CONSTANT + 1)
|
||||||
text = get_topaz_highlight(location/MAGIC_TOPAZ_CONSTANT + 1)
|
# elif e_type == 2:
|
||||||
elif e_type == 2:
|
# e_type = 'Note'
|
||||||
e_type = 'Note'
|
# text = data[e_base+0x10:e_base+0x10+text_len]
|
||||||
text = data[e_base+0x10:e_base+0x10+text_len]
|
# else:
|
||||||
else:
|
# e_type = 'Unknown annotation type'
|
||||||
e_type = 'Unknown annotation type'
|
#
|
||||||
|
# if self.book_format in ['tpz','azw1']:
|
||||||
|
# displayed_location = location/MAGIC_TOPAZ_CONSTANT + 1
|
||||||
|
# elif self.book_format == 'pdf':
|
||||||
|
# # *** This needs implementation
|
||||||
|
# displayed_location = location
|
||||||
|
# user_notes[location] = dict(id=self.id,
|
||||||
|
# displayed_location=displayed_location,
|
||||||
|
# type=e_type,
|
||||||
|
# text=text)
|
||||||
|
# if text_len == 0xFFFFFFFF:
|
||||||
|
# e_base = e_base + 14
|
||||||
|
# else:
|
||||||
|
# e_base = e_base + 14 + 2 + text_len
|
||||||
|
# current_entry += 1
|
||||||
|
|
||||||
if self.book_format in ['tpz','azw1']:
|
|
||||||
displayed_location = location/MAGIC_TOPAZ_CONSTANT + 1
|
|
||||||
elif self.book_format == 'pdf':
|
|
||||||
# *** This needs implementation
|
|
||||||
displayed_location = location
|
|
||||||
user_notes[location] = dict(id=self.id,
|
|
||||||
displayed_location=displayed_location,
|
|
||||||
type=e_type,
|
|
||||||
text=text)
|
|
||||||
if text_len == 0xFFFFFFFF:
|
|
||||||
e_base = e_base + 14
|
|
||||||
else:
|
|
||||||
e_base = e_base + 14 + 2 + text_len
|
|
||||||
current_entry += 1
|
|
||||||
'''
|
|
||||||
# Use label as page number
|
# Use label as page number
|
||||||
pdf_location, = unpack('>I', data[e_base+1:e_base+5])
|
pdf_location, = unpack('>I', data[e_base+1:e_base+5])
|
||||||
label_len, = unpack('>H', data[e_base+5:e_base+7])
|
label_len, = unpack('>H', data[e_base+5:e_base+7])
|
||||||
|
@ -319,36 +319,34 @@ class NEXTBOOK(USBMS):
|
|||||||
SUPPORTS_SUB_DIRS = True
|
SUPPORTS_SUB_DIRS = True
|
||||||
THUMBNAIL_HEIGHT = 120
|
THUMBNAIL_HEIGHT = 120
|
||||||
|
|
||||||
'''
|
# def upload_cover(self, path, filename, metadata, filepath):
|
||||||
def upload_cover(self, path, filename, metadata, filepath):
|
# if metadata.thumbnail and metadata.thumbnail[-1]:
|
||||||
if metadata.thumbnail and metadata.thumbnail[-1]:
|
# path = path.replace('/', os.sep)
|
||||||
path = path.replace('/', os.sep)
|
# is_main = path.startswith(self._main_prefix)
|
||||||
is_main = path.startswith(self._main_prefix)
|
# prefix = None
|
||||||
prefix = None
|
# if is_main:
|
||||||
if is_main:
|
# prefix = self._main_prefix
|
||||||
prefix = self._main_prefix
|
# else:
|
||||||
else:
|
# if self._card_a_prefix and \
|
||||||
if self._card_a_prefix and \
|
# path.startswith(self._card_a_prefix):
|
||||||
path.startswith(self._card_a_prefix):
|
# prefix = self._card_a_prefix
|
||||||
prefix = self._card_a_prefix
|
# elif self._card_b_prefix and \
|
||||||
elif self._card_b_prefix and \
|
# path.startswith(self._card_b_prefix):
|
||||||
path.startswith(self._card_b_prefix):
|
# prefix = self._card_b_prefix
|
||||||
prefix = self._card_b_prefix
|
# if prefix is None:
|
||||||
if prefix is None:
|
# prints('WARNING: Failed to find prefix for:', filepath)
|
||||||
prints('WARNING: Failed to find prefix for:', filepath)
|
# return
|
||||||
return
|
# thumbnail_dir = os.path.join(prefix, '.Cover')
|
||||||
thumbnail_dir = os.path.join(prefix, '.Cover')
|
#
|
||||||
|
# relpath = os.path.relpath(filepath, prefix)
|
||||||
relpath = os.path.relpath(filepath, prefix)
|
# if relpath.startswith('..\\'):
|
||||||
if relpath.startswith('..\\'):
|
# relpath = relpath[3:]
|
||||||
relpath = relpath[3:]
|
# thumbnail_dir = os.path.join(thumbnail_dir, relpath)
|
||||||
thumbnail_dir = os.path.join(thumbnail_dir, relpath)
|
# if not os.path.exists(thumbnail_dir):
|
||||||
if not os.path.exists(thumbnail_dir):
|
# os.makedirs(thumbnail_dir)
|
||||||
os.makedirs(thumbnail_dir)
|
# with open(os.path.join(thumbnail_dir, filename+'.jpg'), 'wb') as f:
|
||||||
with open(os.path.join(thumbnail_dir, filename+'.jpg'), 'wb') as f:
|
# f.write(metadata.thumbnail[-1])
|
||||||
f.write(metadata.thumbnail[-1])
|
# fsync(f)
|
||||||
fsync(f)
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
class MOOVYBOOK(USBMS):
|
class MOOVYBOOK(USBMS):
|
||||||
|
@ -161,15 +161,13 @@ class Delegator:
|
|||||||
for m in methods:
|
for m in methods:
|
||||||
setattr(self, m, getattr(d, m))
|
setattr(self, m, getattr(d, m))
|
||||||
|
|
||||||
'''
|
# for setting in d.getSettings():
|
||||||
for setting in d.getSettings():
|
# if isinstance(setting, string_or_bytes):
|
||||||
if isinstance(setting, string_or_bytes):
|
# setting = (d, setting)
|
||||||
setting = (d, setting)
|
# delegates = \
|
||||||
delegates = \
|
# self.delegatedSettingsDict.setdefault(setting[1], [])
|
||||||
self.delegatedSettingsDict.setdefault(setting[1], [])
|
# delegates.append(setting[0])
|
||||||
delegates.append(setting[0])
|
# self.delegatedSettings.append(setting)
|
||||||
self.delegatedSettings.append(setting)
|
|
||||||
'''
|
|
||||||
|
|
||||||
def applySetting(self, name, value, testValid=False):
|
def applySetting(self, name, value, testValid=False):
|
||||||
applied = False
|
applied = False
|
||||||
@ -193,13 +191,11 @@ class Delegator:
|
|||||||
def applySettings(self, settings, testValid=False):
|
def applySettings(self, settings, testValid=False):
|
||||||
for (setting, value) in settings.items():
|
for (setting, value) in settings.items():
|
||||||
self.applySetting(setting, value, testValid)
|
self.applySetting(setting, value, testValid)
|
||||||
'''
|
# if setting not in self.delegatedSettingsDict:
|
||||||
if setting not in self.delegatedSettingsDict:
|
# raise LrsError("setting %s not valid" % setting)
|
||||||
raise LrsError("setting %s not valid" % setting)
|
# delegates = self.delegatedSettingsDict[setting]
|
||||||
delegates = self.delegatedSettingsDict[setting]
|
# for d in delegates:
|
||||||
for d in delegates:
|
# setattr(d, setting, value)
|
||||||
setattr(d, setting, value)
|
|
||||||
'''
|
|
||||||
|
|
||||||
def appendDelegates(self, element, sourceEncoding):
|
def appendDelegates(self, element, sourceEncoding):
|
||||||
for d in self.delegates:
|
for d in self.delegates:
|
||||||
|
@ -166,28 +166,26 @@ class Colors:
|
|||||||
if the_index > -1:
|
if the_index > -1:
|
||||||
line = re.sub(self.__line_color_exp, self.__sub_from_line_color, line)
|
line = re.sub(self.__line_color_exp, self.__sub_from_line_color, line)
|
||||||
self.__write_obj.write(line)
|
self.__write_obj.write(line)
|
||||||
'''
|
# if num == 0:
|
||||||
if num == 0:
|
# hex_num = 'false'
|
||||||
hex_num = 'false'
|
# else:
|
||||||
else:
|
# hex_num = self.__color_dict.get(num)
|
||||||
hex_num = self.__color_dict.get(num)
|
# if hex_num == None:
|
||||||
if hex_num == None:
|
# if self.__run_level > 0:
|
||||||
if self.__run_level > 0:
|
# sys.stderr.write(
|
||||||
sys.stderr.write(
|
# 'module is colors.py\n'
|
||||||
'module is colors.py\n'
|
# 'function is self.__after_color_func\n'
|
||||||
'function is self.__after_color_func\n'
|
# 'no value in self.__color_dict for key %s\n' % num
|
||||||
'no value in self.__color_dict for key %s\n' % num
|
# )
|
||||||
)
|
# if self.__run_level > 3:
|
||||||
if self.__run_level > 3:
|
# sys.stderr.write(
|
||||||
sys.stderr.write(
|
# 'run level is %s\n'
|
||||||
'run level is %s\n'
|
# 'Script will now quit\n'
|
||||||
'Script will now quit\n'
|
# % self.__run_level)
|
||||||
% self.__run_level)
|
# else:
|
||||||
else:
|
# self.__write_obj.write(
|
||||||
self.__write_obj.write(
|
# 'cw<ci<font-color<nu<%s\n' % hex_num
|
||||||
'cw<ci<font-color<nu<%s\n' % hex_num
|
# )
|
||||||
)
|
|
||||||
'''
|
|
||||||
else:
|
else:
|
||||||
self.__write_obj.write(line)
|
self.__write_obj.write(line)
|
||||||
# cw<bd<bor-par-to<nu<bdr-hair__|bdr-li-wid:0.50|bdr-sp-wid:1.00|bdr-color_:2
|
# cw<bd<bor-par-to<nu<bdr-hair__|bdr-li-wid:0.50|bdr-sp-wid:1.00|bdr-color_:2
|
||||||
|
@ -150,10 +150,7 @@ file.
|
|||||||
self.__state = 'body'
|
self.__state = 'body'
|
||||||
type = 'bookmark-%s' % self.__type_of_bookmark
|
type = 'bookmark-%s' % self.__type_of_bookmark
|
||||||
# change here
|
# change here
|
||||||
'''
|
# my_string = self.__string_obj.process_string(self.__text_string, type)
|
||||||
my_string = self.__string_obj.process_string(
|
|
||||||
self.__text_string, type)
|
|
||||||
'''
|
|
||||||
my_string = self.__parse_bookmark_func(
|
my_string = self.__parse_bookmark_func(
|
||||||
self.__text_string, type)
|
self.__text_string, type)
|
||||||
self.__write_obj.write(self.__marker)
|
self.__write_obj.write(self.__marker)
|
||||||
|
@ -107,11 +107,8 @@ class GetOptions:
|
|||||||
return_options['out-file'] = options['output']
|
return_options['out-file'] = options['output']
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
'''
|
# sys.stderr.write("You must provide an output file with the 'o' option\n")
|
||||||
sys.stderr.write(
|
# return_options['valid'] = 0
|
||||||
'You must provide an output file with the \'o\' option\n')
|
|
||||||
return_options['valid'] = 0
|
|
||||||
'''
|
|
||||||
if 'level' in the_keys:
|
if 'level' in the_keys:
|
||||||
return_options['level'] = options['level']
|
return_options['level'] = options['level']
|
||||||
the_level = return_options.get('level')
|
the_level = return_options.get('level')
|
||||||
@ -225,14 +222,12 @@ class GetOptions:
|
|||||||
else:
|
else:
|
||||||
return_options['out-file'] = '%s.xml' % the_file_name
|
return_options['out-file'] = '%s.xml' % the_file_name
|
||||||
if not smart_output and not return_options['out-file']:
|
if not smart_output and not return_options['out-file']:
|
||||||
'''
|
# sys.stderr.write(
|
||||||
sys.stderr.write(
|
# 'Please provide and file to output with the -o option.\n'
|
||||||
'Please provide and file to output with the -o option.\n'
|
# 'Or set \'<smart-output value = "true"/>\'.\n'
|
||||||
'Or set \'<smart-output value = "true"/>\'.\n'
|
# 'in the configuration file.\n'
|
||||||
'in the configuration file.\n'
|
# )
|
||||||
)
|
# return_options['valid'] = 0
|
||||||
return_options['valid'] = 0
|
|
||||||
'''
|
|
||||||
pass
|
pass
|
||||||
if 'indent' in the_keys:
|
if 'indent' in the_keys:
|
||||||
try:
|
try:
|
||||||
@ -242,28 +237,26 @@ class GetOptions:
|
|||||||
sys.stderr.write('--indent must take an integer')
|
sys.stderr.write('--indent must take an integer')
|
||||||
return_options['valid'] = 0
|
return_options['valid'] = 0
|
||||||
# check for format and pyxml
|
# check for format and pyxml
|
||||||
'''
|
# the_format = return_options.get('format')
|
||||||
the_format = return_options.get('format')
|
# if the_format != 'raw':
|
||||||
if the_format != 'raw':
|
# no_pyxml = return_options.get('no-pyxml')
|
||||||
no_pyxml = return_options.get('no-pyxml')
|
# if no_pyxml:
|
||||||
if no_pyxml:
|
# sys.stderr.write('You want to convert your file to "%s".\n'
|
||||||
sys.stderr.write('You want to convert your file to "%s".\n'
|
# 'Sorry, but you must have pyxml installed\n'
|
||||||
'Sorry, but you must have pyxml installed\n'
|
# 'in order to convert your document to anything but raw XML.\n'
|
||||||
'in order to convert your document to anything but raw XML.\n'
|
# 'Please do not use the --format option.\n\n'
|
||||||
'Please do not use the --format option.\n\n'
|
# % the_format
|
||||||
% the_format
|
# )
|
||||||
)
|
# return_options['valid'] = 0
|
||||||
return_options['valid'] = 0
|
# xslt_proc = return_options.get('xslt-processor')
|
||||||
xslt_proc = return_options.get('xslt-processor')
|
# if xslt_proc == None and not no_pyxml:
|
||||||
if xslt_proc == None and not no_pyxml:
|
# sys.stderr.write('You want to convert your file to "%s".\n'
|
||||||
sys.stderr.write('You want to convert your file to "%s".\n'
|
# 'Sorry, but you must have an xslt processor set up\n'
|
||||||
'Sorry, but you must have an xslt processor set up\n'
|
# 'in order to conevert your document to anything but raw XML.\n'
|
||||||
'in order to conevert your document to anything but raw XML.\n'
|
# 'Please use --format raw.\n\n'
|
||||||
'Please use --format raw.\n\n'
|
# % the_format
|
||||||
% the_format
|
# )
|
||||||
)
|
# return_options['valid'] = 0
|
||||||
return_options['valid'] = 0
|
|
||||||
'''
|
|
||||||
return return_options
|
return return_options
|
||||||
|
|
||||||
def __get_config_options(self):
|
def __get_config_options(self):
|
||||||
|
@ -568,22 +568,20 @@ class Hex2Utf8:
|
|||||||
self.__convert_body()
|
self.__convert_body()
|
||||||
|
|
||||||
|
|
||||||
'''
|
# how to swap case for non-capitals
|
||||||
how to swap case for non-capitals
|
# my_string.swapcase()
|
||||||
my_string.swapcase()
|
# An example of how to use a hash for the caps function
|
||||||
An example of how to use a hash for the caps function
|
# (but I shouldn't need this, since utf text is separate
|
||||||
(but I shouldn't need this, since utf text is separate
|
# from regular text?)
|
||||||
from regular text?)
|
# sub_dict = {
|
||||||
sub_dict = {
|
# "а" : "some other value"
|
||||||
"а" : "some other value"
|
# }
|
||||||
}
|
# def my_sub_func(matchobj):
|
||||||
def my_sub_func(matchobj):
|
# info = matchobj.group(0)
|
||||||
info = matchobj.group(0)
|
# value = sub_dict.get(info)
|
||||||
value = sub_dict.get(info)
|
# return value
|
||||||
return value
|
# return "f"
|
||||||
return "f"
|
# line = "а more text"
|
||||||
line = "а more text"
|
# reg_exp = re.compile(r'(?P<name>а|б)')
|
||||||
reg_exp = re.compile(r'(?P<name>а|б)')
|
# line2 = re.sub(reg_exp, my_sub_func, line)
|
||||||
line2 = re.sub(reg_exp, my_sub_func, line)
|
# print line2
|
||||||
print line2
|
|
||||||
'''
|
|
||||||
|
@ -209,15 +209,13 @@ class Inline:
|
|||||||
if name:
|
if name:
|
||||||
self.__inline_list[-1]['contains_inline'] = 1
|
self.__inline_list[-1]['contains_inline'] = 1
|
||||||
self.__inline_list[-1][name] = char_value
|
self.__inline_list[-1][name] = char_value
|
||||||
'''
|
# if name == 'font-style':
|
||||||
if name == 'font-style':
|
# if char_value == 'Symbol':
|
||||||
if char_value == 'Symbol':
|
# self.__write_obj.write('mi<mk<font-symbo\n')
|
||||||
self.__write_obj.write('mi<mk<font-symbo\n')
|
# elif char_value == 'Wingdings':
|
||||||
elif char_value == 'Wingdings':
|
# self.__write_obj.write('mi<mk<font-wingd\n')
|
||||||
self.__write_obj.write('mi<mk<font-wingd\n')
|
# elif char_value == 'Zapf Dingbats':
|
||||||
elif char_value == 'Zapf Dingbats':
|
# self.__write_obj.write('mi<mk<font-dingb\n')
|
||||||
self.__write_obj.write('mi<mk<font-dingb\n')
|
|
||||||
'''
|
|
||||||
|
|
||||||
def __close_bracket_func(self, line):
|
def __close_bracket_func(self, line):
|
||||||
'''
|
'''
|
||||||
|
@ -119,11 +119,9 @@ class ListNumbers:
|
|||||||
text_string = text_string.replace(')', '')
|
text_string = text_string.replace(')', '')
|
||||||
if text_string.isdigit():
|
if text_string.isdigit():
|
||||||
return 'ordered'
|
return 'ordered'
|
||||||
'''
|
# sys.stderr.write('module is list_numbers\n')
|
||||||
sys.stderr.write('module is list_numbers\n')
|
# sys.stderr.write('method is __determine type\n')
|
||||||
sys.stderr.write('method is __determine type\n')
|
# sys.stderr.write('Couldn\'t get type of list\n')
|
||||||
sys.stderr.write('Couldn\'t get type of list\n')
|
|
||||||
'''
|
|
||||||
# must be some type of ordered list -- just a guess!
|
# must be some type of ordered list -- just a guess!
|
||||||
return 'unordered'
|
return 'unordered'
|
||||||
|
|
||||||
|
@ -68,14 +68,12 @@ class ListTable:
|
|||||||
'cw<ci<bold______' : 'bold',
|
'cw<ci<bold______' : 'bold',
|
||||||
'cw<ss<para-style' : 'paragraph-style-name',
|
'cw<ss<para-style' : 'paragraph-style-name',
|
||||||
}
|
}
|
||||||
'''
|
# all_lists =
|
||||||
all_lists =
|
# [{anything here?}
|
||||||
[{anything here?}
|
# [{list-templateid = ""}
|
||||||
[{list-templateid = ""}
|
# [{level-indent}],[{level-indent}]
|
||||||
[{level-indent}],[{level-indent}]
|
# ]
|
||||||
]
|
# ],
|
||||||
],
|
|
||||||
'''
|
|
||||||
|
|
||||||
def __parse_lines(self, line):
|
def __parse_lines(self, line):
|
||||||
'''
|
'''
|
||||||
@ -229,14 +227,12 @@ class ListTable:
|
|||||||
self.__level_numbers_string += '\\'%s' % line[18:]
|
self.__level_numbers_string += '\\'%s' % line[18:]
|
||||||
elif self.__token_info == 'tx<nu<__________':
|
elif self.__token_info == 'tx<nu<__________':
|
||||||
self.__level_numbers_string += line[17:]
|
self.__level_numbers_string += line[17:]
|
||||||
'''
|
# num = line[18:]
|
||||||
num = line[18:]
|
# num = int(num, 16)
|
||||||
num = int(num, 16)
|
# level = str(round((num - 1)/2, 0))
|
||||||
level = str(round((num - 1)/2, 0))
|
# level = level[:-2]
|
||||||
level = level[:-2]
|
# level = 'level%s-show-level' % level
|
||||||
level = 'level%s-show-level' % level
|
# self.__all_lists[-1][-1][0][level] = 'true'
|
||||||
self.__all_lists[-1][-1][0][level] = 'true'
|
|
||||||
'''
|
|
||||||
|
|
||||||
def __level_text_func(self, line):
|
def __level_text_func(self, line):
|
||||||
'''
|
'''
|
||||||
|
@ -282,7 +282,5 @@ if __name__ == '__main__':
|
|||||||
)
|
)
|
||||||
options, the_args = test_obj.parse_options()
|
options, the_args = test_obj.parse_options()
|
||||||
print(options, the_args)
|
print(options, the_args)
|
||||||
'''
|
# this_options = ['--foo', '-o']
|
||||||
this_options = ['--foo', '-o']
|
# this_opt_with_args = ['--foo']
|
||||||
this_opt_with_args = ['--foo']
|
|
||||||
'''
|
|
||||||
|
@ -674,15 +674,12 @@ if another paragraph_def is found, the state changes to collect_tokens.
|
|||||||
self.__write_obj.write('mi<tg<open-att__<paragraph-definition')
|
self.__write_obj.write('mi<tg<open-att__<paragraph-definition')
|
||||||
self.__write_obj.write('<name>%s' % self.__att_val_dict['name'])
|
self.__write_obj.write('<name>%s' % self.__att_val_dict['name'])
|
||||||
self.__write_obj.write('<style-number>%s' % self.__att_val_dict['style-num'])
|
self.__write_obj.write('<style-number>%s' % self.__att_val_dict['style-num'])
|
||||||
tabs_list = ['tabs-left', 'tabs-right', 'tabs-decimal', 'tabs-center',
|
tabs_list = ['tabs-left', 'tabs-right', 'tabs-decimal', 'tabs-center', 'tabs-bar', 'tabs']
|
||||||
'tabs-bar', 'tabs']
|
# for tab_item in tabs_list:
|
||||||
'''
|
# if self.__att_val_dict[tab_item] != '':
|
||||||
for tab_item in tabs_list:
|
# the_value = self.__att_val_dict[tab_item]
|
||||||
if self.__att_val_dict[tab_item] != '':
|
# the_value = the_value[:-1]
|
||||||
the_value = self.__att_val_dict[tab_item]
|
# self.__write_obj.write('<%s>%s' % (tab_item, the_value))
|
||||||
the_value = the_value[:-1]
|
|
||||||
self.__write_obj.write('<%s>%s' % (tab_item, the_value))
|
|
||||||
'''
|
|
||||||
if self.__att_val_dict['tabs'] != '':
|
if self.__att_val_dict['tabs'] != '':
|
||||||
the_value = self.__att_val_dict['tabs']
|
the_value = self.__att_val_dict['tabs']
|
||||||
# the_value = the_value[:-1]
|
# the_value = the_value[:-1]
|
||||||
|
@ -115,11 +115,9 @@ class Pict:
|
|||||||
has not already been created.) Set the self.__in_pict flag to true.
|
has not already been created.) Set the self.__in_pict flag to true.
|
||||||
If the line does not contain pict data, return 1
|
If the line does not contain pict data, return 1
|
||||||
'''
|
'''
|
||||||
'''
|
# $pict_count++;
|
||||||
$pict_count++;
|
# $pict_count = sprintf("%03d", $pict_count);
|
||||||
$pict_count = sprintf("%03d", $pict_count);
|
# print OUTPUT "dv<xx<em<nu<pict<at<num>$pict_count\n";
|
||||||
print OUTPUT "dv<xx<em<nu<pict<at<num>$pict_count\n";
|
|
||||||
'''
|
|
||||||
if self.__token_info == 'cw<gr<picture___':
|
if self.__token_info == 'cw<gr<picture___':
|
||||||
self.__pict_count += 1
|
self.__pict_count += 1
|
||||||
# write_obj.write("mi<tg<em<at<pict<num>%03d\n" % self.__pict_count)
|
# write_obj.write("mi<tg<em<at<pict<num>%03d\n" % self.__pict_count)
|
||||||
|
@ -191,15 +191,13 @@ class PreambleDiv:
|
|||||||
'''
|
'''
|
||||||
If not font table is found, make a string for a default one
|
If not font table is found, make a string for a default one
|
||||||
'''
|
'''
|
||||||
'''
|
# self.__style_sheet_final = 'mi<tg<open______<style-table\n'
|
||||||
self.__style_sheet_final = 'mi<tg<open______<style-table\n'
|
# self.__style_sheet_final +=
|
||||||
self.__style_sheet_final +=
|
# self.__style_sheet_final +=
|
||||||
self.__style_sheet_final +=
|
# self.__style_sheet_final +=
|
||||||
self.__style_sheet_final +=
|
# self.__style_sheet_final +=
|
||||||
self.__style_sheet_final +=
|
# self.__style_sheet_final +=
|
||||||
self.__style_sheet_final +=
|
# self.__style_sheet_final += 'mi<tg<close_____<style-table\n'
|
||||||
self.__style_sheet_final += 'mi<tg<close_____<style-table\n'
|
|
||||||
'''
|
|
||||||
self.__style_sheet_final = '''mi<tg<open______<style-table
|
self.__style_sheet_final = '''mi<tg<open______<style-table
|
||||||
mi<mk<styles-beg
|
mi<mk<styles-beg
|
||||||
mi<mk<stylei-beg
|
mi<mk<stylei-beg
|
||||||
|
@ -585,31 +585,29 @@ class ProcessTokens:
|
|||||||
1024 : 'Unkown',
|
1024 : 'Unkown',
|
||||||
255 : 'Unkown',
|
255 : 'Unkown',
|
||||||
}
|
}
|
||||||
'''
|
|
||||||
# unknown
|
# unknown
|
||||||
# These must get passed on because they occurred after \\*
|
# These must get passed on because they occurred after \\*
|
||||||
'do' : ('un', 'unknown___', self.default_func),
|
# 'do' : ('un', 'unknown___', self.default_func),
|
||||||
'company' : ('un', 'company___', self.default_func),
|
# 'company' : ('un', 'company___', self.default_func),
|
||||||
'shpinst' : ('un', 'unknown___', self.default_func),
|
# 'shpinst' : ('un', 'unknown___', self.default_func),
|
||||||
'panose' : ('un', 'unknown___', self.default_func),
|
# 'panose' : ('un', 'unknown___', self.default_func),
|
||||||
'falt' : ('un', 'unknown___', self.default_func),
|
# 'falt' : ('un', 'unknown___', self.default_func),
|
||||||
'listoverridetable' : ('un', 'unknown___', self.default_func),
|
# 'listoverridetable' : ('un', 'unknown___', self.default_func),
|
||||||
'category' : ('un', 'unknown___', self.default_func),
|
# 'category' : ('un', 'unknown___', self.default_func),
|
||||||
'template' : ('un', 'unknown___', self.default_func),
|
# 'template' : ('un', 'unknown___', self.default_func),
|
||||||
'ud' : ('un', 'unknown___', self.default_func),
|
# 'ud' : ('un', 'unknown___', self.default_func),
|
||||||
'formfield' : ('un', 'unknown___', self.default_func),
|
# 'formfield' : ('un', 'unknown___', self.default_func),
|
||||||
'ts' : ('un', 'unknown___', self.default_func),
|
# 'ts' : ('un', 'unknown___', self.default_func),
|
||||||
'rsidtbl' : ('un', 'unknown___', self.default_func),
|
# 'rsidtbl' : ('un', 'unknown___', self.default_func),
|
||||||
'generator' : ('un', 'unknown___', self.default_func),
|
# 'generator' : ('un', 'unknown___', self.default_func),
|
||||||
'ftnsep' : ('un', 'unknown___', self.default_func),
|
# 'ftnsep' : ('un', 'unknown___', self.default_func),
|
||||||
'aftnsep' : ('un', 'unknown___', self.default_func),
|
# 'aftnsep' : ('un', 'unknown___', self.default_func),
|
||||||
'aftnsepc' : ('un', 'unknown___', self.default_func),
|
# 'aftnsepc' : ('un', 'unknown___', self.default_func),
|
||||||
'aftncn' : ('un', 'unknown___', self.default_func),
|
# 'aftncn' : ('un', 'unknown___', self.default_func),
|
||||||
'objclass' : ('un', 'unknown___', self.default_func),
|
# 'objclass' : ('un', 'unknown___', self.default_func),
|
||||||
'objdata' : ('un', 'unknown___', self.default_func),
|
# 'objdata' : ('un', 'unknown___', self.default_func),
|
||||||
'picprop' : ('un', 'unknown___', self.default_func),
|
# 'picprop' : ('un', 'unknown___', self.default_func),
|
||||||
'blipuid' : ('un', 'unknown___', self.default_func),
|
# 'blipuid' : ('un', 'unknown___', self.default_func),
|
||||||
'''
|
|
||||||
|
|
||||||
def __ms_hex_func(self, pre, token, num):
|
def __ms_hex_func(self, pre, token, num):
|
||||||
num = num[1:] # chop off leading 0, which I added
|
num = num[1:] # chop off leading 0, which I added
|
||||||
|
@ -427,12 +427,12 @@ class Sections:
|
|||||||
'''
|
'''
|
||||||
# change this 2004-04-26
|
# change this 2004-04-26
|
||||||
# Don't do anything
|
# Don't do anything
|
||||||
'''
|
#
|
||||||
self.__sec_in_field_string += line
|
# self.__sec_in_field_string += line
|
||||||
self.__print_field_sec_attributes()
|
# self.__print_field_sec_attributes()
|
||||||
self.__write_obj.write(self.__sec_in_field_string)
|
# self.__write_obj.write(self.__sec_in_field_string)
|
||||||
self.__print_field_sec_attributes()
|
# self.__print_field_sec_attributes()
|
||||||
'''
|
|
||||||
self.__state = 'body'
|
self.__state = 'body'
|
||||||
self.__in_field = 0
|
self.__in_field = 0
|
||||||
# this is changed too
|
# this is changed too
|
||||||
|
@ -460,13 +460,11 @@ class Styles:
|
|||||||
'''
|
'''
|
||||||
self.__type_of_style = 'par'
|
self.__type_of_style = 'par'
|
||||||
self.__styles_num = line[20:-1]
|
self.__styles_num = line[20:-1]
|
||||||
'''
|
# self.__enter_dict_entry('tabs-left', '')
|
||||||
self.__enter_dict_entry('tabs-left', '')
|
# self.__enter_dict_entry('tabs-right', '')
|
||||||
self.__enter_dict_entry('tabs-right', '')
|
# self.__enter_dict_entry('tabs-center', '')
|
||||||
self.__enter_dict_entry('tabs-center', '')
|
# self.__enter_dict_entry('tabs-decimal', '')
|
||||||
self.__enter_dict_entry('tabs-decimal', '')
|
# self.__enter_dict_entry('tabs-bar', '')
|
||||||
self.__enter_dict_entry('tabs-bar', '')
|
|
||||||
'''
|
|
||||||
|
|
||||||
def __char_style_func(self, line):
|
def __char_style_func(self, line):
|
||||||
'''
|
'''
|
||||||
|
@ -468,16 +468,14 @@ class Table:
|
|||||||
if action:
|
if action:
|
||||||
action(line)
|
action(line)
|
||||||
self.__write_obj.write(line)
|
self.__write_obj.write(line)
|
||||||
'''
|
# elif self.__token_info == 'mi<mk<pard-start':
|
||||||
elif self.__token_info == 'mi<mk<pard-start':
|
# self.__start_cell_func(line)
|
||||||
self.__start_cell_func(line)
|
# self.__write_obj.write(line)
|
||||||
self.__write_obj.write(line)
|
# elif self.__token_info == 'cw<tb<row_______':
|
||||||
elif self.__token_info == 'cw<tb<row_______':
|
# self.__end_row_func(line)
|
||||||
self.__end_row_func(line)
|
# self.__write_obj.write(line)
|
||||||
self.__write_obj.write(line)
|
# else:
|
||||||
else:
|
# self.__write_obj.write(line)
|
||||||
self.__write_obj.write(line)
|
|
||||||
'''
|
|
||||||
|
|
||||||
def __end_row_func(self, line):
|
def __end_row_func(self, line):
|
||||||
'''
|
'''
|
||||||
|
@ -419,9 +419,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
OptionRecommendation.HIGH))
|
OptionRecommendation.HIGH))
|
||||||
recommendations.append(('comments', '', OptionRecommendation.HIGH))
|
recommendations.append(('comments', '', OptionRecommendation.HIGH))
|
||||||
|
|
||||||
'''
|
# >>> Use to debug generated catalog code before pipeline conversion <<<
|
||||||
>>> Use to debug generated catalog code before pipeline conversion <<<
|
|
||||||
'''
|
|
||||||
GENERATE_DEBUG_EPUB = False
|
GENERATE_DEBUG_EPUB = False
|
||||||
if GENERATE_DEBUG_EPUB:
|
if GENERATE_DEBUG_EPUB:
|
||||||
catalog_debug_path = os.path.join(os.path.expanduser('~'), 'Desktop', 'Catalog debug')
|
catalog_debug_path = os.path.join(os.path.expanduser('~'), 'Desktop', 'Catalog debug')
|
||||||
|
@ -3072,12 +3072,10 @@ class CatalogBuilder:
|
|||||||
# Don't include Author for Kindle
|
# Don't include Author for Kindle
|
||||||
title_str = self.format_ncx_text('%s' % (book['title']), dest='title')
|
title_str = self.format_ncx_text('%s' % (book['title']), dest='title')
|
||||||
if self.opts.connected_kindle and book['id'] in self.bookmarked_books:
|
if self.opts.connected_kindle and book['id'] in self.bookmarked_books:
|
||||||
'''
|
# dots = int((book['percent_read'] + 5)/10)
|
||||||
dots = int((book['percent_read'] + 5)/10)
|
# dot_string = '+' * dots
|
||||||
dot_string = '+' * dots
|
# empty_dots = '-' * (10 - dots)
|
||||||
empty_dots = '-' * (10 - dots)
|
# title_str += ' %s%s' % (dot_string,empty_dots)
|
||||||
title_str += ' %s%s' % (dot_string,empty_dots)
|
|
||||||
'''
|
|
||||||
title_str += '*'
|
title_str += '*'
|
||||||
sec_text = title_str
|
sec_text = title_str
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user