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; |
115 |
|
my $self=shift; |
116 |
|
return $self->{linecount}; |
117 |
|
} |
118 |
+ |
|
119 |
+ |
# return the line the current tag was opened |
120 |
+ |
sub tagstartline { |
121 |
+ |
my $self=shift; |
122 |
+ |
$self->{tagstart}; |
123 |
+ |
} |
124 |
|
# --------------- Utility routines ---------------------------- |
125 |
|
|
126 |
|
# |
180 |
|
my $self=shift; |
181 |
|
my $char; |
182 |
|
|
183 |
+ |
# Keep a record of where the tag started |
184 |
+ |
$self->{tagstart}=$self->line(); |
185 |
+ |
|
186 |
|
# Close the last text segment |
187 |
|
$self->{streamtmp}=$self->_popstream(); |
188 |
|
$self->_calltag($self->{textcontext}, $self->{textcontext}, |
212 |
|
$self->_closelabel(); |
213 |
|
|
214 |
|
# -- Call the associated tag function if appropriate |
215 |
< |
$tagroutine=$self->{tagname}."_".$self->{tagcontext}; |
216 |
< |
$self->_calltag($tagroutine, $self->{tagname}, |
215 |
> |
if ( defined $self->{tagname} ) { |
216 |
> |
$tagroutine=$self->{tagname}."_".$self->{tagcontext}; |
217 |
> |
$self->_calltag($tagroutine, $self->{tagname}, |
218 |
|
$self->{tagvar}); |
219 |
< |
#print "\nDebug : Closing Tag $tagroutine\n"; |
219 |
> |
#print "\nDebug : Closing Tag $tagroutine\n"; |
220 |
|
|
221 |
< |
# -- Now make sure the text context is set for calling routines to |
222 |
< |
# -- deal with text portions outside of tags |
223 |
< |
if ( $self->{tagcontext} eq "starttag" ) { |
221 |
> |
# -- Now make sure the text context is set for calling routines to |
222 |
> |
# -- deal with text portions outside of tags |
223 |
> |
if ( $self->{tagcontext} eq "starttag" ) { |
224 |
|
push @{$self->{textstack}} , $self->{textcontext}; |
225 |
|
$self->{textcontext}=$self->{tagname}; |
226 |
< |
} |
227 |
< |
else { |
226 |
> |
} |
227 |
> |
else { |
228 |
|
if ( $#{$self->{textstack}} > -1 ) { |
229 |
|
if ( $self->{textcontext} eq $self->{tagname} ) { |
230 |
|
$self->{textcontext}=pop @{$self->{textstack}}; |
239 |
|
print "Warning : Unmatched </...> tag on line ". |
240 |
|
$self->line()."\n"; |
241 |
|
} |
242 |
+ |
} |
243 |
|
} |
244 |
|
# Reset context back to text |
245 |
|
$self->{tagcontext}="text"; |
385 |
|
} |
386 |
|
else { |
387 |
|
die ">Tag syntax error in $self->{tagname} on line ". |
388 |
< |
$self->line()."of file \n$self->{filename}"; |
388 |
> |
$self->line()." of file \n$self->{filename}"; |
389 |
|
} |
390 |
|
} |
391 |
|
$self->_resetstore(); |