X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fcheck_texi_refs.py;h=dff7e334f1ccc45d9e2ab039ef8b222ef8443a48;hb=5d3ad90b7bea98b61c01e00258360e234853aa9b;hp=4df33e68e7f8dfc21586d398c839aaa6ea067051;hpb=4cf1c1f0def359889bf9dc326cd6f7ec6edceecd;p=lilypond.git diff --git a/buildscripts/check_texi_refs.py b/buildscripts/check_texi_refs.py old mode 100755 new mode 100644 index 4df33e68e7..dff7e334f1 --- a/buildscripts/check_texi_refs.py +++ b/buildscripts/check_texi_refs.py @@ -360,12 +360,14 @@ not followed by punctuation\n" % (file, line, name)) 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 @@ -375,10 +377,10 @@ not followed by punctuation\n" % (file, line, name)) fixed = False stdout.write ('\n') if type == 'ref': - stdout.write ("%s: %d: `%s': wrong internal x-ref\n" + stdout.write ("%s: %d: `%s': wrong internal x-ref\n" % (file, line, name)) else: - stdout.write ("%s: %d: `%s': wrong external `%s' x-ref\n" + stdout.write ("%s: %d: `%s': wrong external `%s' x-ref\n" % (file, line, name, type)) # print context stdout.write ('--\n' + manuals[manual]['contents'][file] @@ -393,11 +395,11 @@ not followed by punctuation\n" % (file, line, name)) if name in manuals[k]['nodes']: if k == manual: found = ['ref'] - stdout.write (" found as internal x-ref\n") + stdout.write (" found as internal x-ref\n") break else: found.append (k) - stdout.write (" found as `%s' x-ref\n" % k) + stdout.write (" found as `%s' x-ref\n" % k) if (len (found) == 1 and (options.auto_fix or yes_prompt ("Fix this x-ref?"))): @@ -476,13 +478,13 @@ please fix the code source instead of generated documentation.\n") 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: @@ -515,5 +517,5 @@ except InteractionError, instance: 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 ("Done: %d x-refs found, %d bad x-refs found, fixed %d.\n" % (refs_count, bad_refs_count, fixes_count))