p2hutil.pl to HTML.

index -|- end

Generated: Tue Feb 2 17:54:52 2010 from p2hutil.pl 2005/11/24 5.6 KB.

#!/perl
sub add_html_head {
   my ($fh, $hdr) = @_;
   print $fh <<"EOF";
<html>
<head>
<title>$hdr</title>
EOF
   # dynamic block of style - could be put to an include file ...
   add_html_style($fh);
   print $fh <<"EOF";
</head>
<body background="cldsp.jpg">
<h1 align="center">$hdr</h1>
<p align="center"><a href="index.htm">Index</a></p>
EOF
}
sub add_html_head_a {
   my ($fh, $hdr) = @_;
   print $fh <<"EOF";
<html>
<!-- $refnum geoffmclane.com perl
   HTML generated using $0 - -->
<head>
<title>$hdr</title>
EOF
   # dynamic block of style - could be put to an include file ...
   add_html_style($fh);
   print $fh <<"EOF";
<script language="JavaScript">
<!-- ---------------------------------------------------------------------------
function ModifiedDate() {
var month = new Array("January","February","March","April","May","June","July",
                 "August","September","October","November","December");
var updated = new Date(document.lastModified);
var Month   = month[updated.getMonth()];
var Day     = updated.getDate();
var Year    = updated.getYear();
var Hour    = updated.getHours();
var Min     = updated.getMinutes();
   if( Year < 2000 ) Year += 1900;
   if( Year < 2000 ) Year += 100;  //Netscape 3 and IE 4.7 return 0 instead of 100 for 2000
   if( Hour < 10 )  Hour = "0" + Hour;
   if( Min  < 10 )  Min  = "0" + Min;
   document.write("Last modified " + Month + " " + Day +  ", " + Year + " at " + Hour + ":" + Min);
}
//-------------------------------------------------------------------------- -->
</script>
<style>
.xsmall { font:  8pt "trebuchet ms", verdana, arial, sans-serif; }
</style>
</head>
<body background="cldsp.jpg">
<h1 align="center">$hdr</h1>
<p align="center"><a href="index.htm">up</a></p>
EOF
}
# was <table align="center" width="96%" border="0" bgcolor="#eeeeee">
# then <table border=1 cellspacing=0 cellpadding=0 style='border-collapse:collapse; border:none' 
#   align="center" width="96%" border="0" bgcolor="#eeeeee">
# color ? <table border="1" width="98%" style="font-family: Courier New; font-size: 10pt; color: #0000FF" cellpadding="0" cellspacing="0">
##ok1 <table align="center" border="1" width="80%" cellpadding="0" cellspacing="0" bgcolor="#eeeeee" style='border-collapse:collapse; border:none'>
##ok2 <table align="center" border="1-4" width="96%" cellpadding="0" cellspacing="0" bgcolor="#eeeeee">
##ok3 <table align="center" border="1" width="96%" cellpadding="0" cellspacing="0" bgcolor="#eeeeee">
sub add_html_table {
   my ($fh) = @_;
   if ($addlinenums) { # for diagnostic, mainly, since it DESTROYS simple copy-paste ;=((
      print $fh <<EOF;
<table align="center" border="1" width="90%" cellpadding="1" cellspacing="1" bgcolor="#eeeeee">
EOF
   } else {
      print $fh <<EOF;
<table align="center" border="1" cellpadding="0" cellspacing="0" bgcolor="#eeeeee">
EOF
   }
}
sub add_html_tail {
   my ($fht) = @_;
   print $fht <<EOF;
<p align="center"><a href="index.htm">Index</a></p>
</body>
</html>
<!-- $refnum geoffmclane.com/perl - HTML generated using $0 - -->
EOF
}
sub add_html_tail_a {
   my ($fh) = @_;
   print $fh <<"EOF";
<div style="margin-top:10px;">
<table width="100%">
<tr>
   <td>
     <div class="xsmall" style="font-family:verdana,arial,sans-serif;">
      <a href="index.htm">Up</a>
      </div>
   </td>
   <td align="right">
      <div class="xsmall" style="font-family:verdana,arial,sans-serif;">
<script language="JavaScript">
<!-- -------------
   ModifiedDate()
//------------ -->
</script>
      </div>
   </td>
</tr>
</table>
</div>
</body>
</html>
EOF
}
### COLOR: #00008b;
sub addTTitem_simp {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nm { COLOR: $bd }
EOF3
}
sub addTTitem_bkgrd {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nm { BACKGROUND-COLOR: $bg }
EOF3
}
sub addTTitem_bkgrd1 {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nmm
{
 BACKGROUND-COLOR: $bg;
 BORDER-TOP: $bg 1px solid;
 BORDER-BOTTOM: $bg 1px solid
 PADDING-BOTTOM: 1px;
 PADDING-TOP: 1px;
}
EOF3
}
sub addTTitem_bkgrd2 {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nmm
{
 BACKGROUND-COLOR: $bg;
 BORDER-TOP: $bg 2px solid;
 BORDER-BOTTOM: $bg 2px solid
}
EOF3
}
sub addTTitem_bkgrd21 {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nm { BACKGROUND-COLOR: $bg }
EOF3
}
sub addTTitem_bkgrd2p {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nmm
{
 BACKGROUND-COLOR: $bg;
 BORDER-TOP: $bg 2px solid;
 BORDER-BOTTOM: $bg 2px solid
 PADDING-BOTTOM: 2px;
 PADDING-TOP: 2px;
}
EOF3
}
sub addTTitem_full {
   my ($fh, $nm, $bd, $bg) = @_;
   print $fh <<"EOF3";
.$nmm
{
   COLOR: $bd;
    BORDER-TOP: $bd 1px solid;
    BORDER-LEFT-WIDTH: 1px;
    BORDER-LEFT-COLOR: $bd;
    PADDING-BOTTOM: 1px;
    PADDING-TOP: 1px;
    BORDER-BOTTOM: $bd 1px solid;
    WHITE-SPACE: nowrap;
    BACKGROUND-COLOR: $bg;
    BORDER-RIGHT-WIDTH: 1px;
    BORDER-RIGHT-COLOR: $bdd
}
EOF3
}
sub add_body_style_NOT_USED {
   my ($fh) = @_;
   print $fh <<"EOF1";
<style type="text/css">
body { font-size: 14 px }
.info {
text-align: "center" ;
color: #989898 ;
font-size: "75%" ;
font-weight: "bold" ; 
margin: 5px ; }
</style>
<P>
<CENTER>
<TABLE BORDER=0 BGCOLOR=lightblue CELLPADDING=5>
 <TR>
 <TD>
 <TABLE BORDER=0 CELLPADDING=10 bgcolor=#eeeeee>
  <TR>
  <TD>
  <PRE class=codebox>
print ("Name is ", \$name, " age next year is ", \$age+1, "\n" );
  </PRE>
  </TD>
  </TR>
 </TABLE>
 </TD>
 </TR>
</TABLE>
</CENTER>
<P>
EOF1
}
1;
#EOF

index -|- top

checked by tidy  Valid HTML 4.01 Transitional