mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#521: Added :confval:linkcheck_ignore
config value.
This commit is contained in:
parent
092a7173a1
commit
b72621c447
2
CHANGES
2
CHANGES
@ -21,6 +21,8 @@ Release 1.1 (in development)
|
||||
* Added ``inline`` option to graphviz directives, and fixed the
|
||||
default (block-style) in LaTeX output.
|
||||
|
||||
* #521: Added :confval:`linkcheck_ignore` config value.
|
||||
|
||||
|
||||
Release 1.0.4 (Sep 17, 2010)
|
||||
============================
|
||||
|
@ -1113,6 +1113,19 @@ These options influence Texinfo output.
|
||||
.. versionadded:: 1.1
|
||||
|
||||
|
||||
Options for the linkcheck builder
|
||||
---------------------------------
|
||||
|
||||
.. confval:: linkcheck_ignore
|
||||
|
||||
A list of regular expressions that match URIs that should not be checked
|
||||
when doing a ``linkcheck`` build. Example::
|
||||
|
||||
linkcheck_ignore = [r'http://localhost:\d+/']
|
||||
|
||||
.. versionadded:: 1.1
|
||||
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
.. [1] A note on available globbing syntax: you can use the standard shell
|
||||
|
@ -9,6 +9,7 @@
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import re
|
||||
import socket
|
||||
from os import path
|
||||
from urllib2 import build_opener, HTTPError
|
||||
@ -30,6 +31,7 @@ class CheckExternalLinksBuilder(Builder):
|
||||
name = 'linkcheck'
|
||||
|
||||
def init(self):
|
||||
self.to_ignore = map(re.compile, self.app.config.linkcheck_ignore)
|
||||
self.good = set()
|
||||
self.broken = {}
|
||||
self.redirected = {}
|
||||
@ -76,6 +78,10 @@ class CheckExternalLinksBuilder(Builder):
|
||||
|
||||
if lineno:
|
||||
self.info('(line %3d) ' % lineno, nonl=1)
|
||||
for rex in self.to_ignore:
|
||||
if rex.match(uri):
|
||||
self.info(uri + ' - ' + darkgray('ignored'))
|
||||
return
|
||||
if uri[0:5] == 'http:' or uri[0:6] == 'https:':
|
||||
self.info(uri, nonl=1)
|
||||
|
||||
|
@ -165,6 +165,9 @@ class Config(object):
|
||||
texinfo_appendices = ([], None),
|
||||
texinfo_elements = ({}, None),
|
||||
texinfo_domain_indices = (True, None),
|
||||
|
||||
# linkcheck options
|
||||
linkcheck_ignore = ([], None),
|
||||
)
|
||||
|
||||
def __init__(self, dirname, filename, overrides, tags):
|
||||
|
Loading…
Reference in New Issue
Block a user