aboutsummaryrefslogtreecommitdiffstats
path: root/doc/make-authors-format.pl
blob: f5124a117e2c6344e0a114800224b337536e62bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Convert AUTHORS-SHORT file for use in man page and HTML documentation
# after processing through pod2man and pod2html.
#
# Must be called via perlnoutf.
#
# Copyright 2004 Graeme Hewson <ghewson@wormhole.me.uk>
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# SPDX-License-Identifier: GPL-2.0-or-later
#

use strict;

# This might not be necessary.
print "=for html <style>div#authors pre, div#authors pre code { white-space: pre-wrap; }</style>\n\n";
print "=for html <div id=authors>\n\n";

print "=for man .nf\n\n";

while (<>) {
	printline();
}

print "\n=for html </div>\n";
print "\n=for man .fi\n";

sub printline {
	my $line = shift || $_;

	if ($line =~ /^=/) {
		#
		# Convert Asciidoctor-style headings to Pod.
		#
		$line =~ s/^= /=head2 /;
		$line =~ s/\s*=+$//;
		print $line;
		return;
	}

	if ($line =~ /<\S+\[AT\]\S+>$/i or $line =~ /address removed.*\)/) {
		# Make the author lists verbatim paragraphs.
		$line = "    " . $line;
	}

	if ($line =~ /^and by:/) {
		# This needs to be a regular paragraph.
		$line = "\n" . $line;
	}

	print $line;
}