Commit cda8ebbf authored by Denis Bilenko's avatar Denis Bilenko

mysphinxext.py: control noisiness level via variable

parent 2036caa0
......@@ -2,7 +2,7 @@ from sphinx.ext.autodoc import cut_lines
from sphinx.ext import intersphinx
from docutils import nodes
noisy = False
noisy = 0
message_cache = set()
def missing_reference(app, env, node, contnode):
......@@ -31,18 +31,20 @@ def missing_reference(app, env, node, contnode):
newnode['class'] = 'external-xref'
newnode.append(contnode)
msg = 'Resolved missing-reference: :%5s:`%s` -> %s' % (type, target, refuri)
if msg not in message_cache:
if noisy >= 1 or msg not in message_cache:
print msg
message_cache.add(msg)
return newnode
#print [type, target, modname, classname]
if noisy >= 1:
print 'Looking for %s' % [type, target, modname, classname]
print node
for docname, items in env.indexentries.iteritems():
if noisy:
if noisy >= 2:
print docname
for (i_type, i_string, i_target, i_aliasname) in items:
if noisy:
if noisy >= 3:
print '---', [i_type, i_string, i_target, i_aliasname]
if i_aliasname.endswith(target):
stripped_aliasname = i_aliasname[len(docname):]
......@@ -50,7 +52,7 @@ def missing_reference(app, env, node, contnode):
assert stripped_aliasname[0] == '.', repr(stripped_aliasname)
stripped_aliasname = stripped_aliasname[1:]
if stripped_aliasname == target:
if noisy:
if noisy >= 1:
print '--- found %s %s in %s' % (type, target, i_aliasname)
return new_reference(docname + '.html#' + i_aliasname, i_aliasname)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment