]> git.pld-linux.org Git - packages/ntp.git/blame - ntp-4.2.4-html2man.patch
- if 0 instead
[packages/ntp.git] / ntp-4.2.4-html2man.patch
CommitLineData
6fca7355
ER
1--- ntp-4.2.4/scripts/html2man.in.html2man 2006-06-06 22:17:10.000000000 +0200
2+++ ntp-4.2.4/scripts/html2man.in 2007-01-08 12:47:31.000000000 +0100
3@@ -23,10 +23,12 @@ $MANDIR = "./man";
4 'ntpq' => ['ntpq', 8, 'ntpd(8), ntpdc(8)'],
5 'ntpdate' => ['ntpdate', 8, 'ntpd(8)'],
6 'ntpdc' => ['ntpdc', 8, 'ntpd(8)'],
7- 'ntptime' => ['ntpdtime', 8, 'ntpd(8), ntpdate(8)'],
8+ 'ntptime' => ['ntptime', 8, 'ntpd(8), ntpdate(8)'],
9 'ntptrace' => ['ntptrace', 8, 'ntpd(8)'],
10+ 'ntp-wait' => ['ntp-wait', 8, 'ntpd(8)'],
11 'keygen' => ['ntp-keygen', 8, 'ntpd(8), ntp_auth(5)'],
12- 'confopt' => ['ntp.conf', 5, 'ntpd(8)'],
13+ 'tickadj' => ['tickadj', 8, 'ntpd(8)'],
14+ 'confopt' => ['ntp.conf', 5, 'ntpd(8), ntp_auth(5), ntp_mon(5), ntp_acc(5), ntp_clock(5), ntp_misc(5)'],
15 'authopt' => ['ntp_auth', 5, 'ntp.conf(5), ntpd(8)'],
16 'monopt' => ['ntp_mon', 5, 'ntp.conf(5)'],
17 'accopt' => ['ntp_acc', 5, 'ntp.conf(5)'],
18@@ -34,17 +34,8 @@
19 'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']);
20
21 # Disclaimer to go in SEE ALSO section of the man page
22-$seealso_disclaimer = 'These man pages are automatically hacked from the main NTP ' .
23- 'documentation pages, which are maintained in HTML format. These files are ' .
24- 'included in the NTP source distribution. If you installed NTP from a binary ' .
25- 'package, or it came pre-installed on your system, chances are the documentation ' .
26- 'was also included in the usual place for your system. The HTML files are more ' .
27- 'correct and complete than these man pages, which are provided for your reference ' .
28- 'only.';
29-
30-# Disclaimer to go right at the top
31-$top_disclaimer = 'This file was automatically generated from HTML source, and may be ' .
32- 'incorrect. See the SEE ALSO section at the end of this file for more info';
33+$seealso_disclaimer = "Primary source of documentation: /usr/share/doc/ntp-*\n\n" .
34+ "This file was automatically generated from HTML source.\n";
35
36 mkdir $MANDIR, 0777;
37 mkdir "$MANDIR/man8", 0777;
38@@ -64,7 +55,8 @@
39 $fileinfo = $manfiles{$filename};
40
41 $p = HTML::TokeParser->new("$filename.html") || die "Can't open $filename.html: $!";
42- open(MANOUT, ">$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]")
43+ $fileout = "$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]";
44+ open(MANOUT, ">$fileout")
45 || die "Can't open: $!";
46
47 $p->get_tag("title");
48@@ -73,7 +65,6 @@
49
50 # Setup man header
51 print MANOUT ".TH " . $fileinfo->[0] . " " . $fileinfo->[1] . "\n";
52- print MANOUT ".UC 4\n";
53 print MANOUT ".SH NAME\n";
54 $pat = $fileinfo->[0];
55 if ($name =~ /$pat/) {
56@@ -81,10 +72,12 @@
57 # Add the manpage name, if not in the HTML title already
58 print MANOUT "$fileinfo->[0] - ";
59 }
60- print MANOUT "$name\n\n";
61-
62- print MANOUT "$top_disclaimer\n";
63+ print MANOUT "$name\n.SH \\ \n\n";
64
65+ @fontstack = ();
66+ $deflevel = 0;
67+ $pre = 0;
68+ $ignore = 0;
69 # Now start scanning. We basically print everything after translating some tags.
70 # $token->[0] has "T", "S", "E" for Text, Start, End
71 # $token->[1] has the tag name, or text (for "T" case)
72@@ -92,19 +85,37 @@
73 while (my $token = $p->get_token) {
74 if($token->[0] eq "T") {
75 my $text = $token->[1];
76- if($tag) {
77- $text =~ s/^[\n ]*//;
78- $text =~ s/[\n ]*$/ /;
79+ if (!$pre) {
80+ if($tag) {
81+ $text =~ s/^[\n\t ]*//;
82+ }
83+ $text =~ s/^[\n\t ][\n\t ]+$//;
84+ $text =~ s/[\n\t ]+/ /g;
85+ $text =~ s/&nbsp\;/ /g;
86+ $text =~ s/&gt\;/>/g;
87+ $text =~ s/&lt\;/</g;
88+ $text =~ s/&quot\;/"/g;
89+ $text =~ s/&amp\;/&/g;
90+ $text =~ s/^\./\\[char46]/;
91 }
92- $text =~ s/&nbsp\;/ /g;
93- $text =~ s/^\./\\./;
94 print MANOUT "$text";
95 $tag = 0;
96 }
97 if($token->[0] eq "S") {
98 if($token->[1] eq "h4") {
99 my $text = uc($p->get_trimmed_text("/h4"));
100- print MANOUT ".SH $text\n";
101+ # ignore these two sections in ntpd.html
102+ if ($filename eq "ntpd" &&
103+ ($text eq "FILES" || $text eq "CONFIGURATION OPTIONS")) {
104+ $ignore = 1;
105+ close(MANOUT);
106+ open(MANOUT, ">/dev/null");
107+ } elsif ($ignore) {
108+ $ignore = 0;
109+ close(MANOUT);
110+ open(MANOUT, ">>$fileout");
111+ }
112+ print MANOUT "\n\n.SH $text\n";
113 }
114 if($token->[1] eq "tt") {
115 push @fontstack, "tt";
116@@ -118,22 +129,30 @@
117 my $text = $p->get_trimmed_text("/address");
118 print MANOUT "\n.SH AUTHOR\n$text\n";
119 }
120- if($token->[1] eq "dt") {
121- $tmp = $deflevel-4;
122- print MANOUT "\n.RS $tmp\n";
123+ if($token->[1] eq "dt" || $token->[1] eq "br" && $deflevel > 0) {
124+ print MANOUT "\n.TP 8\n";
125 $tag = 1;
126 }
127 if($token->[1] eq "dd") {
128- print MANOUT "\n.RS $deflevel\n";
129+ print MANOUT "\n";
130 $tag = 1;
131 }
132 if($token->[1] eq "dl") {
133- $deflevel+=4;
134+ $deflevel+=1;
135+ if ($deflevel > 0) {
136+ print MANOUT "\n.RS ", $deflevel > 1 ? 8 : 0;
137+ }
138+ }
139+ if($token->[1] eq "p") {
140+ print MANOUT "\n";
141+ }
142+ if($token->[1] eq "pre") {
143+ print MANOUT "\n.nf";
144+ $pre = 1;
145 }
146 }
147 elsif($token->[0] eq "E") {
148- if($token->[1] eq "dd") {
149- print MANOUT "\n.RE\n";
150+ if($token->[1] eq "h4") {
151 $tag = 1;
152 }
153 if($token->[1] eq "tt") {
154@@ -157,15 +176,27 @@
155 print MANOUT "$fontswitch";
156 }
157 if($token->[1] eq "dl") {
158- $deflevel-=4;
159+ if ($deflevel > 0) {
160+ print MANOUT "\n.RE";
161+ }
162+ print MANOUT "\n";
163+ $deflevel-=1;
164 }
165- if($token->[1] eq "dt") {
166- print MANOUT "\n.RE";
167+ if($token->[1] eq "p") {
168+ print MANOUT "\n";
169 $tag = 1;
170 }
171+ if($token->[1] eq "pre") {
172+ print MANOUT "\n.fi";
173+ $pre = 0;
174+ }
175 }
176 }
177- print MANOUT ".SH SEE ALSO\n\n";
178+ if ($ignore) {
179+ close(MANOUT);
180+ open(MANOUT, ">>$fileout");
181+ }
182+ print MANOUT "\n.SH SEE ALSO\n\n";
183 print MANOUT "$fileinfo->[2]\n\n";
184 print MANOUT "$seealso_disclaimer\n";
185 close(MANOUT);
This page took 0.077543 seconds and 4 git commands to generate.