Exemplo n.º 1
0
def generate(site):
    """Generate the list of external links to the given file descriptor."""
    # get all external links
    links = [ x
              for x in site.linkMap.values()
              if not x.isinternal ]
    # sort list
    links.sort(lambda a, b: cmp(a.url, b.url))
    # present results
    fp = plugins.open_html(plugins.external, site)
    if not links:
        fp.write(
          '   <p class="description">'
          '    No external links were found on the website.'
          '   </p>\n' )
        plugins.close_html(fp)
        return
    fp.write(
      '   <p class="description">'
      '    This is the list of all external urls encountered during the'
      '    examination of the website.'
      '   </p>\n'
      '   <ol>\n' )
    for link in links:
        fp.write(
          '    <li>\n'
          '     %(link)s\n'
          % { 'link':  plugins.make_link(link) })
        # present a list of parents
        plugins.print_parents(fp, link, '     ')
        fp.write(
          '    </li>\n')
    fp.write(
      '   </ol>\n' )
    plugins.close_html(fp)
Exemplo n.º 2
0
def generate(site):
    """Output the list of not checked pages to the given file descriptor."""
    # get all yanked urls
    links = [x for x in site.linkMap.values() if x.isyanked]
    links.sort(lambda a, b: cmp(a.url, b.url))
    # present results
    fp = plugins.open_html(plugins.notchkd, site)
    if not links:
        fp.write('   <p class="description">\n'
                 '    All links have been checked.\n'
                 '   </p>\n')
        plugins.close_html(fp)
        return
    fp.write(
        '   <p class="description">\n'
        '    This is the list of all urls that were encountered but not checked\n'
        '    at all during the examination of the website.\n'
        '   </p>\n'
        '   <ol>\n')
    for link in links:
        fp.write('    <li>\n'
                 '     %(link)s\n' %
                 {'link': plugins.make_link(link, link.url)})
        # present a list of parents
        plugins.print_parents(fp, link, '     ')
        fp.write('    </li>\n')
    fp.write('   </ol>\n')
    plugins.close_html(fp)
Exemplo n.º 3
0
def generate(site):
    """Output the list of not checked pages to the given file descriptor."""
    # get all yanked urls
    links = [ x
              for x in site.linkMap.values()
              if x.isyanked ]
    links.sort(lambda a, b: cmp(a.url, b.url))
    # present results
    fp = plugins.open_html(plugins.notchkd, site)
    if not links:
        fp.write(
          '   <p class="description">\n'
          '    All links have been checked.\n'
          '   </p>\n' )
        plugins.close_html(fp)
        return
    fp.write(
      '   <p class="description">\n'
      '    This is the list of all urls that were encountered but not checked\n'
      '    at all during the examination of the website.\n'
      '   </p>\n'
      '   <ol>\n')
    for link in links:
        fp.write(
          '    <li>\n'
          '     %(link)s\n'
          % { 'link': plugins.make_link(link, link.url) })
        # present a list of parents
        plugins.print_parents(fp, link, '     ')
        fp.write(
          '    </li>\n')
    fp.write(
      '   </ol>\n' )
    plugins.close_html(fp)
Exemplo n.º 4
0
def generate(site):
    """Generate the list of external links to the given file descriptor."""
    # get all external links
    links = [x for x in site.linkMap.values() if not x.isinternal]
    # sort list
    links.sort(lambda a, b: cmp(a.url, b.url))
    # present results
    fp = plugins.open_html(plugins.external, site)
    if not links:
        fp.write('   <p class="description">'
                 '    No external links were found on the website.'
                 '   </p>\n')
        plugins.close_html(fp)
        return
    fp.write('   <p class="description">'
             '    This is the list of all external urls encountered during the'
             '    examination of the website.'
             '   </p>\n'
             '   <ol>\n')
    for link in links:
        fp.write('    <li>\n'
                 '     %(link)s\n' % {'link': plugins.make_link(link)})
        # present a list of parents
        plugins.print_parents(fp, link, '     ')
        fp.write('    </li>\n')
    fp.write('   </ol>\n')
    plugins.close_html(fp)
Exemplo n.º 5
0
def generate(site):
    """Present the list of bad links to the given file descriptor."""
    # find all links with link problems
    links = [ x
              for x in site.linkMap.values()
              if len(x.linkproblems)>0 ]
    # sort list
    links.sort(lambda a, b: cmp(a.url, b.url))
    # present results
    fp = plugins.open_html(plugins.badlinks, site)
    if not links:
        fp.write(
          '   <p class="description">\n'
          '    There were no problems retrieving links from the website.\n'
          '   </p>\n'
          '   <ol>\n' )
        plugins.close_html(fp)
        return
    fp.write(
      '   <p class="description">\n'
      '    These links could not be retrieved during the crawling of the website.\n'
      '   </p>\n'
      '   <ol>\n' )
    for link in links:
        # list the link
        fp.write(
          '    <li>\n'
          '     %(badurl)s\n'
          '     <ul class="problems">\n'
          % { 'badurl':  plugins.make_link(link,link.url) })
        # list the problems
        for problem in link.linkproblems:
            fp.write(
              '      <li>%(problem)s</li>\n'
              % { 'problem':  plugins.htmlescape(problem) })
        fp.write(
          '     </ul>\n')
        # present a list of parents
        link.parents.sort()
        plugins.print_parents(fp, link, '     ')
        # add a reference to the problem map
        for problem in link.linkproblems:
            for parent in link.parents:
                parent.add_pageproblem('bad link: ' + link.url + ': ' + problem)
        fp.write(
          '    </li>\n')
    fp.write(
      '   </ol>\n' )
    plugins.close_html(fp)
Exemplo n.º 6
0
def generate(site):
    """Present the list of bad links to the given file descriptor."""
    # find all links with link problems
    links = [x for x in site.linkMap.values() if len(x.linkproblems) > 0]
    # sort list
    links.sort(lambda a, b: cmp(a.url, b.url))
    # present results
    fp = plugins.open_html(plugins.badlinks, site)
    if not links:
        fp.write(
            '   <p class="description">\n'
            '    There were no problems retrieving links from the website.\n'
            '   </p>\n'
            '   <ol>\n')
        plugins.close_html(fp)
        return
    fp.write(
        '   <p class="description">\n'
        '    These links could not be retrieved during the crawling of the website.\n'
        '   </p>\n'
        '   <ol>\n')
    for link in links:
        # list the link
        fp.write('    <li>\n'
                 '     %(badurl)s\n'
                 '     <ul class="problems">\n' %
                 {'badurl': plugins.make_link(link, link.url)})
        # list the problems
        for problem in link.linkproblems:
            fp.write('      <li>%(problem)s</li>\n' %
                     {'problem': plugins.htmlescape(problem)})
        fp.write('     </ul>\n')
        # present a list of parents
        link.parents.sort()
        plugins.print_parents(fp, link, '     ')
        # add a reference to the problem map
        for problem in link.linkproblems:
            for parent in link.parents:
                parent.add_pageproblem('bad link: ' + link.url + ': ' +
                                       problem)
        fp.write('    </li>\n')
    fp.write('   </ol>\n')
    plugins.close_html(fp)