/[PLies]/burst.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /burst.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by dpavlin, Fri May 11 14:17:27 2001 UTC revision 1.19 by dpavlin, Tue Sep 4 23:10:55 2001 UTC
# Line 135  my %overview_data; Line 135  my %overview_data;
135    
136  my $pack = 0;  my $pack = 0;
137  my @pack_additional;    # additional files to pack (pictures, logos...)  my @pack_additional;    # additional files to pack (pictures, logos...)
138    my %nesttag = init_nesttag();
139    
140  ##############################################################################  ##############################################################################
141  ## reading user input from $infos  ## reading user input from $infos
142  ##  ##
 @PARAM = @ARGV; # we keep this for backward compatibility with an old version  
                 # of the slidemaker tool  
                 #when the parameters were in Makefile or make.bat  
   
143  my @file;  my @file;
144    
145  ##############################################################################  ##############################################################################
# Line 166  sub parse_infos { Line 163  sub parse_infos {
163  }  }
164  ##############################################################################  ##############################################################################
165    
166    parse_infos(@ARGV);     # backward compatibility and for pack
167    
168  # read parameters from infos.txt and put them in @PARAM  # read parameters from infos.txt and put them in @PARAM
169  if (open(INFOS, $infos)) {  if (open(INFOS, $infos)) {
170          print STDERR "--- Reading parameters file $infos ---\n";          print STDERR "--- Reading parameters file $infos ---\n";
# Line 390  sub openOverview Line 389  sub openOverview
389                  author => $author,                  author => $author,
390                  authorUrl => $authorUrl,                  authorUrl => $authorUrl,
391                  author2 => $author2,                  author2 => $author2,
392                  authorUrl2 => $authorUrl2,                  author2Url => $author2Url,
393    
394                  date => $date,                  date => $date,
395    
396                  toc_title => $loc_toc,                  toc_title => $loc_toc,
397                  template => $template,                  template_dir => "$template/",
398          );          );
399    
400  }  }
# Line 412  sub closeOverview Line 411  sub closeOverview
411          $overview_data{toc_entries} = [ @toc_entries ];          $overview_data{toc_entries} = [ @toc_entries ];
412    
413          my $page= new Text::FastTemplate key => 'overview';          my $page= new Text::FastTemplate key => 'overview';
414            $page_data{template_dir}='' if ($pack);
415          print FOO $page->output( \%overview_data );          print FOO $page->output( \%overview_data );
416    
417          close(FOO);          close(FOO);
# Line 529  sub createSlide Line 529  sub createSlide
529          $status =~ s/<[^>]+>//g;          $status =~ s/<[^>]+>//g;
530          print STDERR $status;          print STDERR $status;
531    
532          &verify_html($content);    # check the html          &verify_html($content);         # check the html
533            &check_tags($content);          # check open and closed tags
534    
535          ## write to the slide          ## write to the slide
536          open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!";          open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!";
# Line 594  sub createSlide Line 595  sub createSlide
595                  author => $author,                  author => $author,
596                  authorUrl => $authorUrl,                  authorUrl => $authorUrl,
597                  author2 => $author2,                  author2 => $author2,
598                  authorUrl2 => $authorUrl2,                  author2Url => $author2Url,
599    
600                  date => $date,                  date => $date,
601    
602                  slide_html => $slide_html,                  slide_html => $slide_html,
603    
604                  template => $template,                  template_dir => "$template/",
605          );          );
606    
607          my $page;          my $page;
# Line 609  sub createSlide Line 610  sub createSlide
610          } else {          } else {
611                  $page= new Text::FastTemplate key => 'title';                  $page= new Text::FastTemplate key => 'title';
612          }          }
613            $page_data{template_dir}='' if ($pack);
614          print SLIDE $page->output( \%page_data );          print SLIDE $page->output( \%page_data );
615          extract_files($page->output( \%page_data )) if ($pack);          extract_files($page->output( \%page_data )) if ($pack);
616          close(SLIDE);          close(SLIDE);
# Line 732  sub remove_anchor { Line 734  sub remove_anchor {
734    
735  sub extract_files {  sub extract_files {
736          my $tmp = $_[0];          my $tmp = $_[0];
737          while ($tmp =~ s/<a\s+href="*([^"\s]+)"*//ism ||          while ($tmp =~ s/href="*([^"\s]+)"*//ism ||
738                  $tmp =~ s/<img\s+src="*([^"\s]+)"*//ism) {                  $tmp =~ s/src="*([^"\s]+)"*//ism) {
739                  if ("$1" !~ m/[hf]t?tp:/ && -f "$1" && !grep(/$1/,@pack_additional)) {                  if ("$1" !~ m/[hf]t?tp:/ && -f "$1" && !grep(/$1/,@pack_additional)) {
740                          push @pack_additional,$1;                          push @pack_additional,$1;
741                  }                  }
742          }          }
743  }  }
744    
745    ##############################################################################
746    # check tags in slide
747    # based on code from hindent 1.1.2 by Paul Balyoz <pab@domtools.com>
748    
749    sub init_nesttag {
750    # Tags that require their own end tag <TAG>...</TAG> we will nest them
751    # properly:   (WARNING, you must use lower-case here)
752    # All other tags (not on this list) will be ignored for indenting purposes.
753    return (
754            'html' => 1,
755            'head' => 1,
756            'body' => 1,
757            'title' => 1,
758    
759            'a' => 1,
760    
761            'table' => 1,
762            'tr' => 1,
763            'th' => 1,
764            'td' => 1,
765    
766            'form' => 1,
767            'select' => 1,
768            'textarea' => 1,
769    
770    #       'p' => 1,      Don't do this one because many people use <P> but not </P>
771            'ul' => 1,
772            'ol' => 1,
773            'dl' => 1,
774            'blockquote' => 1,
775            'center' => 1,
776            'div' => 1,
777    
778            'font' => 1,
779            'pre' => 1,
780            'tt' => 1,
781            'i' => 1,
782            'b' => 1,
783            'u' => 1,
784            'strike' => 1,
785            'big' => 1,
786            'small' => 1,
787            'sub' => 1,
788            'sup' => 1,
789            'em' => 1,
790            'strong' => 1,
791            'dfn' => 1,
792            'code' => 1,
793            'samp' => 1,
794            'kbd' => 1,
795            'var' => 1,
796            'cite' => 1,
797    
798            'h1' => 1,
799            'h2' => 1,
800            'h3' => 1,
801            'h4' => 1,
802            'h5' => 1,
803            'h6' => 1,
804    
805            'applet' => 1,
806    
807            'map' => 1,
808    
809            'frameset' => 1,
810            'noframes' => 1,
811    );
812    }
813    
814    sub check_tags {
815            my $tmp = $_[0];
816            my @tagstack;
817            my $level=0;
818    
819            while ($tmp =~ /<(.*?)>/gsm) {
820                    my $tag=$1; $tag=~s/\s.+//g;
821                    # if regular tag, push it on stack; if end-tag, pop it off stack.
822                    # but don't do any of this if it's not a special "nesting" tag!
823                    if ($tag !~ m,^/,) {
824                            if ($nesttag{lc($tag)}) {
825                                    push @tagstack,$tag;
826                                    $level++;               # remember how much for later
827                            }
828                    } else {
829                            $tag =~ s,^/,,;         # convert this end-tag to a begin-tag
830                            $tag = lc($tag);
831                            if ($nesttag{lc($tag)}) {
832                                    # throw away tags until we find a match
833                                    if ($#tagstack > -1) {
834                                            while ($tag ne lc(pop @tagstack)) {
835                                                    $level--;       # we threw away extra tags
836                                                    last if $#tagstack <= 0;
837                                            }
838                                            $level--;       # we threw away extra tags
839                                            if ($level < 0) {
840                                                    print STDERR "WARNING: more end than begin tags around </$tag> !\n";
841                                            }
842                                    }
843                            }
844                    }
845            }
846    
847            if ($level > 0) {
848                    print STDERR "WARNING: level=$level, ", $#tagstack+1," tags left on stack after done parsing!  Specifically:\n<",join("> <",@tagstack),">\n";
849            }
850    
851    }
852    

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.26