explicit_type = type
new_name = name
- if type != 'ref' and type == manual and not commented_out and useful_fix:
- bad_ref = True
- stdout.write ("\n%s: %d: `%s': external %s x-ref should be internal\n"
- % (file, line, name, type))
- if options.auto_fix or yes_prompt ("Fix this?"):
- type = 'ref'
+ if type != 'ref' and type == manual and not commented_out:
+ if useful_fix:
+ fixed = False
+ bad_ref = True
+ stdout.write ("\n%s: %d: `%s': external %s x-ref should be internal\n"
+ % (file, line, name, type))
+ if options.auto_fix or yes_prompt ("Fix this?"):
+ type = 'ref'
if type == 'ref':
explicit_type = manual
fixed = False
stdout.write ('\n')
if type == 'ref':
- stdout.write ("%s: %d: `%s': wrong internal x-ref\n"
+ stdout.write ("\e[1;31m%s: %d: `%s': wrong internal x-ref\e[0m\n"
% (file, line, name))
else:
- stdout.write ("%s: %d: `%s': wrong external `%s' x-ref\n"
+ stdout.write ("\e[1;31m%s: %d: `%s': wrong external `%s' x-ref\e[0m\n"
% (file, line, name, type))
# print context
stdout.write ('--\n' + manuals[manual]['contents'][file]
if name in manuals[k]['nodes']:
if k == manual:
found = ['ref']
- stdout.write (" found as internal x-ref\n")
+ stdout.write ("\e[1;32m found as internal x-ref\e[0m\n")
break
else:
found.append (k)
- stdout.write (" found as `%s' x-ref\n" % k)
+ stdout.write ("\e[1;32m found as `%s' x-ref\e[0m\n" % k)
if (len (found) == 1
and (options.auto_fix or yes_prompt ("Fix this x-ref?"))):
if new_name == name:
if bad_ref and (options.interactive or options.auto_fix):
# only the type of the ref was fixed
- fixes_count += 1
+ fixes_count += int (fixed)
if original_display_name:
return ('@%snamed{%s,%s}' % (type, original_name, original_display_name)) + next_char
else:
return ('@%s{%s}' % (type, original_name)) + next_char
else:
- fixes_count += 1
+ fixes_count += int (fixed)
(ref, n) = preserve_linebreak (new_name, linebroken)
if original_display_name:
if bad_ref:
log.write ("Operation refused by user: %s\nExiting.\n" % instance)
sys.exit (3)
-log.write ("Done: %d x-refs found, %d bad x-refs found, fixed %d.\n" %
+log.write ("\e[1;36mDone: %d x-refs found, %d bad x-refs found, fixed %d.\e[0m\n" %
(refs_count, bad_refs_count, fixes_count))