diff options
Diffstat (limited to 'buildtools/makeman')
-rwxr-xr-x | buildtools/makeman | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/buildtools/makeman b/buildtools/makeman index 94ee2172..538accad 100755 --- a/buildtools/makeman +++ b/buildtools/makeman @@ -24,6 +24,13 @@ # # By Eric S. Raymond <esr@thyrsus.com> # Version 1.0, July 26 2004 +# +# Modified by Akira F. Urushibata <afu@wta.att.ne.jp> +# Version 1.1, February 11 2016 +# +# Added ability to process — − +# Added footer message to clarify original source. +# import os, sys, exceptions, re @@ -37,6 +44,12 @@ warning = r'''\ .\" against that, and send it to the Netpbm maintainer. ''' +footerprefix = '''.SH DOCUMENT SOURCE +This manual page was generated by the Netpbm tool 'makeman' from HTML +source. The master documentation is at +.IP +.B http://netpbm.sourceforge.net/doc/''' + class LiftException(exceptions.Exception): def __init__(self, message, retval=1): self.message = message @@ -56,6 +69,7 @@ def makeman(name, file, indoc): indoc = indoc.replace('<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/>', "") indoc = indoc.replace('<?xml version="1.1" encoding="iso-8859-1" ?>\n',"") indoc = indoc.replace('<html xmlns="http://www.w3.org/1999/xhtml">', "") + indoc = indoc.replace('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">', "") indoc = indoc.replace("<HEAD>", "").replace("</HEAD>", "") indoc = indoc.replace("<head>", "").replace("</head>", "") indoc = re.sub('(?i)<A HREF="#index">Table Of Contents</A>', "", indoc) @@ -92,6 +106,7 @@ def makeman(name, file, indoc): title = None indoc = titlematch.sub("", indoc) indoc = re.sub("(?i)\n*<BR>\n+", "\n", indoc) + indoc = re.sub("(?i)<BR>", "\n", indoc) indoc = ('.TH "%s" %d "%s" "%s"\n' % (title,section,date,source)) + indoc # Literal layout indoc = re.sub("(?i)\n *<PRE>", "\n.nf", indoc) @@ -203,11 +218,18 @@ def makeman(name, file, indoc): indoc = re.sub(r"<\?makeman (.*) \?>", r'\1', indoc) # Comments indoc = re.sub("<!--([^\n])*-->", r'.\"\1', indoc) + # Acronyms + indoc = re.sub('<acronym [a-zA-Z0-9:= \n"]*>', "", indoc) + indoc = re.sub("</acronym>", "", indoc) # Image tags indoc = re.sub(' *<img src="([^"]*)" alt="([^"]*)"( *[a-z]*="?[0-9]*"?)*>', ".B \\2\n.IMG -C \\1", indoc) # Special characters indoc = indoc.replace(""", "'") indoc = indoc.replace(" ", "\\ ") + indoc = indoc.replace("−", "-") + indoc = indoc.replace("—", "-") + indoc = indoc.replace("μ", "mu") + indoc = indoc.replace("σ", "sigma") # Tables indoc = re.sub(' *<table[^>]*>.*', ".TS", indoc) indoc = re.sub(" *</table>.*", ".TE", indoc) @@ -241,6 +263,7 @@ def makeman(name, file, indoc): indoc = indoc.replace("\n@%@%@", "\n\\&.") # Mark these generated pages so people won't hand-hack them. indoc = warning + indoc + indoc = indoc + footerprefix + os.path.basename(file) +"\n.PP" return indoc def main(args, mainout=sys.stdout, mainerr=sys.stderr): |