/[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.18 by dpavlin, Fri May 11 23:46:40 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
# Line 528  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 739  sub extract_files { Line 741  sub extract_files {
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.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.26