Commits

Georg Brandl committed 29be82a

#521: Added :confval:`linkcheck_ignore` config value.

Comments (0)

Files changed (4)

 * 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)
 ============================
    .. 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

sphinx/builders/linkcheck.py

     :license: BSD, see LICENSE for details.
 """
 
+import re
 import socket
 from os import path
 from urllib2 import build_opener, HTTPError
     name = 'linkcheck'
 
     def init(self):
+        self.to_ignore = map(re.compile, self.app.config.linkcheck_ignore)
         self.good = set()
         self.broken = {}
         self.redirected = {}
 
         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)
 
         texinfo_appendices = ([], None),
         texinfo_elements = ({}, None),
         texinfo_domain_indices = (True, None),
+
+        # linkcheck options
+        linkcheck_ignore = ([], None),
     )
 
     def __init__(self, dirname, filename, overrides, tags):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.