#!perl # mtx2html.pl # MTX to HTML Converter # Version 1.5.7 (3/27/97) # Richard Rathe # http://www.med.ufl.edu/medinfo/mtx/ # Copyright 1996-97 by Richard Rathe # Revision History: # 8/1/96 - 1.5 - initial release # 9/1/96 - 1.5.1 - fixed minor DTD problems # 9/15/96 - 1.5.2 - fixed parent quiz page links # 10/1/96 - 1.5.3 - minor changes and fixes # 1/1/97 - 1.5.4 - added embedded movies, big, small, super, sub, and non print # 1/18/97 - 1.5.5 - added hidden movies (audio only), about and keyword meta info # 3/1/97 - 1.5.6 - set autoplay to false, added basefont for slides # 3/27/97 - 1.5.7 - added support for dos file names, improved movie syntax #$html = "\.htm"; # DOS only $html = "\.html"; # Mac, Unix, or Win95 $mac = "true"; # Mac only $mtxinfo = ""; $dtdinfo = ""; $movinfo = "WIDTH=250 HEIGHT=204 PLUGINSPAGE=\"http://quicktime.apple.com\""; @letters = ('#','A','B','C','D','E','F','G','H','I','J','K', 'L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); ### process file(s) print "Starting MTX2HTML v1.5.7...\n"; while(@ARGV > 0) # drag and drop file(s) on Mac droplet { # or from command line under MSDOS, UNIX $infile = shift(@ARGV); $outfile = $infile; $outfile =~ s/(.*)\.(.*)/$1$html/; if($infile =~ /.*\.mtx/i) {&mtx2html($infile,$outfile);} else { print " skip: $infile\n"; } } print "\n"; ### main program ### sub mtx2html # requires two args: { # path:infile @toc = (); # path:outfile %info = (); $main = ""; $head = ""; $tail = ""; $navi = ""; $tocf = ""; $akey = ""; $qtxt = ""; $stxt = ""; $para = ""; $path = ""; $hcount = 0; $lcount = 0; $tcount = 0; $pcount = 0; $qcount = 0; $acount = 0; $_[1] =~ /(.*[:\/\\])(.*)$html/; $qpath = $1; $qfile = $2; open(INFILE,$_[0]) || die "Can't open input file $_[0].\n"; print "reading: $_[0]\n"; ### parse file one line at a time while () { /.*\n/ && chop; # last line may not have a \n s/&/&/g; # fix special chars s//>/g; s/\"/"/g; if($_ eq "") # blank line { &flush_quest; &flush_para; &flush_pref; #&flush_list; # allow blank lines in lists #&flush_table; # allow blank lines in tables } elsif (/^%%.*/) # comment (%%) { # do nothing } elsif (/^%(\S+)\s*(.*)/) # page info (%) { $key = $1; $key =~ tr/a-z/A-Z/; $info{$key} = $2; if ($key eq "IMAGES") { $path = $2; } } elsif (/(^#+)(.*)/) # heading (#) { &flush_quest; &flush_para; &flush_list; &flush_table; &flush_pref; $x = length($1) + 1; $htext = $2; if ($htext =~ /^\$(.*)/) { $htext = $1; $align = " ALIGN=center"; } else { $align = ""; } if ($htext =~ /(.*)#=(\S*)/) { $htext = $1; $h1 = ""; $h2 = "<\/A>"; } else { $h1 = ""; $h2 = ""; } if ($htext =~ /^!(.*)/) { $info{'HEADING'} = $1; $main .= "\n!HEAD!\n\n"; } elsif ($htext =~ /(.*)#(\S*)/) { $hcount++; $toc[$hcount-1] .= "$x|$1<\/A>"; } else { $hcount++; if ($tocf eq "") { $main .= "\n!TOC!\n"; $tocf = "toc"; } if (defined $info{'LAYOUT'} and $info{'LAYOUT'} eq "slide") { $main .= "\n<$h1$htext$h2<\/A>\n\n"; $toc[$hcount-1] = "$htext<\/A>"; } else { $main .= "\n$h1$htext$h2<\/A>\n\n"; $toc[$hcount-1] = "$x|$htext<\/A>"; } } } elsif (/^\|.*/) # table (|) { if (/^\|-.*/) { &flush_table; } else { &flush_para; if (!$caption) { $caption = "$&"; } else { $table[$tcount++] = "$&"; } } } elsif (/(^\s+)(.*)/) # list (space or tab) { &flush_para; if ($acount == 0) { $x = length($1); $list[$lcount++] = "$x $2"; } else { $atxt[$acount] .= "\n

$2"; } } elsif (/^\?(.*)/) # question (?) { &flush_quest; &flush_para; &flush_list; &flush_table; &flush_pref; $qcount++; $1 =~ /(\w*)\??(\w*)/; $qkey = $1; $qmod = $2; $qkey =~ tr/a-z/A-Z/; $qmod =~ tr/a-z/A-Z/; if ($info{'LAYOUT'} =~ /feedback/i) { $qmod = ""; } if ($info{'LAYOUT'} =~ /nofeedback/i) { $qmod = "NONE"; } if ($info{'LAYOUT'} =~ /print/i) { $qmod = "NONE"; } if ($info{'QUIZCGI'}) { $qmod = "QUIZ"; } if ($info{'FILE'}) { $rfile = "$info{'FILE'}$html"; } else { $rfile = "$qfile$html"; } $qtxt .= "$dtdinfo\n\n\n$mtxinfo\n\n\nFeedback for Question $qcount\n\n\n"; $qtxt .= "$info{'TITLE'}\n"; $qtxt .= "

Question $qcount Feedback

\n"; $x = length($qkey); if ($x == 1) { $temp = "Single Best Answer" } else { $temp = "Best $x Answers" } $main .= "

Question $qcount - $temp\n"; } elsif (/^@(.*)/) # answer (@) { &flush_para; $acount++; $temp = "$letters[$acount])"; $atxt[$acount] = "$temp $1"; $x = length($qkey); if ($acount == 1) { $main .= "

\n"; } if ($qmod eq "QUIZ") { if ($x == 1) { $main .= "

$1\n"; } else { $main .= "

$1\n"; } $y = index($qkey, $letters[$acount]); if ($y >= 0 && $akey =~ /q$qcount=/) { chop($akey); $akey .= ":a$acount\n"; } elsif ($y >= 0) { $akey .= "q$qcount=a$acount\n"; } elsif ($x > 1 && $akey =~ /q$qcount=/) { chop($akey); $akey .= ":x\n"; } elsif ($x > 1) { $akey .= "q$qcount=x\n"; } } elsif ($qmod eq "") { $main .= "

$temp $1\n"; if (index($qkey, $letters[$acount]) < 0) { if ($x == 1) { $atxt[$acount] .= "

Sorry..."; } else { $atxt[$acount] .= "

Sorry..."; } } else { if ($x == 1) { $atxt[$acount] .= "

Correct!"; } else { $atxt[$acount] .= "

Correct, but there are more..."; } } } else { $main .= "

$temp $1\n"; } } elsif (/^-.*/) # horizontal rule (-) { &flush_list; &flush_table; &flush_pref; $para .= "\n


\n"; } elsif (/^''(.*)/) # pull quote ('') { &flush_para; &flush_list; &flush_table; &flush_pref; $main .= "


$1

\n"; } elsif (/^=(.*)/) # preformatted text (=) { &flush_para; &flush_list; &flush_table; $pref[$pcount++] = $1; } else # other stuff { &flush_list; &flush_table; &flush_pref; if($para eq "") { $para = $_; } else { $para .= " $_"; } } } &flush_quest; # flush everything just to be sure &flush_para; &flush_list; &flush_table; &flush_pref; ### fix up page info if (!$info{'MTX'}) { print "WARNING: The format of this file is unknown!\n"; } elsif ($info{'MTX'} < 1.5) { print "WARNING: The format of this file ($info{'MTX'}) is not current!\n"; } if ($info{'FILE'}) { $_[1] =~ s/(.*[:\/\\]).*/$1$info{'FILE'}$html/; } else { $_[1] =~ /.*[:\/\\](.*)$html/; $info{'FILE'} = $1; } if (!$info{'TITLE'}) { $info{'TITLE'} = $info{'FILE'}; } if (!$info{'HEADING'}) { $info{'HEADING'} = $info{'TITLE'}; } if ($info{'HEADING'} =~ /(^!\w*$)/) { $info{'HEADING'} = "$1 $info{'TITLE'}"; } if (!$info{'AUTHOR'}) { $info{'AUTHOR'} = $info{'AUTHURL'}; } if (!$info{'CONTACT'}) { $info{'CONTACT'} = $info{'CONTURL'}; } if (!$info{'VERSION'}) { $info{'VERSION'} = $info{'VERSURL'}; } if ($info{'HOMEURL'} && !$info{'HOME'}) { $info{'HOME'} = "Home Page" } if ($info{'PARENTURL'} && !$info{'PARENT'}) { $info{'PARENT'} = "Parent Page" } if ($info{'INDEXURL'} && !$info{'INDEX'}) { $info{'INDEX'} = "Index Page" } if ($info{'PREVURL'} && !$info{'PREV'}) { $info{'PREV'} = "Previous Page" } if ($info{'NEXTURL'} && !$info{'NEXT'}) { $info{'NEXT'} = "Next Page" } if ($info{'LAYOUT'} eq "print") { $info{'OUTLINE'} = "none"; $info{'COUNTER'} = ""; $info{'HOMEURL'} = ""; $info{'PARENTURL'} = ""; $info{'INDEXURL'} = ""; $info{'PREVURL'} = ""; $info{'NEXTURL'} = ""; } if ($info{'LAYOUT'} eq "slide") { $info{'OUTLINE'} = "slide"; } if ($info{'REFRESH'} && $info{'LAYOUT'} eq "slide") { $info{'REFRESH'} =~ s/^(\d+)$//; } elsif ($info{'REFRESH'}) { $info{'REFRESH'} =~ s/^(\d+)$//; } if ($info{'LOGO'} =~ /(^\$?)(.+)/) { $info{'HEADING'} = "$1!$2"; } if ($info{'QUIZCGI'}) { $info{'STAMP'} = time; $info{'STAMP'} =~ s/\d*(\d\d\d\d$)/$1/; } if ($info{'QUIZLIST'}) { $info{'QUIZLIST'} .= ".lst"; } if ($info{'QUIZTYPE'} && !$info{'LAYOUT'}) { $info{'LAYOUT'} = "results"; } if ($info{'ABSTRACT'}) { $info{'ABSTRACT'} = ""; } if ($info{'KEYWORDS'}) { $info{'KEYWORDS'} = ""; } ### process embedded tags $main = &process_tags($main); ### build navigation buttons if ($info{'HOMEURL'} eq 'none') { $navi .= "$info{'HOME'} | "; } elsif ($info{'HOMEURL'}) { $navi .= "$info{'HOME'} | "; } if ($info{'PARENTURL'} eq 'none') { $navi .= "$info{'PARENT'} | "; } elsif ($info{'PARENTURL'}) { $navi .= "$info{'PARENT'} | "; } if ($info{'INDEXURL'} eq 'none') { $navi .= "$info{'INDEX'} | "; } elsif ($info{'INDEXURL'}) { $navi .= "$info{'INDEX'} | "; } if ($info{'PREVURL'} eq 'none') { $navi .= "$info{'PREV'} | "; } elsif ($info{'PREVURL'}) { $navi .= "$info{'PREV'} | "; } if ($info{'NEXTURL'} eq 'none') { $navi .= "$info{'NEXT'} | "; } elsif ($info{'NEXTURL'}) { $navi .= "$info{'NEXT'} | "; } if ($navi) { chop($navi); chop($navi); chop($navi); $navi .= "\n"; } ### build page header $head = "$dtdinfo\n\n\n$mtxinfo\n\n\n"; if ($info{'REFRESH'} && $info{'LAYOUT'} ne "slide") { $head .= "$info{'REFRESH'}\n"; } if ($info{'ABSTRACT'}) { $head .= "$info{'ABSTRACT'}\n"; } if ($info{'KEYWORDS'}) { $head .= "$info{'KEYWORDS'}\n"; } $head .= "$info{'TITLE'}\n\n\n"; if ($info{'WATERMARK'}) { $head .= "\n"; } elsif ($info{'COLORS'}) { $head .= "\n"; } else { $head .= "\n"; } if ($navi) { $head .= $navi . "
\n"; } if ($info{'HEADING'} =~ /^\$(.*)/) { $info{'HEADING'} = $1; $align = " ALIGN=center"; } else { $align = ""; } $info{'HEADING'} =~ s/^!(\w*) ?(.*)/\"$2\"/i; if ($main =~ /!HEAD!/) { $main =~ s/!HEAD!/$info{'HEADING'}<\/H1>/; } else { $head .= "$info{'HEADING'}\n"; } if ($info{'QUIZCGI'}) { $head .= "
\n"; } ### build page footer if ($info{'QUIZCGI'}) { $tail .= "\n
\n"; if ($info{'QUIZLIST'}) { $tail .= "   ID Code:    \n"; } $tail .= " \n"; $tail .= "\n"; $tail .= "\n"; } if ($info{'COUNTER'}) { $info{'COUNTER'} =~ /(\w* \d*, \d*) +(.*)/; $tail .= "\n
\nYou are visitor   since $1.\n"; } if ($info{'LAYOUT'} eq "cover") { $tail .= "\n"; } else { $ts = ×tamp; $tail .= "\n
\n"; if ($info{'CREATED'}) { $tail .= "\n  Created: $info{'CREATED'}"; $tail .= "\n Modified: $ts"; } else { $tail .= "\n  Updated: $ts"; } if ($info{'EXPIRES'}) { $tail .= "\n Expires: $info{'EXPIRES'}"; } } if ($info{'VERSURL'}) { $tail .= "\n
  Version: $info{'VERSION'}"; } elsif ($info{'VERSION'}) { $tail .= "\n
  Version: $info{'VERSION'}"; } if ($info{'AUTHURL'}) { if($info{'AUTHURL'} =~ /.+@.+/) { $info{'AUTHURL'} = "mailto:" . $info{'AUTHURL'}; } $tail .= "\n
   Author: $info{'AUTHOR'}"; } elsif ($info{'AUTHOR'}) { $tail .= "\n
   Author: $info{'AUTHOR'}"; } if ($info{'CONTURL'}) { if($info{'CONTURL'} =~ /.+@.+/) { $info{'CONTURL'} = "mailto:" . $info{'CONTURL'}; } $tail .= "\n
  Contact: $info{'CONTACT'}"; } elsif ($info{'CONTACT'}) { $tail .= "\n
  Contact: $info{'CONTACT'}"; } if ($info{'PATH'}) { $tail .= "\n
 Location: $info{'PATH'}$info{'FILE'}$html"; } if ($info{'COPYURL'}) { $tail .= "\n
Copyright: $info{'COPYRIGHT'}"; } elsif ($info{'COPYRIGHT'}) { $tail .= "\n
Copyright: $info{'COPYRIGHT'}"; } if ($navi) { $tail .= "\n
\n
\n" . $navi; } else { $tail .= "\n
\n"; } if ($info{'QUIZCGI'}) { $tail .= "
\n"; } $tail .= "\n\n"; ### build toc/outline $temp = ""; if ($info{'OUTLINE'} eq "none" || $toc[0] eq "") { $toc = "
"; } elsif ($info{'OUTLINE'} eq "slide") { $toc = "
\n
    \n"; foreach $item (@toc) { $toc .= "
  1. $item\n"; } $toc .= "$temp
\n
\n\n"; $toc .= "A Note on These Slides: To begin, select any slide from "; $toc .= "the list above. Use the controls (< i >) to move forward, backward, or return "; $toc .= "to this index. Increase the font size of your browser for optimal viewing."; if ($x = index($main,"!TOC!")) { $stxt = substr($main,$x+6); $main = substr($main,0,$x+6); } } elsif ($info{'OUTLINE'} eq "long") { $level = 1; foreach $item (@toc) { # print "$level $item\n"; $item =~ s/(.*)\|(.*)/
  • $2/; if ($1 == $level) { $temp .= "$item\n"; } elsif ($1 > $level) { $temp .= "
      \n$item\n"; } else { while($level > $1) { $level--; $temp .= "
    \n"; } $temp .= "$item\n"; } $level = $1; } while ($level > 1) { $level--; $temp .= "\n"; } $toc = "
    \n$temp
    "; } else { foreach $item (@toc) { $item =~ s/(.*)\|(.*)/$2 \| /; if ($1 == 2){ $temp .= "$item\n"; } } chop($temp); chop($temp); chop($temp); $toc = "
    \n$temp\n
    "; } if ($main =~ /!TOC!/) { $main =~ s/!TOC!/$toc/; } ### output page open(OUTFILE,">$_[1]") || die "Can't open output file $_[1].\n"; print "writing: $_[1]\n"; print OUTFILE "$head$main$tail"; close(INFILE); close(OUTFILE); defined($mac) and MacPerl::SetFileInfo("MOSS", "TEXT", $_[1]); # netscape mac only ### output slides $scount = 0; $x = index($stxt,"< -1) { $temp = substr($stxt,1,$x); $temp =~ s/

    //; chop($temp); $stxt = substr($stxt,$x); $scount++; $prevnum = $scount-1; $nextnum = $scount+1; $file = "$qpath$qfile$scount$html"; $prev = "$qfile$prevnum$html"; $next = "$qfile$nextnum$html"; $refn = "$qfile$nextnum$html"; if ($scount == 1) { $prev = "$info{'FILE'}$html"; } elsif ($scount == $hcount) { $next = "$info{'FILE'}$html"; $refn = $qfile . "1$html"; } # $picon = "prev.gif"; $iicon = "index.gif"; $nicon = "next.gif"; # $temp =~ s/.*(.*)<\/H.><\/A>/$info{'TITLE'} - $1<\/TITLE>\n<\/HEAD>\n<BODY>\n\n<A HREF=\"$prev\"><IMG SRC=\"$path$picon\" ALT=\"Prev\"><\/A><A HREF=\"$qfile$html\"><IMG SRC=\"$path$iicon\" ALT=\"Index\"><\/A><A HREF=\"$next\"><IMG SRC=\"$path$nicon\" ALT=\"Next\"><\/A><CENTER><STRONG>$1<\/STRONG><\/CENTER>\n<HR SIZE=1>\n/i; if ($info{'REFRESH'}) { $refresh = "$info{'REFRESH'}$refn\">"; } $controls = "<TT><A HREF=\"$prev\">< <\/A>"; $controls .= "<A HREF=\"$info{'FILE'}$html\">i<\/A>"; $controls .= "<A HREF=\"$next\"> ><\/A><\/TT>\n"; $body = "<BODY BGCOLOR=\"#0102FF\" TEXT=\"#FFFF04\" LINK=\"#00FF02\" ALINK=\"#FFFFFF\" VLINK=\"#00FF02\">"; $temp = "$dtdinfo\n<HTML>\n\n$mtxinfo\n\n<HEAD>\n$refresh\n" . $temp; $temp =~ s/<H.><A.*>(.*)<\/A><\/H.>/<TITLE>$1 - $info{'TITLE'}<\/TITLE>\n<\/HEAD>\n$body\n\n$controls<BASEFONT SIZE=5><CENTER><STRONG>$1<\/STRONG><\/CENTER>\n<HR SIZE=4>/i; $temp .= "</BODY>\n</HTML>"; open(OUTFILE,">$file") || die "Can't open output file $file.\n"; print "writing: $file\n"; print OUTFILE $temp; close(OUTFILE); } ### output quiz key if ($info{'QUIZCGI'}) { $file = "$qpath$qfile.key"; open(OUTFILE,">$file") || die "Can't open output file $file.\n"; print "writing: $file\n"; print OUTFILE "$info{'TITLE'}\|$ts\|$info{'STAMP'}\|$info{'LAYOUT'}\|$info{'EXPIRES'}\|$info{'QUIZLIST'}\n$akey"; close(OUTFILE); } } ### add paragraph to main text ### sub flush_para { if ($para ne "") { if ($para =~ /^\$(.*)/) { $main .= "<P ALIGN=center>$1\n"; } elsif ($para =~ /^\'(.*)/) { $main .= "<BLOCKQUOTE>$1</BLOCKQUOTE>\n"; } elsif ($para =~ /^\+(.*)/ && $info{'LAYOUT'} ne "print") { $main .= "<P>$1\n"; } elsif ($para =~ /^\+(.*)/ && $info{'LAYOUT'} eq "print") { ; } # do nothing else { $main .= "<P>$para\n"; } if ($qtxt ne "") { $qtxt .= "<P>$para\n"; } $para = ""; } } ### add preformatted text to main ### sub flush_pref { if (@pref) { $main .= "<PRE>"; foreach $item (@pref) { $main .= "$item\n"; } $main .= "</PRE>\n"; } undef @pref; $pcount = 0; } ### add list to main text ### sub flush_list { $level = 0; foreach $item (@list) { $item =~ /(\d) (.)(.*)/; $item = $3; if($2 eq "#") {$stag[$1] = "<OL>"; $etag[$1] = "</OL>"; $itag[$1] = "<LI>"; } elsif($2 eq "@") {$stag[$1] = "<OL TYPE=a>"; $etag[$1] = "</OL>"; $itag[$1] = "<LI>"; } elsif($2 eq "!") {$stag[$1] = "<OL TYPE=I>"; $etag[$1] = "</OL>"; $itag[$1] = "<LI>"; } elsif($2 eq "+") {$stag[$1] = "<DL>"; $etag[$1] = "</DL>"; $itag[$1] = "<DT>"; $item = "<EM>$item</EM>"; } elsif($2 eq "-") {$stag[$1] = "<DL>"; $etag[$1] = "</DL>"; $itag[$1] = "<DD>"; } else {$stag[$1] = "<UL>"; $etag[$1] = "</UL>"; $itag[$1] = "<LI>"; $item = $2 . $3; } if ($1 > $level) # start list { $level = $1; $main .= "$stag[$1]\n"; } elsif ($1 < $level) # end list { while ($1 < $level) { $main .= "$etag[$level--]\n"; } } $main .= "$itag[$1]$item\n"; # list item } while ($level > 0) { $main .= "$etag[$level--]\n"; } undef @list; $lcount = 0; } ### add table to main text ### sub flush_table { if (@table) { $caption =~ s/^\|([^|]*)(.*)/$1/; $type = $2; $caption =~ s/none//i; if ($type =~ /(nowide\|noborder|noborder\|nowide)/) { $main .= "<CENTER><P><TABLE>\n"; } elsif ($type =~ /nowide/) { $main .= "<CENTER><P><TABLE BORDER=6 CELLPADDING=2 CELLSPACING=1>\n"; } elsif ($type =~ /noborder/) { $main .= "<CENTER><P><TABLE WIDTH=\"95%\">\n"; } else { $main .= "<CENTER><P><TABLE BORDER=6 CELLPADDING=2 CELLSPACING=1 WIDTH=\"95%\">\n"; } if ($caption) { $main .= "<CAPTION><STRONG><EM>" . $caption . "</EM></STRONG></CAPTION>\n"; } foreach $item (@table) { $main .= "<TR>"; while ($item) { $item =~ s/^\|([^|]*)(.*)/$2/; $cell = $1; $cell =~ s/(.*[\S|\*])(\s*$)/$1/; $cell =~ s/(^[\*|^]?)(.*)/$2/; $tag = $1; $cell =~ s/\s*//; if ($cell =~ /(.*)\\(\d*)/) { $cell = $1; $col = " COLSPAN=$2 ALIGN=center>"; } else { $col = ">"; } if ((!$cell) && ($type =~ /noblanks/)) { $tag = "*"; } if (($tag eq "*") && $cell) { $main .= "<TH" . $col . $cell . "</TH>"; } elsif ($tag eq "*") { $main .= "<TD>" . " " . "</TD>"; } elsif ($tag eq "^") { $main .= "<TD VALIGN=top" . $col . $cell . "</TD>"; } else { $main .= "<TD" . $col . $cell . "</TD>"; } } $main .= "</TR>\n"; } $main .= "</TABLE></CENTER>\n"; } undef @table; undef $caption; $tcount = 0; } ### output question feedback files ### sub flush_quest { if ($acount > 0) { $main .= "</BLOCKQUOTE>\n"; # ??dead code?? if ($qmod eq "") { $cnt = 0; $qtxt = &process_tags($qtxt); while ($acount > $cnt) { $cnt++; $file = "$qpath$qfile$qcount$letters[$cnt]$html"; open(OUTFILE,">$file") || die "Can't open output file $file.\n"; print "writing: $file\n"; $atxt[$cnt] = &process_tags($atxt[$cnt]); print OUTFILE "$qtxt\n<BLOCKQUOTE>\n<P>"; print OUTFILE "$atxt[$cnt]\n"; print OUTFILE "</BLOCKQUOTE>\n</BODY>\n</HTML>"; close(OUTFILE); } } undef $qtxt; undef $qkey; undef $qmod; undef @atxt; $acount = 0; } } ### process embedded tags ### sub process_tags { $temp = $_[0]; $temp =~ s/{P}/<P>/gi; $temp =~ s/{B}/<BR>/gi; $temp =~ s/{S}/ /gi; $temp =~ s/{C}/<BR CLEAR=all>/gi; $temp =~ s/{!/<EM>/g; $temp =~ s/!}/<\/EM>/g; $temp =~ s/{\*/<STRONG>/g; $temp =~ s/\*}/<\/STRONG>/g; $temp =~ s/{@/<TT>/g; $temp =~ s/@}/<\/TT>/g; # F replaces @ $temp =~ s/{F/<TT>/g; $temp =~ s/F}/<\/TT>/g; $temp =~ s/{B/<BIG>/g; $temp =~ s/B}/<\/BIG>/g; $temp =~ s/{S/<SMALL>/g; $temp =~ s/S}/<\/SMALL>/g; $temp =~ s/{P/<SUP>/g; $temp =~ s/P}/<\/SUP>/g; $temp =~ s/{N/<SUB>/g; $temp =~ s/N}/<\/SUB>/g; $temp =~ s/{#([^{}]*@[^{}]*)##}/<A HREF=\"mailto:$1\">$1<\/A>/g; $temp =~ s/{#([^{}]*)##}/<A HREF=\"$1\">$1<\/A>/g; $temp =~ s/{#([^{}]*)#=([^{}]*)#}/<A NAME=\"$2\">$1<\/A>/g; $temp =~ s/{#([^{}]*)#(#[^{}]*)#}/<A HREF=\"$2\">$1<\/A>/g; $temp =~ s/{#([^{}#]*)#([^{}]*@[^{}]*)#}/<A HREF=\"mailto:$2\">$1<\/A>/g; $temp =~ s/{#([^{}#]*)#([^{}]*)#}/<A HREF=\"$2\">$1<\/A>/g; $temp =~ s/{=(\w*)=}/<IMG SRC=\"$path$1.gif\">/gi; $temp =~ s/{=(\w*) (.*)=}/<IMG SRC=\"$path$1.gif\" ALT=\"$2\">/gi; $temp =~ s/{=\$(\w*)=}/<IMG SRC=\"$path$1.gif\" ALIGN=absmiddle>/gi; $temp =~ s/{=\$(\w*) (.*)=}/<IMG SRC=\"$path$1.gif\" ALIGN=absmiddle ALT=\"$2\">/gi; $temp =~ s/{=\\(\w*)=}/<IMG SRC=\"$path$1.gif\" ALIGN=left>/gi; $temp =~ s/{=\\(\w*) (.*)=}/<IMG SRC=\"$path$1.gif\" ALIGN=left ALT=\"$2\">/gi; $temp =~ s/{=\/(\w*)=}/<IMG SRC=\"$path$1.gif\" ALIGN=right>/gi; $temp =~ s/{=\/(\w*) (.*)=}/<IMG SRC=\"$path$1.gif\" ALIGN=right ALT=\"$2\">/gi; $temp =~ s/{\+(\w*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\"><\/A>/gi; $temp =~ s/{\+(\w*) (.*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALT=\"$2\"><\/A>/gi; $temp =~ s/{\+\$(\w*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALIGN=absmiddle><\/A>/gi; $temp =~ s/{\+\$(\w*) (.*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALIGN=absmiddle ALT=\"$2\"><\/A>/gi; $temp =~ s/{\+\\(\w*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALIGN=left><\/A>/gi; $temp =~ s/{\+\\(\w*) (.*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALIGN=left ALT=\"$2\"><\/A>/gi; $temp =~ s/{\+\/(\w*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALIGN=right><\/A>/gi; $temp =~ s/{\+\/(\w*) (.*)\+}/<A HREF=\"$path$1.jpg\"><IMG SRC=\"$path$1.gif\" ALIGN=right ALT=\"$2\"><\/A>/gi; $temp =~ s/{-(\w*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\"><\/A>/gi; $temp =~ s/{-(\w*) (.*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALT=\"$2\"><\/A>/gi; $temp =~ s/{-\$(\w*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALIGN=absmiddle><\/A>/gi; $temp =~ s/{-\$(\w*) (.*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALIGN=absmiddle ALT=\"$2\"><\/A>/gi; $temp =~ s/{-\\(\w*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALIGN=left><\/A>/gi; $temp =~ s/{-\\(\w*) (.*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALIGN=left ALT=\"$2\"><\/A>/gi; $temp =~ s/{-\/(\w*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALIGN=right><\/A>/gi; $temp =~ s/{-\/(\w*) (.*)-}/<A HREF=\"$path$1L.gif\"><IMG SRC=\"$path$1.gif\" ALIGN=right ALT=\"$2\"><\/A>/gi; $temp =~ s/{#(\w*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\"><\/A>/gi; $temp =~ s/{#(\w*) (.*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALT=\"$2\"><\/A>/gi; $temp =~ s/{#\$(\w*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALIGN=absmiddle><\/A>/gi; $temp =~ s/{#\$(\w*) (.*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALIGN=absmiddle ALT=\"$2\"><\/A>/gi; $temp =~ s/{#\\(\w*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALIGN=left><\/A>/gi; $temp =~ s/{#\\(\w*) (.*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALIGN=left ALT=\"$2\"><\/A>/gi; $temp =~ s/{#\/(\w*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALIGN=right><\/A>/gi; $temp =~ s/{#\/(\w*) (.*)#}/<A HREF=\"$1$html\"><IMG SRC=\"$path$1.gif\" ALIGN=right ALT=\"$2\"><\/A>/gi; $temp =~ s/{M(\w*)M}/<EMBED SRC=\"$path$1.mov\" $movinfo>/g; $temp =~ s/{M\\(\w*)M}/<EMBED SRC=\"$path$1.mov\" ALIGN=left $movinfo>/g; $temp =~ s/{M\/(\w*)M}/<EMBED SRC=\"$path$1.mov\" ALIGN=right $movinfo>/g; $temp =~ s/{M\$(\w*)M}/<EMBED SRC=\"$path$1.mov\" ALIGN=absmiddle $movinfo>/g; $temp =~ s/{M\!(.*)M}/<EMBED SRC=\"$path$1.mov\" AUTOPLAY=\"true\" $movinfo>/g; $temp =~ s/{M\!\\(\w*)M}/<EMBED SRC=\"$path$1.mov\" ALIGN=left AUTOPLAY=\"true\" $movinfo>/g; $temp =~ s/{M\!\/(\w*)M}/<EMBED SRC=\"$path$1.mov\" ALIGN=right AUTOPLAY=\"true\" $movinfo>/g; $temp =~ s/{M\!\$(\w*)M}/<EMBED SRC=\"$path$1.mov\" ALIGN=absmiddle AUTOPLAY=\"true\" $movinfo>/g; $temp =~ s/{A(\w*)A}/<EMBED SRC=\"$path$1.mov\" HIDDEN AUTOPLAY=\"true\" $movinfo>/g; $temp =~ s/{A\!(\w*)A}/<EMBED SRC=\"$path$1.mov\" HIDDEN AUTOPLAY=\"true\" LOOP=\"true\" $movinfo>/g; if (($x = index($temp,"{")) > -1 || ($x = index($temp,"}")) > -1) { $part = substr($temp,$x-3,12); print "WARNING: This file contains unrecognized tags! ...$part...\n"; } $temp =~ s/¾/{/gi; # for { and } in output $temp =~ s/„/}/gi; return $temp; } ### time stamp routine ### sub timestamp { @months = ("January","February","March","April","May","June", "July","August","September","October","November","December",); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # if ($hour < 10) { $zero = "0"; } else { $zero = ""; } # return "$months[$mon] $mday, 19$year at $zero$hour$min"; if ($hour > 11) { $mm = "PM"; } else { $mm = "AM"; } if ($hour > 12) { $hour -= 12; } if ($hour < 1) { $hour = 12; } if ($min < 10) { $min = "0" . $min; } return "$months[$mon] $mday, 19$year"; # return "$months[$mon] $mday, 19$year at $hour:$min $mm"; }