--- buildtools/makeman
+++ buildtools/makeman
@@ -1,4 +1,4 @@
-#!/bin/env python
+#!/usr/bin/python
#
# makeman -- compile netpbm's stereotyped HTML to troff markup
#
@@ -95,6 +95,8 @@
indoc = re.sub("(?i)\n *", "\n.fi", indoc)
indoc = re.sub("(?i)\n *
", "\n.nf", indoc)
indoc = re.sub("(?i)\n *
", "\n.fi", indoc)
+ indoc = re.sub("(?i)\n *", "\n.nf", indoc)
+ indoc = re.sub("(?i)\n *
", "\n.fi", indoc)
# Highlight processing
indoc = re.sub("(?i)", r"\\fB", indoc)
indoc = re.sub("(?i)", r"\\fP", indoc)
@@ -114,7 +116,10 @@
indoc = re.sub("(?i)", r"\\d", indoc)
# Paragraph handling
indoc = re.sub("(?i)\n*\n*", r"\n.PP\n", indoc)
+ indoc = re.sub("(?i)
", r"\n.PP\n", indoc)
indoc = re.sub("(?i)
", "", indoc)
+ indoc = re.sub("(?i)", "", indoc)
+ indoc = re.sub("(?i)]*>", "", indoc)
lines = indoc.split("\n")
listdepth = 0
for i in range(len(lines)):
@@ -131,13 +136,14 @@
indoc = re.sub('(?i)]+">([^<]+)', 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)?]+.html">([^<]+)(?:\\fP)?',
+ return "\n.BR %s (%d)\n" % (xrefto, xrefsection)
+ indoc = re.sub(r'(?i)\n* *(?:\\fB)?]+.html)"?>([^<]+)(?:\\fP)?',
xrefmatch, indoc)
# Format URLs
def urlmatch(match):
@@ -151,7 +157,7 @@
indoc = indoc.replace("×", r"\(mu")
indoc = indoc.replace("®", r"\*R")
# Turn anchors into .UN tags
- indoc = re.sub('(?i)(?: )*\s*', ".UN \\1\n", indoc)
+ indoc = re.sub('(?i)(?: )*\s*', ".UN \\1\n", indoc)
# Strip off the index trailer
trailer = re.compile('
.*', re.DOTALL | re.IGNORECASE)
indoc = re.sub(trailer, "", indoc)
@@ -159,17 +165,17 @@
indoc = indoc.replace("