示例#1
0
文件: book.py 项目: Ralnoc/calibre
 def verify_links(self):
     spine_paths = {s:s for s in self.spine}
     for item in self.spine:
         base = os.path.dirname(item)
         for link in item.all_links:
             try:
                 p = urlparse(urlunquote(link))
             except Exception:
                 continue
             if not p.scheme and not p.netloc:
                 path = os.path.abspath(os.path.join(base, p.path)) if p.path else item
                 try:
                     path = spine_paths[path]
                 except Exception:
                     continue
                 if not p.fragment or p.fragment in path.anchor_map:
                     item.verified_links.add((path, p.fragment))
示例#2
0
文件: book.py 项目: yngwie74/calibre
 def verify_links(self):
     spine_paths = {s:s for s in self.spine}
     for item in self.spine:
         base = os.path.dirname(item)
         for link in item.all_links:
             try:
                 p = urlparse(urlunquote(link))
             except Exception:
                 continue
             if not p.scheme and not p.netloc:
                 path = os.path.abspath(os.path.join(base, p.path)) if p.path else item
                 try:
                     path = spine_paths[path]
                 except Exception:
                     continue
                 if not p.fragment or p.fragment in path.anchor_map:
                     item.verified_links.add((path, p.fragment))