mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fix link-levels.
This commit is contained in:
parent
30afc7b865
commit
7211fdc998
@ -416,7 +416,7 @@ class HTMLConverter(object):
|
|||||||
self.links[path] = []
|
self.links[path] = []
|
||||||
self.tops[path] = self.parse_file(soup, is_root)
|
self.tops[path] = self.parse_file(soup, is_root)
|
||||||
self.processed_files.append(path)
|
self.processed_files.append(path)
|
||||||
self.process_links(is_root, path)
|
self.process_links(is_root, path, link_level=link_level)
|
||||||
|
|
||||||
|
|
||||||
def parse_css(self, style):
|
def parse_css(self, style):
|
||||||
@ -623,6 +623,7 @@ class HTMLConverter(object):
|
|||||||
if not basepath:
|
if not basepath:
|
||||||
basepath = selfpath
|
basepath = selfpath
|
||||||
path = os.path.abspath(basepath)
|
path = os.path.abspath(basepath)
|
||||||
|
|
||||||
if link_level < self.link_levels and path not in self.processed_files:
|
if link_level < self.link_levels and path not in self.processed_files:
|
||||||
try:
|
try:
|
||||||
self.start_on_file(path, is_root=False, link_level=link_level+1)
|
self.start_on_file(path, is_root=False, link_level=link_level+1)
|
||||||
@ -636,7 +637,10 @@ class HTMLConverter(object):
|
|||||||
if path+fragment in self.targets.keys():
|
if path+fragment in self.targets.keys():
|
||||||
tb = get_target_block(path+fragment, self.targets)
|
tb = get_target_block(path+fragment, self.targets)
|
||||||
else:
|
else:
|
||||||
tb = self.tops[path]
|
try:
|
||||||
|
tb = self.tops[path]
|
||||||
|
except KeyError:
|
||||||
|
return
|
||||||
if is_root:
|
if is_root:
|
||||||
add_toc_entry(ascii_text, tb)
|
add_toc_entry(ascii_text, tb)
|
||||||
jb = JumpButton(tb)
|
jb = JumpButton(tb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user