mf2util.py
def convert_relative_paths_to_absolute(source_url, base_href, html):
    """Attempt to convert relative paths in foreign content
    to absolute based on the source url of the document. Useful for
    displaying images or links in reply contexts and comments.

    Gets list of tags/attributes from `URL_ATTRIBUTES`. Note that this
    function uses a regular expression to avoid adding a library
    dependency on a proper parser.

    :param str source_url: the source of the parsed document.
    :param str html: the text of the source document
    :return: the document with relative urls replaced with absolute ones
    """
    def do_convert(match):
        base_url = urljoin(source_url, base_href) if base_href else source_url
        return (match.string[match.start(0):match.start(1)] +
                urljoin(base_url, match.group(1)) +
                match.string[match.end(1):match.end(0)])

    if source_url:
        for tagname, attributes in URL_ATTRIBUTES.items():
            for attribute in attributes:
                pattern = re.compile(
                    '<%s[^>]*?%s\s*=\s*[\'"](.*?)[\'"]' % (tagname, attribute),
                    flags=re.DOTALL | re.MULTILINE | re.IGNORECASE)
                html = pattern.sub(do_convert, html)

    return html
Attempt to convert relative paths in foreign content
    to absolute based on the source url of the document. Useful for
    displaying images or links in reply contexts and comments.

    Gets list of tags/attributes from `URL_ATTRIBUTES`. Note that this
    function uses a regular expression to avoid adding a library
    dependency on a proper parser.

    :param str source_url: the source of the parsed document.
    :param str html: the text of the source document
    :return: the document with relative urls replaced with absolute ones
    
Attempt to convert relative paths in foreign content
to absolute based on the source url of the document. Useful for
displaying images or links in reply contexts and comments.

Gets list of tags/attributes from `URL_ATTRIBUTES`. Note that this
function uses a regular expression to avoid adding a library
dependency on a proper parser.
Attempt to convert relative paths in foreign content to absolute based on the source url of the document . Useful for displaying images or links in reply contexts and comments . Gets list of tags / attributes from ` URL_ATTRIBUTES ` . Note that this function uses a regular expression to avoid adding a library dependency on a proper parser .
def convert_relative_paths_to_absolute(source_url, base_href, html):
    def do_convert(match):
        base_url = urljoin(source_url, base_href) if base_href else source_url
        return (match.string[match.start(0):match.start(1)] +
                urljoin(base_url, match.group(1)) +
                match.string[match.end(1):match.end(0)])
    if source_url:
        for tagname, attributes in URL_ATTRIBUTES.items():
            for attribute in attributes:
                pattern = re.compile(
                    '<%s[^>]*?%s\s*=\s*[\'"](.*?)[\'"]' % (tagname, attribute),
                    flags=re.DOTALL | re.MULTILINE | re.IGNORECASE)
                html = pattern.sub(do_convert, html)
    return html
def convert_relative_paths_to_absolute ( source_url , base_href , html ) : def do_convert ( match ) : base_url = urljoin ( source_url , base_href ) if base_href else source_url return ( match . string [ match . start ( 0 ) : match . start ( 1 ) ] + urljoin ( base_url , match . group ( 1 ) ) + match . string [ match . end ( 1 ) : match . end ( 0 ) ] ) if source_url : for tagname , attributes in URL_ATTRIBUTES . items ( ) : for attribute in attributes : pattern = re . compile ( '<%s[^>]*?%s\s*=\s*[\'"](.*?)[\'"]' % ( tagname , attribute ) , flags = re . DOTALL | re . MULTILINE | re . IGNORECASE ) html = pattern . sub ( do_convert , html ) return html
Attempt to convert relative paths in foreign content
to absolute based on the source url of the document.
Attempt to convert relative paths in foreign content to absolute based on the source url of the document .
"""Attempt to convert relative paths in foreign content
    to absolute based on the source url of the document. Useful for
    displaying images or links in reply contexts and comments.

    Gets list of tags/attributes from `URL_ATTRIBUTES`. Note that this
    function uses a regular expression to avoid adding a library
    dependency on a proper parser.

    :param str source_url: the source of the parsed document.
    :param str html: the text of the source document
    :return: the document with relative urls replaced with absolute ones
    """
the document with relative urls replaced with absolute ones
the document with relative urls replaced with absolute ones
source_url
the source of the parsed document.
the source of the parsed document .
base_href
html
the text of the source document
the text of the source document