source: trunk/gsdl/perllib/plugins/W3ImgPlug.pm@ 9853

Last change on this file since 9853 was 9853, checked in by kjdon, 19 years ago

fixed up maxdocs - now pass an extra parameter to the read function

  • Property svn:keywords set to Author Date Id Revision
File size: 37.5 KB
Line 
1###########################################################################
2#
3# W3ImgPlug.pm -- Context-based image indexing plugin for HTML documents
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 2001 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26
27# DESCRIPTION:
28#
29# Extracts images and associated text and metadata from
30# web pages as individual documents for indexing. Thumbnails
31# are created from each image for browsing purposes.
32#
33# Options are available for configuring the aggressiveness of the
34# associated text extraction mechanisms. A higher level of
35# aggressiveness will extract more text and consequently
36# may mean lower accuracy (precision); however, it may also
37# retrieve more of the relevant images from the collection (recall).
38# Lower levels of aggressiveness maybe result in slightly faster
39# collection builds at the import stage.
40#
41# W3ImgPlug is a subclass of HTMLPlug (i.e. it will index pages also
42# if required). It can be used in place of HTMLPlug to index both
43# pages and their images.
44#
45# REQUIREMENTS:
46#
47# The ImageMagick image manipulation is used to create
48# thumbnails and extract some image metadata. (Available
49# from http://www.imagemagick.org/)
50#
51# Unix:
52# Many Linux distributions contain ImageMagick.
53#
54# Windows:
55# ImageMagick can be downloaded from the website above.
56# Make sure the system path includes the ImageMagick binaries
57# before using W3ImgPlug.
58#
59# NOTE: NT/2000/XP contain a filesystem utility 'convert.exe'
60# with the same name as the image conversion utility. The
61# ImageMagick FAQ recommends renaming the filesystem
62# utility (e.g. to 'fsconvert.exe') to avoid this clash.
63#
64# USAGE:
65#
66# An image document consists of metadata elements:
67#
68# OriginalFilename, FilePath, Filename, FileExt, FileSize,
69# Width, Height, URL, PageURL, ThumbURL, CacheURL, CachePageURL
70# ImageText, PageTitle
71#
72# Most of these are only useful in format strings (e.g. ThumbURL,
73# Filename, URL, PageURL, CachePageURL).
74#
75# ImageText, as the name suggests contains the indexable text.
76# (unless using the -document_text plugin option)
77#
78# Since image documents are made up of metadata elements
79# alone, format strings are needed to display them properly.
80# NOTE: The receptionist will only display results (e.g. thumbnails)
81# in 4 columns if the format string begins with "<td><table>".
82#
83# The example below takes the user to the image within the
84# source HTML document rather than using a format string
85# on DocumentText to display the image document itself.
86#
87# Example collect.cfg:
88#
89# ...
90#
91# indexes document:ImageText document:text
92# defaultindex document:ImageText
93#
94# collectionmeta .document:ImageText "images"
95# collectionmeta .document:text "documents"
96#
97# ...
98#
99# plugin W3ImgPlug -index_pages -aggressiveness 6
100#
101# ...
102#
103# format SearchVList '<td>{If}{[Title],[link][icon]&nbsp;[Title][[/link],
104# <table><tr><td align="center"><a href="[CachePageURL]">
105# <img src="[ThumbURL]"></a></td></tr><tr><td align="center">
106# <a href="[CachePageURL]"><font size="-1">[OriginalFilename]</font></a>
107# <br>[Width]x[Height]</td></tr></table>}</td>'
108#
109# ...
110#
111
112package W3ImgPlug;
113
114use HTMLPlug;
115use ghtml;
116use unicode;
117use util;
118use parsargv;
119use strict 'subs';
120
121sub BEGIN {
122 @ISA = qw( HTMLPlug );
123}
124
125my $aggressiveness_list =
126 [ { 'name' => "1",
127 'desc' => "{W3ImgPlug.aggressiveness.1}" },
128 { 'name' => "2",
129 'desc' => "{W3ImgPlug.aggressiveness.2}" },
130 { 'name' => "3",
131 'desc' => "{W3ImgPlug.aggressiveness.3}" },
132 { 'name' => "4",
133 'desc' => "{W3ImgPlug.aggressiveness.4}" },
134 { 'name' => "5",
135 'desc' => "{W3ImgPlug.aggressiveness.5}" },
136 { 'name' => "6",
137 'desc' => "{W3ImgPlug.aggressiveness.6}" },
138 { 'name' => "7",
139 'desc' => "{W3ImgPlug.aggressiveness.7}" },
140 { 'name' => "8",
141 'desc' => "{W3ImgPlug.aggressiveness.8}" },
142 { 'name' => "9",
143 'desc' => "{W3ImgPlug.aggressiveness.9}" } ];
144
145my $arguments =
146 [ { 'name' => "aggressiveness",
147 'desc' => "{W3ImgPlug.aggressiveness}",
148 'type' => "int",
149 'list' => $aggressiveness_list,
150 'deft' => "3",
151 'reqd' => "no" },
152 { 'name' => "index_pages",
153 'desc' => "{W3ImgPlug.index_pages}",
154 'type' => "flag",
155 'reqd' => "no" },
156 { 'name' => "no_cache_images",
157 'desc' => "{W3ImgPlug.no_cache_images}",
158 'type' => "flag",
159 'reqd' => "no" },
160 { 'name' => "min_size",
161 'desc' => "{W3ImgPlug.min_size}",
162 'type' => "int",
163 'deft' => "2000",
164 'reqd' => "no" },
165 { 'name' => "min_width",
166 'desc' => "{W3ImgPlug.min_width}",
167 'type' => "int",
168 'deft' => "50",
169 'reqd' => "no" },
170 { 'name' => "min_height",
171 'desc' => "{W3ImgPlug.min_height}",
172 'type' => "int",
173 'deft' => "50",
174 'reqd' => "no" },
175 { 'name' => "thumb_size",
176 'desc' => "{W3ImgPlug.thumb_size}",
177 'type' => "int",
178 'deft' => "100",
179 'reqd' => "no" },
180 { 'name' => "convert_params",
181 'desc' => "{W3ImgPlug.convert_params}",
182 'type' => "string",
183 'deft' => "",
184 'reqd' => "no" },
185 { 'name' => "min_near_text",
186 'desc' => "{W3ImgPlug.min_near_text}",
187 'type' => "int",
188 'deft' => "10",
189 'reqd' => "no" },
190 { 'name' => "max_near_text",
191 'desc' => "{W3ImgPlug.max_near_text}",
192 'type' => "int",
193 'deft' => "400",
194 'reqd' => "no" },
195 { 'name' => "smallpage_threshold",
196 'desc' => "{W3ImgPlug.smallpage_threshold}",
197 'type' => "int",
198 'deft' => "2048",
199 'reqd' => "no" },
200 { 'name' => "textrefs_threshold",
201 'desc' => "{W3ImgPlug.textrefs_threshold}",
202 'type' => "int",
203 'deft' => "2",
204 'reqd' => "no" },
205 { 'name' => "caption_length",
206 'desc' => "{W3ImgPlug.caption_length}",
207 'type' => "int",
208 'deft' => "80",
209 'reqd' => "no" },
210 { 'name' => "neartext_length",
211 'desc' => "{W3ImgPlug.neartext_length}",
212 'type' => "int",
213 'deft' => "300",
214 'reqd' => "no" },
215 { 'name' => "document_text",
216 'desc' => "{W3ImgPlug.document_text}",
217 'type' => "flag",
218 'reqd' => "no" } ];
219
220my $options = { 'name' => "W3ImgPlug",
221 'desc' => "{W3ImgPlug.desc}",
222 'abstract' => "no",
223 'inherits' => "yes",
224 'args' => $arguments };
225
226sub new {
227 my $class = shift (@_);
228 my $self = new HTMLPlug ($class, @_);
229 $self->{'plugin_type'} = "W3ImgPlug";
230 # 14-05-02 To allow for proper inheritance of arguments - John Thompson
231 my $option_list = $self->{'option_list'};
232 push( @{$option_list}, $options );
233
234 if (!parsargv::parse(\@_,
235 q^aggressiveness/\d/3^, \$self->{'aggressiveness'},
236 q^index_pages^, \$self->{'index_pages'},
237 q^no_cache_images^, \$self->{'no_cache_images'},
238 q^min_size/\d*/2000^, \$self->{'min_img_filesize'},
239 q^min_width/\d*/50^, \$self->{'min_img_width'},
240 q^min_height/\d*/50^, \$self->{'min_img_height'},
241 q^thumb_size/\d*/100^, \$self->{'thumbnail_size'},
242 q^convert_params/.*/ ^, \$self->{'img_convert_param'},
243 q^max_near_text/\d*/400^, \$self->{'maxtext'},
244 q^min_near_text/\d*/10^, \$self->{'mintext'},
245 q^smallpage_threshold/\d*/2048^, \$self->{'smallpage_threshold'},
246 q^textrefs_threshold/\d*/2^, \$self->{'textref_threshold'},
247 q^caption_length/\d*/80^, \$self->{'caption_len'},
248 q^neartext_length/\d*/300^, \$self->{'neartext_len'},
249 q^document_text^, \$self->{'document_text'},
250 "allow_extra_options"
251 )) {
252
253 print STDERR "\nIncorrect options passed to W3ImgPlug, check your collect.cfg configuration file\n";
254 $self->print_txt_usage(""); # Use default resource bundle
255 die "\n";
256 }
257
258 # init class variables
259 $self->{'textref'} = undef; # init by read_file fn
260 $self->{'htdoc_obj'} = undef; # init by process fn
261 $self->{'htpath'} = undef; # init by process fn
262 $self->{'hturl'} = undef; # init by process fn
263 $self->{'plaintext'} = undef; # HTML stripped version - only init if needed by raw_neartext sub
264 $self->{'smallpage'} = 0; # set by process fn
265 $self->{'images_indexed'} = undef; # num of images indexed - if 1 or 2 then we know page is small
266 $self->{'initialised'} = undef; # flag (see set_extraction_options())
267
268 return bless $self, $class;
269}
270
271# if indexing pages, let HTMLPlug do it's stuff
272# image extraction done through read()
273sub process {
274 my ($self, $textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_;
275 $self->{'imglist'} = ();
276 if ( $self->{'index_pages'} ) {
277 my $ok = $self->SUPER::process($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj);
278 if ( ! $ok ) { return $ok }
279 $self->{'htdoc_obj'} = $doc_obj;
280 }
281 # else use URL for referencing
282 #if ( $file =~ /(.*)[\/\\]/ ) { $self->{'htpath'} = $1; } else { $self->{'htpath'} = $file; }
283
284 $self->{'htpath'} = $base_dir if (-d $base_dir);
285 if ( $file =~ /(.*)[\/\\]/ ) { $self->{'htpath'} .= "/$1"; }
286 $self->{'htpath'} =~ s/\\/\//g; # replace \ with /
287
288 $self->{'hturl'} = "http://$file";
289 $self->{'hturl'} =~ s/\\/\//g; # for windows
290 ($self->{'filename'}) = $file =~ /.*[\/\\](.*)/;
291 ($self->{'base_path'}) = $file =~ /(.*)[\/\\]/i;
292 if ( ( -s "$base_dir/$file") <= $self->{'smallpage_threshold'} ) {
293 $self->{'smallpage'} = 1;
294 } else { $self->{'smallpage'} = 0; }
295
296 if ( defined($self->{'initialised'}) ) { return 1; }
297 else {
298 $self->{'initialised'} = $self->set_extraction_options($base_dir =~ /^(.*?)\/import/i);
299 return $self->{'initialised'};
300 }
301}
302
303# get complex configuration options from configuration files
304# -- $GSDLCOLLECTION/etc/W3ImgPlug.cfg (tag sets for aggr 2+)
305# -- $GSDLHOME/etc/packages/phind/stopword/en/brown.sw (stopwords for aggr 5+)
306
307# If there's no W3ImgPlug.cfg file we'll use the following default values
308my $defaultcfg = '
309<delimitertagset>
310 <setname>Caption</setname>
311 <taggroup>font</taggroup>
312 <taggroup>tt</taggroup>
313 <taggroup>small</taggroup>
314 <taggroup>b</taggroup>
315 <taggroup>i</taggroup>
316 <taggroup>u</taggroup>
317 <taggroup>em</taggroup>
318 <taggroup>td</taggroup>
319 <taggroup>li</taggroup>
320 <taggroup>a</taggroup>
321 <taggroup>p</taggroup>
322 <taggroup>tr</taggroup>
323 <taggroup>center</taggroup>
324 <taggroup>div</taggroup>
325 <taggroup>caption</taggroup>
326 <taggroup>br</taggroup>
327 <taggroup>ul</taggroup>
328 <taggroup>ol</taggroup>
329 <taggroup>table</taggroup>
330 <taggroup>hr</taggroup>
331</delimitertagset>
332
333<delimitertagset>
334 <setname>Neartext</setname>
335 <taggroup>tr|hr|table|h\d|img|body</taggroup>
336 <taggroup>td|tr|hr|table|h\d|img|body</taggroup>
337 <taggroup>p|br|td|tr|hr|table|h\d|img|body</taggroup>
338 <taggroup>font|p|i|b|em|img</taggroup>
339</delimitertagset>
340';
341
342sub set_extraction_options() {
343 my ($self, $collpath) = @_;
344 my ($filepath);
345
346 print {$self->{'outhandle'}} "W3ImgPlug: Initialising\n"
347 if $self->{'verbosity'} > 1;
348 # etc/W3ImgPlug.cfg (XML)
349 # tag sets for captions and neartext
350 if ( $self->{'aggressiveness'} > 1 && $self->{'aggressiveness'} != 9 ) {
351 $self->{'delims'} = [];
352 $self->{'cdelims'} = [];
353 my ($cfg, @tagsets, $tagset, $type, @delims);
354
355 $filepath = "$collpath/etc/W3ImgPlug.cfg";
356 if ( open CFG, "<$filepath" ) {
357 while (<CFG>) { $cfg .= $_ }
358 close CFG;
359 } else {
360 $cfg = $defaultcfg;
361 }
362
363 (@tagsets) =
364 $cfg =~ /<delimitertagset>(.*?)<\/delimitertagset>/igs;
365 foreach $tagset ( @tagsets ) {
366 ($type) = $tagset =~ /<setname>(.*?)<\/setname>/i;
367 if ( lc($type) eq "caption" ) {
368 (@{$self->{'cdelims'}}) = $tagset =~ /<taggroup>(.*?)<\/taggroup>/igs;
369 }
370 elsif ( lc($type) eq "neartext" ) {
371 (@{$self->{'delims'}}) = $tagset =~ /<taggroup>(.*?)<\/taggroup>/igs;
372 }
373 }
374
375 # output a warning if there seem to be no delimiters
376 if ( scalar(@{$self->{'cdelims'}} == 0)) {
377 print {$self->{'outhandle'}} "W3ImgPlug: Warning: no caption delimiters found in $filepath\n";
378 }
379 if ( scalar(@{$self->{'delims'}} == 0)) {
380 print {$self->{'outhandle'}} "W3ImgPlug: Warning: no neartext delimiters found in $filepath\n";
381 }
382 }
383
384 # get stop words for textual reference extraction
385 # TODO: warnings scroll off. Would be best to output them again at end of import
386 if ( $self->{'aggressiveness'} >=5 && $self->{'aggressiveness'} != 9 ) {
387 $self->{'stopwords'} = ();
388 $filepath = &util::filename_cat($ENV{'GSDLHOME'}, "etc", "packages", "phind", "stopword", "en", "brown.sw");
389 if ( open STOPWORDS, "<$filepath" ) {
390 while ( <STOPWORDS> ) {
391 chomp;
392 $self->{'stopwords'}{$_} = 1;
393 }
394 close STOPWORDS;
395 } else {
396 print {$self->{'outhandle'}} "W3ImgPlug: Warning: couldn't open stopwords file at $filepath ($!)\n";
397 }
398
399 }
400
401 if ( $self->{'neartext_len'} > $self->{'maxtext'} ) {
402 $self->{'maxtext'} = $self->{'neartext_len'} * 1.33;
403 print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'maxtext'}\n";
404 }
405 if ( $self->{'caption_len'} > $self->{'maxtext'} ) {
406 $self->{'maxtext'} = $self->{'caption_len'} * 1.33;
407 print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'maxtext'}\n";
408 }
409
410 return 1;
411}
412
413# return number of files processed, undef if can't recognise, -1 if
414# cant process
415# Note that $base_dir might be "" and that $file might
416# include directories
417sub read {
418 my ($self, $pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = (@_);
419 my ($doc_obj, $section, $filepath, $imgtag, $pos, $context, $numdocs, $tndir, $imgs);
420 # forward normal read (runs HTMLPlug if index_pages T)
421 my $ok = $self->SUPER::read($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli);
422 if ( ! $ok ) { return $ok } # what is this returning??
423
424 my $outhandle = $self->{'outhandle'};
425 my $textref = $self->{'textref'};
426 my $htdoc_obj = $self->{'htdoc_obj'};
427 $numdocs = 0;
428 $base_dir =~ /(.*)\/.*/;
429 $tndir = "$1/archives/thumbnails"; # TODO: this path shouldn't be hardcoded?
430 &util::mk_all_dir($tndir) unless -e "$tndir";
431
432 $imgs = \%{$self->{'imglist'}};
433 my $nimgs = $self->get_img_list($textref);
434 $self->{'images_indexed'} = $nimgs;
435 if ( $nimgs > 0 ) {
436 my @fplist = (sort { $imgs->{$a}{'pos'} <=> $imgs->{$b}{'pos'} } keys %{$imgs});
437 my $i = 0;
438 foreach $filepath ( @fplist ) {
439 $pos = $imgs->{$filepath}{'pos'};
440 $context = substr ($$textref, $pos - 50, $pos + 50); # grab context (quicker)
441 ($imgtag) = ($context =~ /(<(?:img|a|body)\s[^>]*$filepath[^>]*>)/is );
442 if (! defined($imgtag)) { $imgtag = $filepath }
443 print $outhandle "W3ImgPlug: extracting $filepath\n"
444 if ( $self->{'verbosity'} > 1 );
445 $doc_obj = new doc ("", "indexed_doc");
446 $section = $doc_obj->get_top_section();
447 $prevpos = ( $i == 0 ? 0 : $imgs->{$fplist[$i - 1]}{'pos'});
448 $nextpos = ( $i >= ($nimgs -1) ? -1 : $imgs->{$fplist[$i + 1]}{'pos'} );
449
450 $self->extract_image_info($imgtag, $filepath, $textref, $doc_obj, $section, $tndir, $prevpos, $nextpos);
451 $processor->process($doc_obj);
452 $numdocs++;
453 $i++;
454 }
455 return $numdocs;
456 } else {
457 print $outhandle "W3ImgPlug: No images from $file indexed\n"
458 if ( $self->{'verbosity'} > 2 );
459 return 1;
460 }
461
462}
463
464# for every valid image tag
465# 1. extract related text and image metadata
466# 2. add this as document meta-data
467# 3. add assoc image(s) as files
468#
469sub extract_image_info {
470 my $self = shift (@_);
471 my ($tag, $id, $textref, $doc_obj, $section, $tndir, $prevpos, $nextpos) = (@_);
472 my ($filename, $orig_fp, $fn, $ext, $reltext, $relreltext, $crcid, $imgs,
473 $thumbfp, $pagetitle, $alttext, $filepath, $aggr);
474 $aggr = $self->{'aggressiveness'};
475 $imgs = \%{$self->{'imglist'}};
476 $filepath = $imgs->{$id}{'relpath'};
477 ($filename) = $filepath =~ /([^\/\\]+)$/s;
478 ($orig_fp) = "$self->{'base_path'}/$filepath";
479 $orig_fp =~ tr/+/ /;
480 $orig_fp =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # translate %2E to space, etc
481 $orig_fp =~ s/\\/\//g;
482 $filepath = "$self->{'htpath'}/$filepath";
483 ($onlyfn) = $filename =~ /([^\\\/]*)$/;
484 ($fn, $ext) = $onlyfn =~ /(.*)\.(.*)/;
485 $fn = lc $fn; $ext = lc $ext;
486 ($reltext) = "<tr><td>GifComment</td><td>" . `identify $filepath -ping -format "%c"` . "</td></tr>\n"
487 if ($ext eq "gif");
488 $reltext .= "<tr><td>FilePath</td><td>$orig_fp</td></tr>\n";
489
490 if ($ENV{'GSDLOS'} =~ /^windows$/i) {
491 $crcid = "$fn.$ext." . $self->{'next_crcid'}++;
492 } else { ($crcid) = `cksum $filepath` =~ /^(\d+)/; }
493 $thumbfp = "$tndir/tn_$crcid.jpg";
494 `convert -flatten -filter Hanning $self->{'img_convert_param'} -geometry "$self->{'thumbnail_size'}x$self->{'thumbnail_size'}>" $filepath $thumbfp` unless -e $thumbfp;
495 if ( ! (-e $thumbfp) ) {
496 print STDERR "W3ImgPlug: 'convert' failed. Check ImageMagicK binaries are installed and working correctly\n"; return 0;
497 }
498
499 # shove in full text (tag stripped or unstripped) if settings require it
500 if ( $aggr == 10) {
501 $reltext = "<tr><td>AllPage</td><td>" . $$textref . "</td><tr>\n"; # level 10 (all text, verbatim)
502 } else {
503 $pagetitle = $self->get_meta_value("title", $textref);
504 ($alttext) = $tag =~ /\salt\s*=\s*(?:\"|\')(.+?)(?:\"|\')/is;
505 if ( defined($alttext) && length($alttext) > 1) {
506 $reltext .= "<tr><td>ALTtext</td><td>$alttext</td></tr>\n"; }
507 $reltext .= "<tr><td>SplitCapitalisation</td><td>" .
508 $self->split_filepath($orig_fp) . "</td></tr>\n";
509
510 # get caption/tag based near text (if appropriate)
511 if ( $aggr > 1 ) {
512 if ( $aggr >= 2 ) {
513 $reltext .=
514 $self->extract_caption_text($tag, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos);
515 $relreltext = $reltext;
516 }
517 # repeat the filepath, alt-text, caption, etc
518 if ( $aggr == 8 ) {
519 $reltext .= $relreltext;
520 }
521 if ( $aggr >= 3 ) {
522 $reltext .=
523 $self->extract_near_text($tag, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos);
524 }
525
526 # get page metadata (if appropriate)
527 if ( $aggr >= 6 || ( $aggr >= 2 &&
528 ( $self->{'images_indexed'} < 2 ||
529 ($self->{'smallpage'} == 1 && $self->{'images_indexed'} < 6 )))) {
530 $reltext .= $self->get_page_metadata($textref);
531 }
532 # textual references
533 if ( $aggr == 5 || $aggr >= 7) {
534 if ( length($relreltext) > ($self->{'caption_len'} * 2) ) {
535 $reltext .= $self->get_textrefs($relreltext, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos); }
536 else {
537 $reltext .= $self->get_textrefs($reltext, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos);
538 }
539 }
540 } # aggr > 1
541 } # aggr != 10
542
543 $doc_obj->set_OID($crcid);
544 $doc_obj->associate_file($thumbfp, "$fn.thumb.jpg", undef, $section);
545 $doc_obj->add_metadata($section, "OriginalFilename", $filename);
546 $doc_obj->add_metadata($section, "FilePath", $orig_fp);
547 $doc_obj->add_metadata($section, "Filename", $fn);
548 $doc_obj->add_metadata($section, "FileExt", $ext);
549 $doc_obj->add_metadata($section, "FileSize", $imgs->{$id}{'filesize'});
550 $doc_obj->add_metadata($section, "Width", $imgs->{$id}{'width'});
551 $doc_obj->add_metadata($section, "Height", $imgs->{$id}{'height'});
552 $doc_obj->add_metadata($section, "URL", "http://$orig_fp");
553 $doc_obj->add_metadata($section, "PageURL", $self->{'hturl'});
554 $doc_obj->add_metadata($section, "PageTitle", $pagetitle);
555 $doc_obj->add_metadata($section, "ThumbURL",
556 "_httpcollection_/index/assoc/[archivedir]/$fn.thumb.jpg");
557 $doc_obj->add_metadata($section, "FileFormat", "W3Img");
558
559 if ( $self->{'document_text'} ) {
560 $doc_obj->add_utf8_text($section, "<table border=1>\n$reltext</table>");
561 } else {
562 $doc_obj->add_metadata($section, "ImageText", "<table border=1>\n$reltext</table>\n");
563 }
564
565 if ( $self->{'index_pages'} ) {
566 my ($cache_url) = "_httpdoc_&d=" . $self->{'htdoc_obj'}->get_OID();
567 if ( $imgs->{$id}{'anchored'} ) {
568 my $a_name = $id;
569 $a_name =~ s/[\/\\\:\&]/_/g;
570 $cache_url .= "#gsdl_$a_name" ;
571 }
572 $doc_obj->add_utf8_metadata($section, "CachePageURL", $cache_url);
573 }
574 if ( ! $self->{'no_cache_images'} ) {
575 $onlyfn = lc $onlyfn;
576 $doc_obj->associate_file($filepath, $onlyfn, undef, $section);
577 $doc_obj->add_utf8_metadata($section, "CacheURL",
578 "_httpcollection_/index/assoc/[archivedir]/$onlyfn");
579 }
580 return 1;
581}
582
583sub get_page_metadata {
584 my ($self, $textref) = (@_);
585 my (@rval);
586 $rval[0] = $self->get_meta_value("title", $textref);
587 $rval[1] = $self->get_meta_value("keywords", $textref);
588 $rval[2] = $self->get_meta_value("description", $textref);
589 $rval[3] = $self->{'filename'};
590
591 return wantarray ? @rval : "<tr><td>PageMeta</td><td>@rval</td></tr>\n" ;
592}
593
594# turns LargeCatFish into Large,Cat,Fish so MG sees the separate words
595sub split_filepath {
596 my ($self, $filepath) = (@_);
597 my (@words) = $filepath =~ /([A-Z][a-z]+)/g;
598 return join(',', @words);
599}
600
601# finds and extracts sentences
602# that seem to be on the same topic
603# as other related text (correlations)
604# and textual references (e.g. in figure 3 ...)
605sub get_textrefs {
606 my ($self, $reltext, $textref, $prevpos, $pos, $nextpos) = (@_);
607 my ($maxtext, $mintext, $startpos, $context_size, $context);
608
609 my (@relwords, @refwords, %sentences, @pagemeta);
610
611 # extract larger context
612 $maxtext = $self->{'maxtext'};
613 $startpos = $pos - ($maxtext * 4);
614 $context_size = $maxtext*10;
615 if ($startpos < $prevpos ) { $startpos = $prevpos }
616 if ($nextpos != -1 && $context_size > ( $nextpos - $startpos )) { $context_size = ($nextpos - $startpos) }
617 $context = substr ( $$textref, $startpos, $context_size );
618 $context =~ s/<.*?>//gs;
619 $context =~ s/^.*>(.*)/$1/gs;
620 $context =~ s/(.*)<.*$/$1/gs;
621
622 # get page meta-data (if not already included)
623 if ( $self->{'aggressiveness'} == 5 && ! $self->{'smallpage'} ) {
624 @pagemeta = $self->get_page_metadata($textref);
625 foreach $value ( @pagemeta ) {
626 $context .= "$value."; # make each into psuedo-sentence
627 }
628 }
629
630 # TODO: this list is not exhaustive
631 @refwords = ( '(?:is|are)? ?(?:show(?:s|n)|demonstrate(?:d|s)|explains|features) (?:in|by|below|above|here)',
632 '(?:see)? (?:figure|table)? (?:below|above)');
633
634 # extract general references
635 foreach $rw ( @refwords ) {
636 while ( $context =~ /[\.\?\!\,](.*?$rw\W.*?[\.\?\!\,])/ig ) {
637 $sentence = $1;
638 $sentence =~ s/\s+/ /g;
639 $sentences{$sentence}+=2;
640 }
641 }
642 # extract specific (figure, table) references by number
643 my ($fignum) = $context =~ /[\.\?\!].*?(?:figure|table)s?[\-\_\ \.](\d+\w*)\W.*?[\.\?\!]/ig;
644 if ( $fignum ) {
645 foreach $rw ( @refwords ) {
646 while ( $context =~ /[\.\?\!](.*?(figure|table)[\-\_\ \.]$fignum\W.*?[\.\?\!])/ig ) {
647 $sentence = $1;
648 $sentence =~ s/\s+/ /g;
649 $sentences{$sentence}+=4;
650 }
651 }
652 }
653
654 # sentences with occurances of important words
655 @relwords = $reltext =~ /([a-zA-Z]{4,})/g; # take out small words
656 foreach $word ( @relwords ) {
657 if ( $self->{'stopwords'}{$word} ) { next } # skip stop words
658 while ( $context =~ /([^\.\?\!]*?$word\W.*?[\.\?\!])/ig ) {
659 $sentence = $1;
660 $sentence =~ s/\s+/ /g;
661 $sentences{$sentence}++;
662 }
663 }
664 foreach $sentence ( keys %sentences ) {
665 if ($sentences{$sentence} < $self->{'textref_threshold'}) {
666 delete $sentences{$sentence};
667 }
668 }
669 my ($rval) = join "<br>\n", (keys %sentences);
670 if ( $rval && length($rval) > 5 ) {
671 return ( "<tr><td>TextualReferences</td><td>" . $rval . "</td></tr>\n") }
672 else { return "" }
673}
674
675# handles caption extraction
676# calling the extractor with different
677# tags and choosing the best candidate caption
678sub extract_caption_text {
679 my ($self, $tag, $textref, $prevpos, $pos, $nextpos) = (@_);
680 my (@neartext, $len, $hdelim, $goodlen,
681 $startpos, $context, $context_size);
682
683 $mintext = $self->{'mintext'};
684 $goodlen = $self->{'caption_len'};
685
686 # extract a context to extract near text from (faster)
687 $context_size = $self->{'maxtext'}*3;
688 $startpos = $pos - ($context_size / 2);
689 if ($startpos < $prevpos ) { $startpos = $prevpos }
690 if ($nextpos != -1 && $context_size > ( $nextpos - $startpos ))
691 { $context_size = ($nextpos - $startpos) }
692
693 $context = substr ( $$textref, $startpos, $context_size );
694 $context =~ s/<!--.*?-->//gs;
695 $context =~ s/^.*-->(.*)/$1/gs;
696 $context =~ s/(.*)<!--.*$/$1/gs;
697
698 # try stepping through markup delimiter sets
699 # and selecting the best one
700 foreach $hdelim ( @{ $self->{'cdelims'} } ) {
701 @neartext = $self->extract_caption($tag, $hdelim, \$context);
702 $len = length(join("", @neartext));
703 last if ($len >= $mintext && $len <= $goodlen);
704 }
705 # reject if well over reasonable length
706 if ( $len > $goodlen ) {
707 @neartext = [];
708 }
709 $neartext[0] = " " if (! defined $neartext[0]);
710 $neartext[1] = " " if (! defined $neartext[1]);
711 return "<tr><td>Caption</td><td>" . (join ",", @neartext) . "</td></tr>\n"; # TODO: the | is for testing purposes
712} # end extract_caption_text
713
714# the previous section header often gives a bit
715# of context to the section that the image is
716# in (invariably the header is before/above the image)
717# so extract the text of the closest header above the image
718#
719# this fn just gets all the headers above the image, within the context window
720sub get_prev_header {
721 my ($self, $pos, $textref) = (@_);
722 my ($rhtext);
723 while ( $$textref =~ /<h\d>(.*?)<\/h\d>/sig ) {
724 # only headers before image
725 if ((pos $$textref) < $pos) {
726 $rhtext .= "$1, ";
727 }
728 }
729 if ( $rhtext ) { return "Header($rhtext)" }
730 else { return "" }
731}
732
733# not the most robust tag stripping
734# regexps (see perl.com FAQ) but good enough
735#
736# used by caption & tag-based near text algorithms
737sub strip_tags {
738 my ( $self, $value ) = @_;
739 if ( ! defined($value) ) { $value = "" } # handle nulls
740 else {
741 $value =~ s/<.*?>//gs; # strip all html tags
742 $value =~ s/\s+/\ /g; # remove extra whitespace
743 $value =~ s/\&\w+\;//g; # remove &nbsp; etc
744 }
745 return $value;
746}
747
748# uses the given tag(s) to identify
749# the caption near to the image
750# (below, above or both below and above)
751sub extract_caption {
752 my ($self, $tag, $bound_tag, $contextref) = (@_);
753 my (@nt, $n, $etag, $gotcap);
754 return ("", "") if ( ! ($$contextref =~ /\Q$tag/) );
755
756 $nt[0] = $`;
757 $nt[1] = $';
758 $gotcap = 0;
759
760 # look before the image for a boundary tag
761 ($etag, $nt[0]) = $nt[0] =~ /<($bound_tag)[\s]?.*?>(.*?)$/is;
762 # if bound_tag too far from the image, then prob not caption
763 # (note: have to allow for tags, so multiply by 3
764 if ( $etag && length($nt[0]) < ($self->{'caption_len'} * 3) ) {
765 if ( $nt[0] =~ /<\/$etag>/si ) {
766 # the whole caption is above the image: <tag>text</tag><img>
767 ($nt[0]) =~ /<(?:$etag)[\s]?.*?>(.*?)<\/$etag>/is;
768 $nt[0] = $self->strip_tags($nt[0]);
769 if ( length($nt[0]) > $self->{'mintext'} ) {
770 $gotcap = 1;
771 $nt[1] = "";
772 }
773
774 } elsif ( $nt[1] =~ /<\/$etag>/si) {
775 # the caption tag covers image: <tag>text?<img>text?</tag>
776 ($nt[1]) = $nt[1] =~ /(.*?)<\/$etag>/si;
777 $nt[0] = $self->strip_tags($nt[0] . $nt[1]);
778 if ( length($nt[0]) > $self->{'mintext'} ) {
779 $gotcap = 2;
780 $nt[1] = "";
781 }
782 }
783 }
784 # else try below the image
785 if ( ! $gotcap ) {
786 # the caption is after the image: <img><tag>text</tag>
787 ($etag, $nt[1]) = $nt[1] =~ /^.*?<($bound_tag)[\s]?.*?>(.*)/is;
788 if ( $etag && $nt[1] =~ /<\/$etag>/s) {
789 ($nt[1]) = $nt[1] =~ /(.*?)<\/$etag>/si;
790 $gotcap = 3;
791 $nt[0] = "";
792 $nt[1] = $self->strip_tags($nt[1]);
793 }
794 }
795 if ( ! $gotcap ) { $nt[0] = $nt[1] = "" }
796 else {
797 # strip part-tags
798 $nt[0] =~ s/^.*>//s;
799 $nt[1] =~ s/<.*$//s;
800 }
801 my ($type);
802 if ( $gotcap == 0 ) { return ("nocaption", "") }
803 elsif ( $gotcap == 1 ) { $type = "captionabove:" }
804 elsif ( $gotcap == 2 ) { $type = "captioncovering:" }
805 elsif ( $gotcap == 3 ) { $type = "captionbelow:" }
806 return ($type, $nt[0], $nt[1]);
807}
808
809# tag-based near text
810#
811# tries different tag sets
812# and chooses the best one
813sub extract_near_text {
814 my ($self, $tag, $textref, $prevpos, $pos, $nextpos) = (@_);
815 my (@neartext, $len, $hdelim, $maxtext, $mintext, $goodlen,
816 @bestlen, @best, $startpos, $context, $context_size,
817 $dist, $bdist, $best1, $i, $nt);
818 $bestlen[0] = $bestlen[1] = 0; $bestlen[2] = $bdist = 999999;
819 $best[0] = $best[1] = $best[2] = "";
820 $maxtext = $self->{'maxtext'};
821 $mintext = $self->{'mintext'};
822 $goodlen = $self->{'neartext_len'};
823
824 # extract a context to extract near text from (faster)
825 $context_size = $maxtext*4;
826 $startpos = $pos - ($context_size / 2);
827 if ($startpos < $prevpos ) { $startpos = $prevpos }
828 if ($nextpos != -1 && $context_size > ( $nextpos - $startpos ))
829 { $context_size = ($nextpos - $startpos) }
830 $context = substr ( $$textref, $startpos, $context_size );
831 $context =~ s/<!--.*?-->//gs;
832 $context =~ s/^.*-->(.*)/$1/gs;
833 $context =~ s/(.*)<!--.*$/$1/gs;
834
835 # try stepping through markup delimiter sets
836 # and selecting the best one
837 foreach $hdelim ( @{ $self->{'delims'} } ) {
838 @neartext = $self->extract_tagged_neartext($tag, $hdelim, \$context);
839 $nt = join("", @neartext);
840 $len = length($nt);
841 # Priorities:
842 # 1. Greater than mintext
843 # 2. Less than maxtext
844 # 3. Closest to goodlen
845 if ( $len <= $goodlen && $len > $bestlen[0] ) {
846 $bestlen[0] = $len;
847 $best[0] = $hdelim;
848 } elsif ( $len >= $maxtext && $len < $bestlen[2] ) {
849 $bestlen[2] = $len;
850 $best[2] = $hdelim;
851 } elsif ( $len >= $bestlen[0] && $len <= $bestlen[2] ) {
852 $dist = abs($goodlen - $len);
853 if ( $dist < $bdist ) {
854 $bestlen[1] = $len;
855 $best[1] = $hdelim;
856 $bdist = $dist;
857 }
858 }
859 }
860 $best1 = 2;
861 foreach $i ( 0..2 ) {
862 if ( $bestlen[$i] == 999999 ) { $bestlen[$i] = 0 }
863 $dist = abs($goodlen - $bestlen[$i]);
864 if ( $bestlen[$i] > $mintext && $dist <= $bdist ) {
865 $best1 = $i;
866 $bdist = $dist;
867 }
868 }
869 @neartext = $self->extract_tagged_neartext($tag, $best[$best1], \$context);
870 if ( $bestlen[$best1] > $maxtext ) {
871 # truncate on word boundary if too much text
872 my $hmax = $maxtext / 2;
873 ($neartext[0]) = $neartext[0] =~ /([^\s]*.{1,$hmax})$/s;
874 ($neartext[1]) = $neartext[1] =~ /^(.{1,$hmax}[^\s]*)/s;
875 } elsif ( $bestlen[$best1] < $mintext ) {
876 # use plain text extraction if tags failed (e.g. usable tag outside context)
877 print {$self->{'outhandle'}} "W3ImgPlug: Fallback to plain-text extraction for $tag\n"
878 if $self->{'verbosity'} > 2;
879 $neartext[0] = "<tr><td>RawNeartext</td><td>" . $self->extract_raw_neartext($tag, $textref) . "</td></tr>";
880 $neartext[1] = "";
881 }
882 # get previous header if available
883 $neartext[0] .= "<br>\n" .
884 $self->get_prev_header($pos, \$context) if ( $self->{'aggressiveness'} >= 4 );
885 $neartext[0] = " " if (! defined $neartext[0]);
886 $neartext[1] = " " if (! defined $neartext[1]);
887
888 return "<tr><td>NearText</td><td>" . (join "|", @neartext) . "</td></tr>\n"; # TODO: the | is for testing purposes
889} # end extract_near_text
890
891# actually captures tag-based
892# near-text given a tag set
893sub extract_tagged_neartext {
894 my ($self, $tag, $bound_tag, $textref) = (@_);
895 return "" if ( ! ($$textref =~ /\Q$tag/) );
896 my (@nt, $delim, $pre_tag, $n);
897 $nt[0] = $`;
898 $nt[1] = $';
899
900 # get text after previous image tag
901 $nt[0] =~ s/.*<($bound_tag)[^>]*>(.*)/$2/is; # get rid of preceding text
902 if (defined($1)) { $delim = $1 }
903 $pre_tag = $bound_tag;
904
905 if (defined($delim)) {
906 # we want to try and use the end tag of the previous delimiter
907 # (put it on the front of the list)
908 $pre_tag =~ s/(^|\|)($delim)($|\|)//i; # take it out
909 $pre_tag =~ s/\|\|/\|/i; # replace || with |
910 $pre_tag = $delim . "|" . $pre_tag; # put it on the front
911 }
912
913 # get text before next image tag
914 $nt[1] =~ s/<\/?(?:$pre_tag)[^>]*>.*//is; # get rid of stuff after first delimiter
915
916 # process related text
917 for $n (0..1) {
918 if ( defined($nt[$n]) ) {
919 $nt[$n] =~ s/<.*?>//gs; # strip all html tags
920 $nt[$n] =~ s/\s+/\ /gs; # remove extra whitespace
921 $nt[$n] =~ s/\&\w+\;//sg; # remove &nbsp; etc
922 # strip part-tags
923 if ( $n == 0 ) { $nt[0] =~ s/^.*>//s }
924 if ( $n == 1 ) { $nt[1] =~ s/<.*$//s }
925 } else { $nt[$n] = ""; } # handle nulls
926 }
927 return @nt;
928}
929
930# this function is fall-back
931# if tags aren't suitable.
932#
933# extracts a fixed length of characters
934# either side of image tag (on word boundary)
935sub extract_raw_neartext {
936 my ($self, $tag, $textref) = (@_);
937 my ($rawtext, $startpos, $fp);
938 my $imgs = \%{$self->{'imglist'}};
939 ($fp) = $tag =~ /([\w\\\/]+\.(?:gif|jpe?g|png))/is;
940 if (! $fp) { return " " };
941 # if the cached, plain-text version isn't there, then create it
942 $self->init_plaintext($textref) unless defined($self->{'plaintext'});
943
944 # take the closest maxtext/2 characters
945 # either side of the tag (by word boundary)
946 return "" if ( ! exists $imgs->{$fp}{'rawpos'} );
947 $startpos = $imgs->{$fp}{'rawpos'} - (($self->{'maxtext'} / 2) + 20);
948 if ( $startpos < 0 ) { $startpos = 0 }
949 $rawtext = substr $self->{'plaintext'}, $startpos, $self->{'maxtext'} + 20;
950 $rawtext =~ s/\s\s/ /g;
951
952 return $rawtext;
953}
954
955# init plaintext variable for HTML-stripped version
956# (for full text index/raw assoc text extraction)
957sub init_plaintext {
958 my ($self, $textref) = (@_);
959 my ($page, $fp);
960 my $imgs = \%{$self->{'imglist'}};
961 $page = $$textref; # make a copy of original
962
963 # strip tags around image filenames so they don't get zapped
964 $page =~ s/<\w+\s+.*?([\w\/\\]+\.(?:gif|jpe?g|png))[^>]*>/\"$1\"/gsi;
965 $page =~ s/<.*?>//gs;
966 $page =~ s/&nbsp;/ /gs;
967 $page =~ s/&amp;/&/gs; #TODO: more &zzz; replacements (except &lt;, $gt;)
968
969 # get positions and strip images
970 while ( $page =~ /([^\s\'\"]+\.(jpe?g|gif|png))/ig ) {
971 $fp = $1;
972 if ( $imgs->{$fp}{'exists'} ) {
973 $imgs->{$fp}{'rawpos'} = pos $page;
974 }
975 $page =~ s/\"$fp\"//gs;
976 }
977 $self->{'plaintext'} = $page;
978}
979
980# finds and filters images based on size
981# (dimensions, height, filesize) and existence
982#
983# looks for image filenames (.jpg, .gif, etc)
984# and checks for existence on disk
985# (hence supports most JavaScript images)
986sub get_img_list {
987 my $self = shift (@_);
988 my ($textref) = (@_);
989 my ($filepath, $relpath, $abspath, $pos, $num, $width, $height, $filesize);
990 my $imgs = \%{$self->{'imglist'}};
991 while ( $$textref =~ /([^\s\'\"]+\.(jpe?g|gif|png))/ig ) {
992 $filepath = $1;
993 $pos = pos $$textref;
994 next if ( $imgs->{$filepath}{'relpath'} );
995 $relpath = $filepath;
996 $relpath =~ s/^http\:\/\///; # remove http:// in case we have mirrored it
997 $relpath =~ s/\\/\//g; # replace \ with /
998 $relpath =~ s/^\.\///s; # make "./filepath" into "filepath"
999 $imgs->{$filepath}{'relpath'} = $relpath;
1000 $abspath = "$self->{'htpath'}/$relpath";
1001
1002 if (! -e $abspath) { next }
1003
1004 # can't modify real filepath var because it
1005 # then can't be located in the page for tag recognition later
1006 ($width, $height) =
1007 `identify $abspath -ping -format "%wx%h"` =~ /^(\d*)x(\d*)$/m;
1008 if (! ($width && $height)) {
1009 print STDERR "W3ImgPlug: ($abspath) 'identify' failed. Check ImageMagicK binaries are installed and working correctly\n"; next;
1010 }
1011 $filesize = (-s $abspath);
1012 if ( $filesize >= $self->{'min_img_filesize'}
1013 && ( $width >= $self->{'min_img_width'} )
1014 && ( $height >= $self->{'min_img_height'} ) ) {
1015
1016 $imgs->{$filepath}{'exists'} = 1;
1017 $imgs->{$filepath}{'pos'} = $pos;
1018 $imgs->{$filepath}{'width'} = $width;
1019 $imgs->{$filepath}{'height'} = $height;
1020 $imgs->{$filepath}{'filesize'} = $filesize;
1021 } else {
1022 print {$self->{'outhandle'}} "W3ImgPlug: skipping $self->{'base_path'}/$relpath: $filesize, $width x $height\n"
1023 if $self->{'verbosity'} > 2;
1024 }
1025 }
1026 $num = 0;
1027 foreach $i ( keys %{$imgs} ) {
1028 if ( $imgs->{$i}{'pos'} ) {
1029 $num++;
1030 } else { delete $imgs->{$i} }
1031 }
1032 return $num;
1033}
1034
1035# make the text available to the read function
1036# by making it an object variable
1037sub read_file {
1038 my ($self, $filename, $encoding, $language, $textref) = @_;
1039 $self->SUPER::read_file($filename, $encoding, $language, $textref);
1040
1041 # if HTMLplug has run through, then it will
1042 # have replaced references so we have to
1043 # make a copy of the text before processing
1044 if ( $self->{'index_pages'} ) {
1045 $self->{'text'} = $$textref;
1046 $self->{'textref'} = \($self->{'text'});
1047 } else {
1048 $self->{'textref'} = $textref;
1049 }
1050 $self->{'plaintext'} = undef;
1051}
1052
1053# HTMLPlug only extracts meta-data if it is specified in plugin options
1054# hence a special function to do it here
1055sub get_meta_value {
1056 my ($self, $name, $textref) = @_;
1057 my ($value);
1058 $name = lc $name;
1059 if ($name eq "title") {
1060 ($value) = $$textref =~ /<title>(.*?)<\/title>/is
1061 } else {
1062 my $qm = "(?:\"|\')";
1063 ($value) = $$textref =~ /<meta name\s*=\s*$qm?$name$qm?\s+content\s*=\s*$qm?(.*?)$qm?\s*>/is
1064 }
1065 $value = "" unless $value;
1066 return $value;
1067}
1068
1069# make filename an anchor reference
1070# so we can go straight to the image
1071# within the cached version of the source page
1072# (augment's HTMLPlug sub)
1073sub replace_images {
1074 my $self = shift (@_);
1075 my ($front, $link, $back, $base_dir,
1076 $file, $doc_obj, $section) = @_;
1077 $link =~ s/\"//g;
1078 my ($a_name) = $link;
1079 $a_name =~ s/[\/\\\:\&]/_/g;
1080 # keep a list so we don't repeat the same anchor
1081 if ( ! $self->{'imglist'}{$link}{'anchored'} ) {
1082 $front = "<a name=\"gsdl_$a_name\">$front";
1083 $back = "$back</a>";
1084 $self->{'imglist'}{$link}{'anchored'} = 1;
1085 }
1086 return $self->SUPER::replace_images($front, $link, $back, $base_dir,
1087 $file, $doc_obj, $section);
1088}
1089
10901;
Note: See TracBrowser for help on using the repository browser.