Commits

Georg Brandl  committed 29be82a

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

  • Participants
  • Parent commits 100e8f4

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

File doc/config.rst

    .. 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

File 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)
 

File sphinx/config.py

         texinfo_appendices = ([], None),
         texinfo_elements = ({}, None),
         texinfo_domain_indices = (True, None),
+
+        # linkcheck options
+        linkcheck_ignore = ([], None),
     )
 
     def __init__(self, dirname, filename, overrides, tags):