]> bicyclesonthemoon.info Git - ott/bsta/commitdiff
HTML output indented for readability
authorb <rowerynaksiezycu@gmail.com>
Sat, 14 Oct 2023 22:54:50 +0000 (22:54 +0000)
committerb <rowerynaksiezycu@gmail.com>
Sat, 14 Oct 2023 22:54:50 +0000 (22:54 +0000)
bsta_lib.1.pm

index a2005c1515fad259c6a054c05c753be010da4bbf..372ba20d94dd5076e3a01a319ade20a71095ae46 100644 (file)
@@ -19,6 +19,8 @@
 
 # TODO: FQ NBSP ?
 # TODO: DEBUG
+# TODO: timer JS
+# TODO: BB & INFO indent
 
 package bsta_lib;
 
@@ -175,19 +177,22 @@ sub failpage {
        print "Content-type: text/html; charset=UTF-8\n\n";
        
        print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">'."\n";
-       print '<html lang="en"><head>'."\n";
-       print '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
+       print ' <html lang="en">'."\n";
+       print '  <head>'."\n";
+       print '   <meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
        if ($title ne '') {
-               print '<title>'.html_entity_encode_dec($title, 1).'</title>'."\n";
+               print '   <title>'.html_entity_encode_dec($title, 1).'</title>'."\n";
        }
-       print '</head><body>'."\n";
+       print '  </head>'."\n";
+       print ' <body>'."\n";
        if ($title ne '') {
-               print '<h1>'.html_entity_encode_dec($title, 1).'</h1>'."\n";
+               print '  <h1>'.html_entity_encode_dec($title, 1).'</h1>'."\n";
        }
        if ($message ne '') {
-               print '<p>'.html_entity_encode_dec($message, 1).'</p>'."\n";
+               print '  <p>'.html_entity_encode_dec($message, 1).'</p>'."\n";
        }
-       print '</body></html>'."\n";
+       print ' </body>'."\n";
+       print '</html>'."\n";
 }
 
 sub fail_method {
@@ -773,29 +778,29 @@ sub print_html_end {
 
 sub print_html_head_start {
        (my $fh) = @_;
-       print $fh '<head>'."\n";
-       print $fh '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
-       print $fh '<link rel="icon" type="image/png" href="'.html_entity_encode_dec(FAVICON_PATH(),1).'">'."\n";
-       print $fh '<link rel="stylesheet" href="'.html_entity_encode_dec(CGI_CSS_PATH(),1).'">'."\n";
+       print $fh ' <head>'."\n";
+       print $fh '  <meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
+       print $fh '  <link rel="icon" type="image/png" href="'.html_entity_encode_dec(FAVICON_PATH(),1).'">'."\n";
+       print $fh '  <link rel="stylesheet" href="'.html_entity_encode_dec(CGI_CSS_PATH(),1).'">'."\n";
 }
 
 sub print_html_head_end {
        (my $fh) = @_;
-       print $fh '</head>'."\n";
+       print $fh ' </head>'."\n";
 }
        
 sub print_html_body_start {
        (my $fh) = @_;
-       print $fh '<body>'."\n";
-       print $fh '<a href="/"><img id="botmlogo" src="'.html_entity_encode_dec(CGI_LOGO_PATH(),1).'" alt="'.html_entity_encode_dec(WEBSITE(),1).'"></a>'."\n";
-       print $fh '<div id="all">'."\n";
+       print $fh ' <body>'."\n";
+       print $fh '  <a href="/"><img id="botmlogo" src="'.html_entity_encode_dec(CGI_LOGO_PATH(),1).'" alt="'.html_entity_encode_dec(WEBSITE(),1).'"></a>'."\n";
+       print $fh '  <div id="all">'."\n";
 }
 
 sub print_html_body_end {
        (my $fh) = @_;
-       print $fh '</div>'."\n";
-       print $fh '<a href="/" class="cz">'.html_entity_encode_dec(WEBSITE(),1).'</a>'."\n";
-       print $fh '</body></html>'."\n";
+       print $fh '  </div>'."\n";
+       print $fh '  <a href="/" class="cz">'.html_entity_encode_dec(WEBSITE(),1).'</a>'."\n";
+       print $fh ' </body>'."\n";
 }
 
 sub print_html_data {
@@ -1054,66 +1059,68 @@ sub print_viewer_page {
        print_html_start($fh);
        print_html_head_start($fh);
        
-       print $fh '<link rel="index" href="'.$_goto_url.'">'."\n";
-       print $fh '<link rel="start" href="'.$_viewer_0_url.'">'."\n";
+       print $fh '  <link rel="index" href="'.$_goto_url.'">'."\n";
+       print $fh '  <link rel="start" href="'.$_viewer_0_url.'">'."\n";
        if ($prev_available) {
-               print $fh '<link rel="prev" href="'.$_viewer_prev_url.'">'."\n";
+               print $fh '  <link rel="prev" href="'.$_viewer_prev_url.'">'."\n";
        }
        if ($next_available) {
-               print $fh '<link rel="next" href="'.$_viewer_next_url.'">'."\n";
+               print $fh '  <link rel="next" href="'.$_viewer_next_url.'">'."\n";
                if ($prefetch_next) {
-                       print $fh '<link rel="prefetch" href="'.$_viewer_next_url.'">'."\n";
-                       print $fh '<link rel="prefetch" href="'.$_frame_next_url.'">'."\n";
+                       print $fh '  <link rel="prefetch" href="'.$_viewer_next_url.'">'."\n";
+                       print $fh '  <link rel="prefetch" href="'.$_frame_next_url.'">'."\n";
                }
        }
        if ($show_timer) {
-               print $fh '<!-- <script src="'.$_timer_url.'"></script> -->'."\n";
+               print $fh '  <!-- <script src="'.$_timer_url.'"></script> -->'."\n";
        }
        
        print_html_head_end($fh);
        print_html_body_start($fh);
        
-       print $fh '<div id="inst" class="ins">'."\n";
+       print $fh '   <div id="inst" class="ins">'."\n";
        
-       print $fh '<div id="title">'."\n";
-       print $fh '<h1 id="titletext">'.$_title.'</h1>'."\n";
-       print $fh '</div>'."\n";
+       print $fh '    <div id="title">'."\n";
+       print $fh '     <h1 id="titletext">'.$_title.'</h1>'."\n";
+       print $fh '    </div>'."\n";
        
-       print $fh '</div><div id="framespace">'."\n";
+       print $fh '   </div>'."\n";
+       print $fh '   <div id="framespace">'."\n";
        
-       print $fh '<img src="'.$_frame_url.'" id="frame" alt="'.$frame.'" title="'.$_title.'">'."\n";
+       print $fh '    <img src="'.$_frame_url.'" id="frame" alt="'.$frame.'" title="'.$_title.'">'."\n";
        
-       print $fh '</div><div id="insb" class="ins">'."\n";
+       print $fh '   </div>'."\n";
+       print $fh '   <div id="insb" class="ins">'."\n";
        
        if ($text_mode == TEXT_MODE->{'info'}) {
-               print $fh '<div id="chat">'."\n";
+               print $fh '    <div id="chat">'."\n";
                
                print_html_data($fh, $frame_data); 
                
-               print $fh '</div>'."\n";
+               print $fh '    </div>'."\n";
        }
        elsif ($text_mode == TEXT_MODE->{'bb'}) {
-               print $fh '<div id="chat">'."\n";
+               print $fh '    <div id="chat">'."\n";
                
                print $fh '[quote][center][size=200]'.$_title.'[/size]<br>'."\n";
                print $fh '[url='.$_viewer_full_url.'][img]'.$_frame_full_url.'[/img][/url][/center]<br>'."\n";
                print $fh html_encode_line(bb_to_bbcode(eval_bb($frame_data->{'content'})));
                print $fh '[/quote]'."\n";
                
-               print $fh '</div>'."\n";
+               print $fh '    </div>'."\n";
        }
        elsif ($frame_data->{'content'} ne '') {
-               print $fh '<div id="undertext">'."\n";
+               print $fh '    <div id="undertext">'."\n";
                print $fh bb_to_html(eval_bb($frame_data->{'content'}))."\n";
-               print $fh '</div>'."\n";
+               print $fh '    </div>'."\n";
        }
        
-       print $fh '<div id="command">'."\n";
+       print $fh '    <div id="command">'."\n";
        
        if ($show_timer) {
-               print $fh '[<span id="ongh" class="'.$timer_color_h.'">'.$timer_h.'</span>';
-               print $fh ':<span id="ongm" class="'.$timer_color_m.'">'.$timer_m.'</span>';
-               print $fh ':<span id="ongs" class="'.$timer_color_s.'">'.$timer_s.'</span>]<br>'."\n";
+               print $fh '     [<span id="ongh" class="'.$timer_color_h.'">'.$timer_h.'</span>';
+               print $fh      ':<span id="ongm" class="'.$timer_color_m.'">'.$timer_m.'</span>';
+               print $fh      ':<span id="ongs" class="'.$timer_color_s.'">'.$timer_s.'</span>]<br>'."\n";
        }
        print $fh '&gt;';
        if ($show_command_link) {
@@ -1128,9 +1135,10 @@ sub print_viewer_page {
        if ($show_command_link) {
                print $fh '</a>';
        }
-       print $fh "<br>\n</div>\n";
+       print $fh "<br>\n";
+       print $fh "    </div>\n";
        
-       print $fh '<div id="underlinks">'."\n";
+       print $fh '    <div id="underlinks">'."\n     ";
        
        unless (($frame == 0) && $static) {
                print $fh '<a href="'.$_base_url.'">Once again</a> | ';
@@ -1142,15 +1150,16 @@ sub print_viewer_page {
                print $fh '<a href="'.$_viewer_last_url.'">Now</a> | ';
        }
        print $fh '<a href="'.$_goto_url.'">GOTO</a>'."\n";
-       print $fh '<span style="float: right;">'."\n";
+       print $fh '     <span style="float: right;">'."\n      ";
        if ($text_mode != TEXT_MODE->{'normal'}) {
                print $fh '<a href="'.$_viewer_url.'">Without</a> | ';
        }
        print $fh '<a href="'.$_info_url.'">Info</a> | ';
        print $fh '<a href="'.$_bbcode_url.'">BB</a>';
-       print $fh "\n</span>\n";
+       print $fh "\n     </span>\n";
        
-       print $fh "</div>\n</div>\n";
+       print $fh "    </div>\n";
+       print $fh "   </div>\n";
        
        print_html_body_end($fh);
        print_html_end($fh);