ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/Switcher.pm
(Generate patch)

Comparing COMP/SCRAM/src/ActiveDoc/Switcher.pm (file contents):
Revision 1.11 by williamc, Thu Nov 18 17:32:53 1999 UTC vs.
Revision 1.14 by williamc, Fri Apr 7 13:39:46 2000 UTC

# Line 13 | Line 13
13   # usegroupchecker(groupchecker)    : Set a groupchecker
14   # parse()                          : Parse the file                            
15   # line()                    : return the current line number of the parse
16 + # tagstartline()            : return the line number on which the current
17 + #                             tag was opened
18   # stream(filehandle)        : stream output to the filehandle if not handled
19   #                               in any other way
20   package ActiveDoc::Switcher;
# Line 103 | Line 105 | sub parse {
105           } # end char while
106          } # End String while loop
107          undef $filehandle;
108 <        $self->_printstream();
108 >        # make sure we close the last buffer
109 >        $self->_calltag($self->{textcontext}, $self->{textcontext},
110 >                                                        $self->_getstore());
111 >        #$self->_printstream();
112   }
113  
114   #
# Line 113 | Line 118 | sub line {
118          my $self=shift;
119          return $self->{linecount};
120   }
121 +
122 + # return the line the current tag was opened
123 + sub tagstartline {
124 +        my $self=shift;
125 +        $self->{tagstart};
126 + }
127   # --------------- Utility routines ----------------------------
128  
129   #
# Line 160 | Line 171 | sub _nextchar() {
171          my $self=shift;
172          my $char;
173          $char=substr($self->{currentline},$self->{stringpos}++,1);
174 < #       print "Debug : Fetching character $char\n";
174 >        #print "Debug : Fetching character $char\n";
175  
176          # Keep a record for any stream processes
177          $self->{streamstore}=$self->{streamstore}.$char;
# Line 172 | Line 183 | sub _opentag {
183          my $self=shift;
184          my $char;
185  
186 +        # Keep a record of where the tag started
187 +        $self->{tagstart}=$self->line();
188 +
189          # Close the last text segment
190          $self->{streamtmp}=$self->_popstream();
191          $self->_calltag($self->{textcontext}, $self->{textcontext},
# Line 201 | Line 215 | sub _closetag {
215          $self->_closelabel();
216          
217          # -- Call the associated tag function if appropriate
218 <        $tagroutine=$self->{tagname}."_".$self->{tagcontext};
219 <        $self->_calltag($tagroutine, $self->{tagname},
218 >        if ( defined $self->{tagname} ) {
219 >         $tagroutine=$self->{tagname}."_".$self->{tagcontext};
220 >         $self->_calltag($tagroutine, $self->{tagname},
221                                                          $self->{tagvar});
222 <        #print "\nDebug : Closing Tag $tagroutine\n";
222 >         #print "\nDebug : Closing Tag $tagroutine\n";
223  
224 <        # -- Now make sure the text context is set for calling routines to
225 <        # -- deal with text portions outside of tags
226 <        if ( $self->{tagcontext} eq "starttag" ) {
224 >         # -- Now make sure the text context is set for calling routines to
225 >         # -- deal with text portions outside of tags
226 >         if ( $self->{tagcontext} eq "starttag" ) {
227            push @{$self->{textstack}} , $self->{textcontext};
228            $self->{textcontext}=$self->{tagname};
229 <        }
230 <        else {
229 >         }
230 >         else {
231            if ( $#{$self->{textstack}} > -1 ) {
232              if ( $self->{textcontext} eq $self->{tagname} ) {  
233                 $self->{textcontext}=pop @{$self->{textstack}};
# Line 227 | Line 242 | sub _closetag {
242               print "Warning : Unmatched </...> tag on line ".
243                                          $self->line()."\n";    
244            }
245 +         }
246          }
247          # Reset context back to text
248          $self->{tagcontext}="text";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines