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