diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-11-30 03:41:18 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-11-30 03:41:18 +0000 |
commit | c4f297c6821058060b3f8bafdd455a9ddf57e389 (patch) | |
tree | 4e637c2987fa95bd21637c30df88d211b88603cf /buildtools | |
parent | cf64d628b00f75d14bc13d51767659efb7ac9a88 (diff) | |
download | netpbm-mirror-c4f297c6821058060b3f8bafdd455a9ddf57e389.tar.gz netpbm-mirror-c4f297c6821058060b3f8bafdd455a9ddf57e389.tar.xz netpbm-mirror-c4f297c6821058060b3f8bafdd455a9ddf57e389.zip |
Slightly improve formatting of man pages
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2842 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'buildtools')
-rwxr-xr-x | buildtools/makeman | 24 |
1 files changed, 12 insertions, 12 deletions
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)?<A[ \n]+HREF="?([^>]+.html)"?>([^<]+)</A>(?:\\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(' *<table[^>]*>.*', ".TS", indoc) - indoc = re.sub(" *</table>.*", ".TE", indoc) + indoc = re.sub('(?i) *<table[^>]*>.*', ".TS", indoc) + indoc = re.sub("(?i) *</table>.*", ".TE", indoc) # First the single-line case - indoc = re.sub("</td> *<td>", "\t", indoc) - indoc = re.sub("<tr> *<td>", "", indoc) - indoc = re.sub("</td> *</tr>", "", indoc) + indoc = re.sub("(?i)</td> *<td>", "\t", indoc) + indoc = re.sub("(?i)<tr> *<td>", "", indoc) + indoc = re.sub("(?i)</td> *</tr>", "", indoc) # Then the multiline case - indoc = re.sub(r'\s*<t[hd][^>]*>([^<\n]*)</t[dh]>\s*', '\t\\1', indoc) - indoc = re.sub(r'\s*<t[hd][^>]*>([^<]*)</t[dh]>\s*', '\tT{\n\\1T}', indoc) + indoc = re.sub(r'(?i)\s*<t[hd][^>]*>([^<\n]*)</t[dh]>\s*', '\t\\1', indoc) + indoc = re.sub(r'(?i)\s*<t[hd][^>]*>([^<]*)</t[dh]>\s*', '\tT{\n\\1T}', indoc) indoc = indoc.replace("\n\\&T}", "\nT}") - indoc = re.sub(" *</tr>", "", indoc) - indoc = re.sub(" *<tr[^>]*>\t*", "", indoc) - indoc = re.sub(r"\.TS\s+<caption>([^<]*)</caption>\s*", ".B \\1\n.TS\n", indoc) + indoc = re.sub("(?i) *</tr>", "", indoc) + indoc = re.sub("(?i) *<tr[^>]*>\t*", "", indoc) + indoc = re.sub(r"\.TS\s+<[Cc][Aa][Pp][Tt][Ii][Oo][Nn]>([^<]*)</[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'(?<!^\\)&.*;', line): badlines.append(line) if badlines: sys.stderr.write(("Bad lines from %s:\n-----------------\n" % file) + "\n".join(badlines) + "\n-----------------\n") |