mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix logic to detect links that should be put in TOC. Fixes #257.
This commit is contained in:
parent
e0c8f0771d
commit
69769c9d92
@ -504,7 +504,7 @@ class HTMLConverter(object):
|
|||||||
|
|
||||||
path, fragment = munge_paths(self.target_prefix, tag['href'])
|
path, fragment = munge_paths(self.target_prefix, tag['href'])
|
||||||
return {'para':para, 'text':text, 'path':os.path.normpath(path),
|
return {'para':para, 'text':text, 'path':os.path.normpath(path),
|
||||||
'fragment':fragment}
|
'fragment':fragment, 'in toc': (self.link_level == 0 and not self.use_spine)}
|
||||||
|
|
||||||
|
|
||||||
def get_text(self, tag, limit=None):
|
def get_text(self, tag, limit=None):
|
||||||
@ -572,7 +572,7 @@ class HTMLConverter(object):
|
|||||||
page.contents.remove(bs)
|
page.contents.remove(bs)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
outside_links = deque()
|
outside_links = deque()
|
||||||
while len(self.links) > 0:
|
while len(self.links) > 0:
|
||||||
link = self.links.popleft()
|
link = self.links.popleft()
|
||||||
para, text, path, fragment = link['para'], link['text'], link['path'], link['fragment']
|
para, text, path, fragment = link['para'], link['text'], link['path'], link['fragment']
|
||||||
@ -583,7 +583,7 @@ class HTMLConverter(object):
|
|||||||
tb = get_target_block(path+fragment, self.targets)
|
tb = get_target_block(path+fragment, self.targets)
|
||||||
else:
|
else:
|
||||||
tb = self.tops[path]
|
tb = self.tops[path]
|
||||||
if self.link_level == 0 and self.use_spine:
|
if link['in toc']:
|
||||||
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