Question re: container.href_to_name(href, name)
If I run a query something like this to find links which point somewhere within the book rather than to an external location
Code:
for name in list_of_html_names:
for a in root.xpath('//*[local-name()="a" and @href]'):
ahref = a.get('href')
linkto_name = container.href_to_name(ahref, name)
if linkto_name is not None:
do_stuff ...
I would have expected container.href_to_name('#someid', name) to return 'current name' rather than 'None'. Am I using the wrong function or maybe the right function but incorrectly?
For the moment I've just used this instead:
Code:
linkto_name = name if ahref.startswith('#') else container.href_to_name(ahref, name)