Commits

Georg Brandl committed 7473a3e

#391: do not report local links as "malformed" in the linkcheck builder.

  • Participants
  • Parent commits 9119678

Comments (0)

Files changed (1)

sphinx/builders/linkcheck.py

 from docutils import nodes
 
 from sphinx.builders import Builder
-from sphinx.util.console import purple, red, darkgreen
+from sphinx.util.console import purple, red, darkgreen, darkgray
 
 # create an opener that will simulate a browser user-agent
 opener = build_opener()
                 break
             lineno = node.line
 
+        if len(uri) == 0 or uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:':
+            return
+
+        if lineno:
+            self.info('(line %3d) ' % lineno, nonl=1)
         if uri[0:5] == 'http:' or uri[0:6] == 'https:':
-            if lineno:
-                self.info('(line %3d) ' % lineno, nonl=1)
             self.info(uri, nonl=1)
 
             if uri in self.broken:
                 self.write_entry('redirected', docname,
                                  lineno, uri + ' to ' + s)
                 self.redirected[uri] = (r, s)
-        elif len(uri) == 0 or uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:':
-            return
         else:
-            self.warn(uri + ' - ' + red('malformed!'))
-            self.write_entry('malformed', docname, lineno, uri)
-            if self.app.quiet:
-                self.warn('malformed link: %s' % uri,
-                          '%s:%s' % (self.env.doc2path(docname), lineno))
-            self.app.statuscode = 1
+            self.info(uri + ' - ' + darkgray('local'))
+            self.write_entry('local', docname, lineno, uri)
 
         if self.broken:
             self.app.statuscode = 1