示例#1
0
def get_links(text):
    """Returns all distinct links in the text."""
    doc = view.get_doc(text)
    def is_link(e):
        return (e.type == 'element' and e.nodeName == 'a' and
                e.attribute_values.get('class', '') == 'internal')

    links = set()
    for a in doc.find(is_link):
        links.add(keyencode(a.attribute_values['href']))

    return links
示例#2
0
def get_links(text):
    """Returns all distinct links in the text."""
    doc = view.get_doc(text)
    def is_link(e):
        return e.type == 'element'      \
            and e.nodeName == 'a'       \
            and e.attribute_values.get('class', '') == 'internal'

    links = set()
    for a in doc.find(is_link):
        links.add(keyencode(a.attribute_values['href']))
    
    return links