15 |
|
# file() : return the filename corresponding to url of the document |
16 |
|
# ProcessedFile() : return the filename corresponding to processed url |
17 |
|
# of the document |
18 |
< |
# line(number) : Return the line and fileobj corresponding to number in |
18 |
> |
# realline(number): Return the line and fileobj corresponding to number in |
19 |
|
# processed file |
20 |
|
# update() : update the preprocessed file as required. |
21 |
|
# store(filename) : |
36 |
|
"", $self, "", $self); |
37 |
|
} |
38 |
|
|
39 |
< |
sub line { |
39 |
> |
sub realline { |
40 |
|
my $self=shift; |
41 |
|
my $origline=shift; |
42 |
|
|
45 |
|
for(my $i=0; $i<=$#{$self->{includesdesc}}; $i++ ) { |
46 |
|
$inc=$self->{includesdesc}[$i]; |
47 |
|
$startline=$inc->startline(); |
48 |
< |
last if ( $line < $startline ); |
49 |
< |
if ( $line > ($inc->lines()+$startline) ) { |
50 |
< |
$line=$line-$inc->lines()+1+($inc->endline()-$startline); |
48 |
> |
last if ( $line <= $startline ); |
49 |
> |
if ( $line >= ($inc->lines()+$startline+2) ) { |
50 |
> |
$line=$line-($inc->lines()+$startline-$inc->endline())-2; |
51 |
> |
#+($inc->endline()-$startline); |
52 |
|
# n lines in original map to m lines in expanded |
53 |
+ |
print "Included file lines = ".$inc->lines()." +2 \n"; |
54 |
+ |
print "Start tag= $startline , endtag=".$inc->endline()."\n"; |
55 |
|
} |
56 |
|
else { # must be in the include file |
57 |
+ |
print "Passing $line-$startline \n"; |
58 |
|
($line, $fileob)=$self->{includes}[$i]-> |
59 |
< |
line($line-$startline+1); |
59 |
> |
realline($line-$startline); |
60 |
|
} |
61 |
|
} |
62 |
|
|
63 |
|
return ($line, $fileob); |
64 |
|
} |
65 |
|
|
66 |
+ |
sub line { |
67 |
+ |
my $self=shift; |
68 |
+ |
my $line=$self->{currentparser}->line(); |
69 |
+ |
return $line, $self; |
70 |
+ |
} |
71 |
+ |
|
72 |
|
sub url { |
73 |
|
my $self=shift; |
74 |
|
|
124 |
|
} |
125 |
|
|
126 |
|
if ( $rv != 0 ) { |
127 |
< |
print " Need to Update ".$self->url()."\n"; |
127 |
> |
$self->verbose(" Need to Update ".$self->url()); |
128 |
|
# ---- sort out the preprocessed file in the cache |
129 |
|
my $newfile=$self->config()->cache()-> |
130 |
|
filename($outfile); |
136 |
|
$self->config->store($self,$self->url()); |
137 |
|
} |
138 |
|
else { |
139 |
< |
print "No Need to Update ".$self->url()."\n"; |
139 |
> |
$self->verbose("No Need to Update ".$self->url()); |
140 |
|
} |
141 |
|
return $rv; |
142 |
|
} |
161 |
|
$self->parse("include", $self->{fileout}, "include_starttag"); |
162 |
|
|
163 |
|
$self->{fileout}->close(); |
164 |
+ |
$self->verbose("$fileout Created"); |
165 |
|
} |
166 |
|
|
167 |
|
sub store { |