diff options
| author | beatrice <beatrice@dangofactory.net> | 2026-11-22 19:19:03 +0900 |
|---|---|---|
| committer | beatrice <beatrice@dangofactory.net> | 2026-11-22 19:19:03 +0900 |
| commit | bd4611555e18fca7c66afaef0f094e15038b0459 (patch) | |
| tree | 1b1a9109567b61ac259ead146f4bef21a0f886df /mantools/man2html | |
| parent | 2324a9e97a727bf95690c9fb8fdca0f52301940e (diff) | |
| download | postfix-master.tar.gz postfix-master.zip | |
Release tarball postfix-3.11.7.tar.gz (dist-generated files / local differences from tag)HEADlocal/postfixmaster
Diffstat (limited to 'mantools/man2html')
| -rwxr-xr-x | mantools/man2html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mantools/man2html b/mantools/man2html new file mode 100755 index 000000000..139e58a1e --- /dev/null +++ b/mantools/man2html @@ -0,0 +1,62 @@ +#!/bin/sh + +# Crude script to convert formatted manpages to HTML. Requires GROFF_NO_SGR. + +while : +do + case $1 in + -t) title=$2; shift; shift;; + -*) echo "Usage: $0 [-t title] [file(s)]" 1>&2; exit 1;; + *) break;; + esac +done + +echo "<!doctype html public \"-//W3C//DTD HTML 4.01 Transitional//EN\" + \"https://www.w3.org/TR/html4/loose.dtd\"> +<html> <head> +<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> +<link rel='stylesheet' type='text/css' href='postfix-doc.css'> +<title> $title </title> +</head> <body> <pre>" + +#ESC=`echo x | tr '[x]' '[\033]'` + +sed ' + s/\([<>&]\)\1/\1/g + s/&/\&/g + s/_</\</g + s/<</\</g + s/</\</g + s/_>/\>/g + s/>>/\>/g + s/>/\>/g + s;_\([^_]\);<i>\1</i>;g + s;.\(.\);<b>\1</b>;g + + s;</i>\( *\)<i>;\1;g + s;</b>\( *\)<b>;\1;g + + # Skip the redundant readme/html_directory blurb. The + # document names that follow will be hyperlinked. + /^<b>README FILES/{ + h + N + N + g + } + + # Generate anchors for sections. + /^<b>\([A-Z][-_A-Z0-9 ]*\)<\/b>/{ + s//\1/ + s/[ ]*$// + h + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ /abcdefghijklmnopqrstuvwxyz_/ + s/^/<b><a name="/ + s/$/">/ + G + s/\n// + s;$;</a></b>; + } +' "$@" + +echo '</pre> </body> </html>' |
