package w3bbc_html; sub text_tag_pre { local(*opts,*tag,*close,$html) = @_; local(@parsed,@save,$ret); #unless ($opts{'_tag'} eq 'pre') { unless ($opts{'_tag'}) { $html =~ s/^\s*[\r\n]+//; $html =~ s/\s*[\r\n]+\s*$//; $ret .= &newlines(*opts,2); } if (&has_tag($html)) { @parsed = (); &parse_html(*parsed,$html); @save = ($opts{'_tag'},$opts{'font_type'},$opts{'font_emphasis'}); $opts{'font_type'} = 'plain'; $opts{'font_emphasis'} = '*'; $opts{'_tag'} = 'pre'; $html = &process_html(*opts,*parsed); ($opts{'_tag'},$opts{'font_type'},$opts{'font_emphasis'}) = @save; } else { &display_text(*opts,$html); } $ret .= $html; #unless ($opts{'_tag'} eq 'pre') { unless ($opts{'_tag'}) { $ret .= &newlines(*opts,2); } return($ret); } sub text_tag_address { local(*opts,*tag,*close,$html) = @_; local(@parsed,@save,$ret); $ret .= &newlines(*opts,1); if ($opts{'a_href'}) { # Rather than handle it myself, wrap it with the URL and pass it on.. local(%open2,%close2); $open2{'a_href'} = $opts{'a_href'}; $open2{'a_name'} = $opts{'a_name'}; local($routine) = $w3bbc_html'tags_block{'a'}; $ret .= &$routine(*opts,*open2,*close2,$html); } elsif (&has_tag($html)) { @parsed = (); &parse_html(*parsed,$html); $ret .= &process_html(*opts,*parsed); } else { &display_text(*opts,$html); $ret .= $html; } $ret .= &newlines(*opts,1); return($ret); } sub text_tag_a { local(*opts,*open,*close,$html) = @_; local($ret) = &parse_html_tag(*opts,*tag,*close,$html); return $ret; } sub text_tag_img { return("[IMAGE]"); } sub text_tag_h { local(*opts,*open,*close,$html) = @_; $html =~ s/\s+/ /g; # Convert multiple space/newlines into single space local($ret,$text,@parsed); $ret .= &newlines(*opts,2); # 2 newlines before.. if (&has_tag($html)) { @parsed = (); &parse_html(*parsed,$html); $html = &process_html(*opts,*parsed); } local($start) = $open; $start =~ s/^h//i; $text = "Header level #$start: $html"; $ret .= $text; # put the text in the stream &display_text(*opts,$text); # register the displayed text length $ret .= &newlines(*opts,2); # 2 newlines after.. return($ret); } sub text_tag_cite { # # bug in routine: will capitalize HTML tags, like # # local(*opts,*tag,*close,$html) = @_; if ($open eq 'b') { $html =~ tr/a-z/A-Z/; } elsif ($open eq 'i') { $html = "{$html}"; } local(@save) = ($opts{'_tag'}); local($ret) = &parse_html_tag(*opts,*tag,*close,$html); ($opts{'_tag'}) = @save; return $ret; } sub text_tag_p { local(*opts,*tag) = @_; return(&newlines(*opts,2)); } sub text_tag_br { local(*opts,*tag) = @_; return(&newlines(*opts,1)); } sub text_tag_li { # in case they forget the