From c4f297c6821058060b3f8bafdd455a9ddf57e389 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 30 Nov 2016 03:41:18 +0000 Subject: Slightly improve formatting of man pages git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2842 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- buildtools/makeman | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'buildtools') diff --git a/buildtools/makeman b/buildtools/makeman index 538accad..13c54a70 100755 --- a/buildtools/makeman +++ b/buildtools/makeman @@ -160,7 +160,7 @@ def makeman(name, file, indoc): if xrefsection == 0: return "\n.I " + xrefto else: - return "\n.BR %s (%d)\n" % (xrefto, xrefsection) + return '\n.BR "%s" (%d)\\c\n\\&' % (xrefto, xrefsection) indoc = re.sub(r'(?i)\n* *(?:\\fB)?([^<]+)(?:\\fP)?', xrefmatch, indoc) # Format URLs @@ -231,25 +231,25 @@ def makeman(name, file, indoc): indoc = indoc.replace("μ", "mu") indoc = indoc.replace("σ", "sigma") # Tables - indoc = re.sub(' *]*>.*', ".TS", indoc) - indoc = re.sub(" *.*", ".TE", indoc) + indoc = re.sub('(?i) *]*>.*', ".TS", indoc) + indoc = re.sub("(?i) *.*", ".TE", indoc) # First the single-line case - indoc = re.sub(" *", "\t", indoc) - indoc = re.sub(" *", "", indoc) - indoc = re.sub(" *", "", indoc) + indoc = re.sub("(?i) *", "\t", indoc) + indoc = re.sub("(?i) *", "", indoc) + indoc = re.sub("(?i) *", "", indoc) # Then the multiline case - indoc = re.sub(r'\s*]*>([^<\n]*)\s*', '\t\\1', indoc) - indoc = re.sub(r'\s*]*>([^<]*)\s*', '\tT{\n\\1T}', indoc) + indoc = re.sub(r'(?i)\s*]*>([^<\n]*)\s*', '\t\\1', indoc) + indoc = re.sub(r'(?i)\s*]*>([^<]*)\s*', '\tT{\n\\1T}', indoc) indoc = indoc.replace("\n\\&T}", "\nT}") - indoc = re.sub(" *", "", indoc) - indoc = re.sub(" *]*>\t*", "", indoc) - indoc = re.sub(r"\.TS\s+([^<]*)\s*", ".B \\1\n.TS\n", indoc) + indoc = re.sub("(?i) *", "", indoc) + indoc = re.sub("(?i) *]*>\t*", "", indoc) + indoc = re.sub(r"\.TS\s+<[Cc][Aa][Pp][Tt][Ii][Oo][Nn]>([^<]*)\s*", ".B \\1\n.TS\n", indoc) # Debugging #sys.stderr.write("Name: %s, Title: %s, Date: %s\n" % (name, title, date)) # Time for error checking now badlines = [] for line in indoc.split("\n"): - if "<" in line or ">" in line.replace(" >", "") or re.search("&.*;", line): + if "<" in line or ">" in line.replace(" >", "") or re.search(r'(?