3 # The beginning of the url for the anchors to the other sections.
5 $type="<A HREF=\"file://localhost".$wd."/";
9 @exclusions=("perldebug","perlform","perlobj","perlstyle","perltrap","perlmod");
12 @{$p->{"pods"}}=grep(/\.pod$/,readdir(DIR));
15 # learn the important stuff
17 foreach $tmpod (@{$p->{"pods"}}){
18 ($pod=$tmpod)=~s/\.pod$//;
19 $p->{"podnames"}->{$pod}=1;
20 next if grep(/$pod/,@exclusions);
23 s/B<([^<>]*)>/$1/g; # bold
24 s/I<([^<>]*)>/$1/g; # bold
28 ($cmd, $_) = split(' ', $_, 2);
30 ($what,$rest)=split(' ', $_, 2);
33 next if defined $p->{"items"}->{$what};
34 $p->{"items"}->{$what} = $pod."_".$i++;
36 elsif($cmd =~ /^head/){
38 next if defined($p->{"headers"}->{$_});
39 $p->{"headers"}->{$_} = $pod."_".$i++;
47 # parse the pods, produce html
48 foreach $tmpod (@{$p->{"pods"}}){
49 open(POD,"<$tmpod") || die "cant open $pod";
50 ($pod=$tmpod)=~s/\.pod$//;
51 open(HTML,">$pod.html");
52 print HTML "<!-- \$RCSfile\$\$Revision\$\$Date\$ -->\n";
53 print HTML "<!-- \$Log\$ -->\n";
54 print HTML "<HTML>\n";
55 print HTML "<TITLE> \U$pod\E </TITLE>\n";
63 length || (print "\n") && next;
64 # Translate verabatim paragraph
71 if($lines[0]=~/^\s+(\w*)\t(.*)/){ # listing or unordered list
73 if(defined($p->{"podnames"}->{$key})){
74 print HTML "\n<ul>\n";
78 print HTML "\n<listing>\n";
80 foreach $line (@lines){
81 ($line =~ /^\s+(\w*)\t(.*)/) && (($key,$rest)=($1,$2));
82 print HTML defined($p->{"podnames"}->{$key}) ?
83 "<li>$type$key.html\">$key<\/A>\t$rest\n" : "$line \n";
85 print HTML $unordered ? "</ul>\n" : "</listing>\n";
87 }else{ # preformatted text
94 print HTML "</pre>\n";
99 s/S<([^<>]*)>/$1/g; # embedded special
100 $_ = &Do_refs($_,$pod);
102 s/E<([^<>]*)>/\&$1\;/g; # embedded special
107 ($cmd, $_) = split(' ', $_, 2);
111 elsif ($cmd eq 'head1') {
112 print HTML qq{<h2>$_</h2>\n};
114 elsif ($cmd eq 'head2') {
115 print HTML qq{<h3>$_</h3>\n};
117 elsif ($cmd eq 'over') {
118 push(@indent,$indent);
120 print HTML qq{\n<dl>\n};
122 elsif ($cmd eq 'back') {
123 $indent = pop(@indent);
124 warn "Unmatched =back\n" unless defined $indent;
126 print HTML qq{\n</dl>\n\n};
128 elsif ($cmd eq 'item') {
129 ($what,$rest)=split(' ', $_, 2);
131 if($justdid ne $what){
132 print HTML "\n<A NAME=\"".$p->{"items"}->{$what}."\"></A>\n";
135 print HTML qq{<dt><B>$_</B> </dt>\n};
139 warn "Unrecognized directive: $cmd\n";
144 $next_para && (print HTML qq{<dd>\n});
146 $next_para && (print HTML qq{</dd>\n<p>\n}) && ($next_para=0);
150 print HTML "\n</HTML>\n";
152 #########################################################################
157 s/([^ESIBLCF])</$1\<\;/g;
162 s/([^"AIB])>/$1\>\;/g;
166 local($para,$pod)=@_;
167 foreach $char ("L","C","I","B"){
168 next unless /($char<[^<>]*>)/;
169 local(@ar) = split(/($char<[^<>]*>)/,$para);
170 local($this,$key,$num);
171 for($this=0;$this<=$#ar;$this++){
172 next unless $ar[$this] =~ /${char}<([^<>]*)>/;
175 if((defined($p->{"podnames"}->{$key})) && ($char eq "L")){
176 $ar[$this] = "\n$type$key.html\">\nthe $key manpage<\/A>\n"; #
178 elsif(defined($p->{"items"}->{$key})){
179 ($pod2,$num)=split(/_/,$p->{"items"}->{$key},2);
180 $ar[$this] = (($pod2 eq $pod) && ($para=~/^\=item/)) ?
181 "\n<A NAME=\"".$p->{"items"}->{$key}."\">\n$key</A>\n"
183 "\n$type$pod2.html\#".$p->{"items"}->{$key}."\">$key<\/A>\n";
185 elsif(defined($p->{"headers"}->{$key})){
186 ($pod2,$num)=split(/_/,$p->{"headers"}->{$key},2);
187 $ar[$this] = (($pod eq $pod2) && ($para=~/^\=head/)) ?
188 "\n<A NAME=\"".$p->{"headers"}->{$key}."\">\n$key</A>\n"
190 "\n$type$pod2.html\#".$p->{"headers"}->{$key}."\">$key<\/A>\n";
193 (warn "No \"=item\" or \"=head\" reference for $ar[$this] in $pod\n") if $debug;
194 if($char =~ /^[BCF]$/){
195 $ar[$this]="<B>$key</B>";
201 $ar[$this]="<I>$key</I>";