(self, content)
return content
Fix the path of the links in nav file
Fix the path of the links in nav file
Fix the path of the links in nav file
def _fix_nav_css_links(self, content):
        """
        Fix the path of the links in nav file
        """

        root = ebooklib.utils.parse_string(content)
        for element in root.iter('{%s}link' % NAMESPACES['XHTML']):
            href = urllib.unquote(element.get('href'))

            if href.startswith('../%s' % STYLES_DIR):
                file_name = os.path.basename(href)
                element.set(
                    'href', '{}/{}'.format(STYLES_DIR, file_name))

        content = etree.tostring(
            root, pretty_print=True, encoding='utf-8', xml_declaration=True)
        return content
def _fix_nav_css_links ( self , content ) : root = ebooklib . utils . parse_string ( content ) for element in root . iter ( '{%s}link' % NAMESPACES [ 'XHTML' ] ) : href = urllib . unquote ( element . get ( 'href' ) ) if href . startswith ( '../%s' % STYLES_DIR ) : file_name = os . path . basename ( href ) element . set ( 'href' , '{}/{}' . format ( STYLES_DIR , file_name ) ) content = etree . tostring ( root , pretty_print = True , encoding = 'utf-8' , xml_declaration = True ) return content