diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-12-09 04:20:10 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-12-09 04:20:10 +0000 |
commit | 823e2b9df17dd39a069a71fdbf08771c7b224c74 (patch) | |
tree | 12548e6811bea58022a429f05b43954e49019a1e /buildtools | |
parent | f1bc42a9e016267c93c8fb11d9ee7d3d663f8b62 (diff) | |
download | netpbm-mirror-823e2b9df17dd39a069a71fdbf08771c7b224c74.tar.gz netpbm-mirror-823e2b9df17dd39a069a71fdbf08771c7b224c74.tar.xz netpbm-mirror-823e2b9df17dd39a069a71fdbf08771c7b224c74.zip |
some fixes or enhancements - I don't know
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1037 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'buildtools')
-rwxr-xr-x | buildtools/makeman | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/buildtools/makeman b/buildtools/makeman index 2e122779..100ad580 100755 --- a/buildtools/makeman +++ b/buildtools/makeman @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/python # # makeman -- compile netpbm's stereotyped HTML to troff markup # @@ -121,7 +121,10 @@ def makeman(name, file, indoc): indoc = re.sub("(?i)</SUP>", r"\\d", indoc) # Paragraph handling indoc = re.sub("(?i)\n*<P>\n*", r"\n.PP\n", indoc) + indoc = re.sub("(?i)<br */>", r"\n.PP\n", indoc) indoc = re.sub("(?i)</P>", "", indoc) + indoc = re.sub("(?i)<!--[^>]*-->", "", indoc) + indoc = re.sub("(?i)<meta[^>]*>", "", indoc) lines = indoc.split("\n") listdepth = 0 for i in range(len(lines)): @@ -138,13 +141,14 @@ def makeman(name, file, indoc): indoc = re.sub('(?i)<A[ \n]+HREF="mailto:[^>]+">([^<]+)</A>', r'\\fI\1\\fP', indoc) # Format manual crossreferences def xrefmatch(match): - xrefto = match.group(1) - xrefsection = sectmap.get(xrefto, 1) + xrefto = match.group(2) + xrefurl = match.group(1) + xrefsection = sectmap.get(xrefurl, 1) if xrefsection == 0: return "\n.I " + xrefto else: - return "\n.BR %s (%d)" % (xrefto, xrefsection) - indoc = re.sub(r'(?i)\n* *(?:\\fB)?<A[ \n]+HREF="[^>]+.html">([^<]+)</A>(?:\\fP)?', + return "\n.BR %s (%d)\n" % (xrefto, xrefsection) + indoc = re.sub(r'(?i)\n* *(?:\\fB)?<A[ \n]+HREF="?([^>]+.html)"?>([^<]+)</A>(?:\\fP)?', xrefmatch, indoc) # Format URLs def urlmatch(match): @@ -159,7 +163,7 @@ def makeman(name, file, indoc): indoc = indoc.replace("®", r"\*R") indoc = indoc.replace("©", r"\(co") # Turn anchors into .UN tags - indoc = re.sub('(?i)<A NAME *= *"#?([a-zA-Z][a-zA-Z0-9.-]+)">(?: )*</A>\s*', ".UN \\1\n", indoc) + indoc = re.sub('(?i)<A NAME *= *"#?([a-zA-Z_][a-zA-Z_0-9.-]+)">(?: )*</A>\s*', ".UN \\1\n", indoc) # Strip off the index trailer trailer = re.compile('<HR */*>.*', re.DOTALL | re.IGNORECASE) indoc = re.sub(trailer, "", indoc) |