mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Strip '#' from name attribute.
This commit is contained in:
parent
684d03da1f
commit
85667ff2c5
@ -556,7 +556,6 @@ class HTMLConverter(object):
|
|||||||
para = children[i]
|
para = children[i]
|
||||||
break
|
break
|
||||||
if para is None:
|
if para is None:
|
||||||
print children
|
|
||||||
raise ConversionError('Failed to parse link %s'%(tag,))
|
raise ConversionError('Failed to parse link %s'%(tag,))
|
||||||
text = self.get_text(tag, 1000)
|
text = self.get_text(tag, 1000)
|
||||||
if not text:
|
if not text:
|
||||||
@ -657,7 +656,7 @@ class HTMLConverter(object):
|
|||||||
continue
|
continue
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
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:
|
||||||
try:
|
try:
|
||||||
@ -1081,6 +1080,7 @@ class HTMLConverter(object):
|
|||||||
self.targets[self.target_prefix+tag[key]] = self.current_block
|
self.targets[self.target_prefix+tag[key]] = self.current_block
|
||||||
elif tag.has_key('name') or tag.has_key('id'):
|
elif tag.has_key('name') or tag.has_key('id'):
|
||||||
key = 'name' if tag.has_key('name') else 'id'
|
key = 'name' if tag.has_key('name') else 'id'
|
||||||
|
name = tag[key].replace('#', '')
|
||||||
if self.anchor_to_previous:
|
if self.anchor_to_previous:
|
||||||
self.process_children(tag, tag_css)
|
self.process_children(tag, tag_css)
|
||||||
for c in self.anchor_to_previous.contents:
|
for c in self.anchor_to_previous.contents:
|
||||||
@ -1090,11 +1090,12 @@ class HTMLConverter(object):
|
|||||||
tb = self.book.create_text_block()
|
tb = self.book.create_text_block()
|
||||||
tb.Paragraph(" ")
|
tb.Paragraph(" ")
|
||||||
self.anchor_to_previous.append(tb)
|
self.anchor_to_previous.append(tb)
|
||||||
self.targets[self.target_prefix+tag[key]] = tb
|
self.targets[self.target_prefix+name] = tb
|
||||||
return
|
return
|
||||||
previous = self.current_block
|
previous = self.current_block
|
||||||
self.process_children(tag, tag_css)
|
self.process_children(tag, tag_css)
|
||||||
target = None
|
target = None
|
||||||
|
|
||||||
if self.current_block == previous:
|
if self.current_block == previous:
|
||||||
if self.current_para.has_text():
|
if self.current_para.has_text():
|
||||||
self.current_para.append_to(self.current_block)
|
self.current_para.append_to(self.current_block)
|
||||||
@ -1131,7 +1132,7 @@ class HTMLConverter(object):
|
|||||||
else:
|
else:
|
||||||
target = BlockSpace()
|
target = BlockSpace()
|
||||||
self.current_page.append(target)
|
self.current_page.append(target)
|
||||||
self.targets[self.target_prefix+tag[key]] = target
|
self.targets[self.target_prefix+name] = target
|
||||||
elif tagname == 'img':
|
elif tagname == 'img':
|
||||||
if tag.has_key('src') and os.access(unquote(tag['src']), os.R_OK):
|
if tag.has_key('src') and os.access(unquote(tag['src']), os.R_OK):
|
||||||
path = os.path.abspath(unquote(tag['src']))
|
path = os.path.abspath(unquote(tag['src']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user