138 |
$words =~ s/\W*\s+\W*/ /g; |
$words =~ s/\W*\s+\W*/ /g; |
139 |
$words =~ s/\W+$//; |
$words =~ s/\W+$//; |
140 |
|
|
141 |
|
# first try to generate headline for this entry from index |
142 |
|
my $h = $ds->{'index'}->[0]; |
143 |
|
# then, from display |
144 |
|
$h ||= $ds->{'display'}->[0]; |
145 |
|
# and as last resport, fallback to headline |
146 |
|
$h ||= $headline; |
147 |
|
|
148 |
$index->insert( |
$index->insert( |
149 |
index_name => $ds->{'tag'}, |
index_name => $ds->{'tag'}, |
150 |
#path => $f, |
#path => $f, |
151 |
path => $webpac->mfn, |
path => $webpac->mfn, |
152 |
headline => $headline, |
headline => $h, |
153 |
words => $words, |
words => $words, |
154 |
); |
); |
155 |
} |
} |
158 |
foreach my $ds (@ds) { |
foreach my $ds (@ds) { |
159 |
next if (! $ds->{'index'}); |
next if (! $ds->{'index'}); |
160 |
|
|
161 |
$thes->{$ds->{'tag'}} ||= new WebPAC::Index; |
$thes->{$ds->{'tag'}} ||= new WebPAC::Index( name => $ds->{'tag'} ); |
162 |
|
|
163 |
foreach my $h (@{$ds->{'index'}}) { |
foreach my $h (@{$ds->{'index'}}) { |
164 |
$thes->{$ds->{'tag'}}->insert( |
$thes->{$ds->{'tag'}}->insert( |
201 |
|
|
202 |
} # XXX if(0) |
} # XXX if(0) |
203 |
|
|
204 |
$log->debug("lookup hash: ",Dump($webpac->{'lookup'})); |
#$log->debug("lookup hash: ",Dump($webpac->{'lookup'})); |
205 |
|
|
206 |
$log->info("creating tree"); |
$log->info("creating tree"); |
207 |
|
|
310 |
}); |
}); |
311 |
|
|
312 |
my $tree = new WebPAC::Tree( |
my $tree = new WebPAC::Tree( |
313 |
dir => './out', |
tree => \@tree, |
314 |
html => 'browse.html', |
); |
315 |
|
|
316 |
|
$tree->output( |
317 |
|
dir => './out', |
318 |
|
html => 'browse.html', |
319 |
template => './output_template/tree.tt', |
template => './output_template/tree.tt', |
320 |
js => 'tree-ids.js', |
js => 'tree-ids.js', |
|
tree => \@tree, |
|
321 |
); |
); |
322 |
|
|
323 |
|
$tree->output( |
324 |
|
dir => './eurovoc', |
325 |
|
html => 'hijerarhija.html', |
326 |
|
template => './output_template/hijerarhija.tt', |
327 |
|
js => 'tree-ids.js', |
328 |
|
); |
329 |
|
|
330 |
|
|
331 |
$log->info("closing index"); |
$log->info("closing index"); |
332 |
$index->close; |
$index->close; |
333 |
|
|