mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-07 16:10:58 +00:00
Make sure ignore URL patterns take precedence over nofollow URL patterns.
This commit is contained in:
parent
eaa2b79bc3
commit
2d55c87429
4 changed files with 11 additions and 8 deletions
|
|
@ -5,6 +5,9 @@ Fixes:
|
|||
- checking: Correctly detect empty FTP paths as directories.
|
||||
- checking: Reuse connections more than once and ensure they are
|
||||
closed before expiring.
|
||||
- checking: Make sure "ignore" URL patterns are checked before
|
||||
"nofollow" URL patterns.
|
||||
Closes: SF bug #3184973
|
||||
- gui: Remove old context menu action to view URL properties.
|
||||
- gui: Disable viewing of parent URL source if it's a directory.
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ def get_link_pat (arg, strict=False):
|
|||
@return: dictionary with keys 'pattern', 'negate' and 'strict'
|
||||
@rtype: dict
|
||||
"""
|
||||
log.debug(LOG_CHECK, "Link pattern %r", arg)
|
||||
log.debug(LOG_CHECK, "Link pattern %r strict=%s", arg, strict)
|
||||
if arg.startswith('!'):
|
||||
pattern = arg[1:]
|
||||
negate = True
|
||||
|
|
|
|||
|
|
@ -191,10 +191,6 @@ class LCConfigParser (ConfigParser.RawConfigParser, object):
|
|||
Read configuration options in section "filtering".
|
||||
"""
|
||||
section = "filtering"
|
||||
if self.has_option(section, "nofollow"):
|
||||
for line in read_multiline(self.get(section, "nofollow")):
|
||||
pat = get_link_pat(line, strict=0)
|
||||
self.config["externlinks"].append(pat)
|
||||
if self.has_option(section, "ignorewarnings"):
|
||||
self.config['ignorewarnings'] = [f.strip() for f in \
|
||||
self.get(section, 'ignorewarnings').split(',')]
|
||||
|
|
@ -202,6 +198,10 @@ class LCConfigParser (ConfigParser.RawConfigParser, object):
|
|||
for line in read_multiline(self.get(section, "ignore")):
|
||||
pat = get_link_pat(line, strict=1)
|
||||
self.config["externlinks"].append(pat)
|
||||
if self.has_option(section, "nofollow"):
|
||||
for line in read_multiline(self.get(section, "nofollow")):
|
||||
pat = get_link_pat(line, strict=0)
|
||||
self.config["externlinks"].append(pat)
|
||||
if self.has_option(section, "internlinks"):
|
||||
pat = get_link_pat(self.get(section, "internlinks"))
|
||||
self.config["internlinks"].append(pat)
|
||||
|
|
|
|||
|
|
@ -605,13 +605,13 @@ if options.warnings is not None:
|
|||
config["warnings"] = options.warnings
|
||||
if options.anchors is not None:
|
||||
config["anchors"] = options.anchors
|
||||
if options.extern:
|
||||
pats = [linkcheck.get_link_pat(arg) for arg in options.extern]
|
||||
config["externlinks"].extend(pats)
|
||||
if options.externstrict:
|
||||
pats = [linkcheck.get_link_pat(arg, strict=True) \
|
||||
for arg in options.externstrict]
|
||||
config["externlinks"].extend(pats)
|
||||
if options.extern:
|
||||
pats = [linkcheck.get_link_pat(arg) for arg in options.extern]
|
||||
config["externlinks"].extend(pats)
|
||||
if options.output:
|
||||
if "/" in options.output:
|
||||
logtype, encoding = options.output.split("/", 1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue