[585] | 1 | ###########################################################################
|
---|
| 2 | #
|
---|
| 3 | # HTMLPlug.pm -- basic html plugin
|
---|
[808] | 4 | #
|
---|
[585] | 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) 1999 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 |
|
---|
[808] | 27 | #
|
---|
| 28 | # Note that this plugin handles frames only in a very simple way
|
---|
| 29 | # i.e. each frame is treated as a separate document. This means
|
---|
| 30 | # search results will contain links to individual frames rather
|
---|
| 31 | # than linking to the top level frameset.
|
---|
| 32 | # There may also be some problems caused by the _parent target
|
---|
| 33 | # (it's removed by this plugin)
|
---|
| 34 | # To use frames properly you'll need to use the WebPlug plugin.
|
---|
| 35 | #
|
---|
[585] | 36 |
|
---|
[808] | 37 |
|
---|
[585] | 38 | package HTMLPlug;
|
---|
| 39 |
|
---|
| 40 | use BasPlug;
|
---|
[721] | 41 | use html;
|
---|
[585] | 42 | use util;
|
---|
[808] | 43 | use parsargv;
|
---|
[585] | 44 |
|
---|
| 45 | sub BEGIN {
|
---|
| 46 | @ISA = ('BasPlug');
|
---|
| 47 | }
|
---|
| 48 |
|
---|
[850] | 49 | use strict;
|
---|
| 50 |
|
---|
[808] | 51 | sub print_usage {
|
---|
| 52 | print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
|
---|
| 53 |
|
---|
| 54 | print STDERR "\n usage: plugin HTMLPlug [options]\n\n";
|
---|
| 55 | print STDERR " options:\n";
|
---|
| 56 | print STDERR " -process_exp A perl regular expression to match against filenames.\n";
|
---|
| 57 | print STDERR " Matching filenames will be processed by this plugin.\n";
|
---|
| 58 | print STDERR " Defaults to '(?i)\.html?\$' i.e. all documents ending in\n";
|
---|
| 59 | print STDERR " .htm or .html (case-insensitive).\n";
|
---|
| 60 | print STDERR " -nolinks Don't make any attempt to trap links (setting this flag may\n";
|
---|
| 61 | print STDERR " improve speed of building/importing but any relative links within\n";
|
---|
| 62 | print STDERR " documents will be broken).\n";
|
---|
| 63 | print STDERR " -block_exp Files matching this regular expression will be blocked from\n";
|
---|
| 64 | print STDERR " being passed to any further plugins in the list. By default\n";
|
---|
[897] | 65 | print STDERR " HTMLPlug blocks any files with .gif, .jpg, .jpeg, .png, .pdf,\n";
|
---|
| 66 | print STDERR " .rtf or .css file extensions.\n";
|
---|
[808] | 67 | print STDERR " -keep_head Don't remove headers from html files.\n";
|
---|
| 68 | print STDERR " -no_metadata Don't attempt to extract any metadata from files.\n";
|
---|
| 69 | print STDERR " -metadata_fields Comma separated list of metadata fields to attempt to extract.\n";
|
---|
| 70 | print STDERR " Defaults to 'Title'\n";
|
---|
[897] | 71 | print STDERR " -w3mir Set if w3mir was used to generate input file structure.\n";
|
---|
| 72 | print STDERR " w3mir \n";
|
---|
[900] | 73 | print STDERR " -rename_assoc_files Renames files associated with documents (e.g. images). Also\n";
|
---|
| 74 | print STDERR " creates much shallower directory structure (useful when creating\n";
|
---|
| 75 | print STDERR " collections to go on cd-rom).\n\n";
|
---|
[808] | 76 | }
|
---|
| 77 |
|
---|
[585] | 78 | sub new {
|
---|
[808] | 79 | my $class = shift (@_);
|
---|
[850] | 80 | my $self = new BasPlug ();
|
---|
[585] | 81 |
|
---|
[808] | 82 | if (!parsargv::parse(\@_,
|
---|
| 83 | q^process_exp/.*/(?i)\.html?$^, \$self->{'process_exp'},
|
---|
| 84 | q^nolinks^, \$self->{'nolinks'},
|
---|
[897] | 85 | q^block_exp/.*/(?i)\.(gif|jpe?g|png|pdf|rtf|css)$^, \$self->{'block_exp'},
|
---|
[808] | 86 | q^keep_head^, \$self->{'keep_head'},
|
---|
| 87 | q^no_metadata^, \$self->{'no_metadata'},
|
---|
| 88 | q^metadata_fields/.*/Title^, \$self->{'metadata_fields'},
|
---|
[900] | 89 | q^w3mir^, \$self->{'w3mir'},
|
---|
| 90 | q^rename_assoc_files^, \$self->{'rename_assoc_files'})) {
|
---|
[808] | 91 | &print_usage();
|
---|
| 92 | die "\n";
|
---|
| 93 | }
|
---|
[721] | 94 |
|
---|
[808] | 95 | $self->{'aux_files'} = {};
|
---|
| 96 | $self->{'dir_num'} = 0;
|
---|
| 97 | $self->{'file_num'} = 0;
|
---|
| 98 |
|
---|
[585] | 99 | return bless $self, $class;
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | sub is_recursive {
|
---|
| 103 | my $self = shift (@_);
|
---|
| 104 |
|
---|
| 105 | return 0; # this is not a recursive plugin
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[808] | 108 | # return number of files processed, undef if can't process
|
---|
| 109 | # Note that $base_dir might be "" and that $file might
|
---|
| 110 | # include directories
|
---|
| 111 | sub read {
|
---|
| 112 | my $self = shift (@_);
|
---|
| 113 | my ($pluginfo, $base_dir, $file, $metadata, $processor) = @_;
|
---|
[585] | 114 |
|
---|
[808] | 115 | my $filename = &util::filename_cat($base_dir, $file);
|
---|
| 116 | return 0 if $filename =~ /$self->{'block_exp'}/;
|
---|
| 117 | if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) {
|
---|
| 118 | return undef;
|
---|
| 119 | }
|
---|
| 120 | $file =~ s/^[\/\\]+//;
|
---|
[721] | 121 |
|
---|
[808] | 122 | $self->{'verbosity'} = $processor->{'verbosity'};
|
---|
| 123 | print STDERR "HTMLPlug: processing $file\n"
|
---|
| 124 | if $self->{'verbosity'} > 1;
|
---|
[721] | 125 |
|
---|
[808] | 126 | # create a new document
|
---|
| 127 | my $doc_obj = new doc ($file, "indexed_doc");
|
---|
| 128 | my $cursection = $doc_obj->get_top_section();
|
---|
| 129 |
|
---|
| 130 | # read in HTML file
|
---|
| 131 | open (FILE, $filename) || die "HTMLPlug::read - can't open $filename\n";
|
---|
| 132 | undef $/;
|
---|
| 133 | my $text = <FILE>;
|
---|
| 134 | $/ = "\n";
|
---|
| 135 | close FILE;
|
---|
| 136 | if ($text !~ /\w/) {
|
---|
| 137 | print STDERR "HTMLPlug: ERROR: $file contains no text\n" if $self->{'verbosity'};
|
---|
| 138 | return 0;
|
---|
[721] | 139 | }
|
---|
| 140 |
|
---|
[850] | 141 | $self->extra_metadata ($doc_obj, $cursection, $metadata);
|
---|
[808] | 142 | $self->extract_metadata (\$text, $metadata, $doc_obj, $cursection)
|
---|
| 143 | unless $self->{'no_metadata'};
|
---|
[721] | 144 |
|
---|
[808] | 145 | # Store URL for page as metadata - this can be used for an
|
---|
| 146 | # altavista style search interface. The URL won't be valid
|
---|
| 147 | # unless the file structure contains the domain name (i.e.
|
---|
| 148 | # like when w3mir is used to download a website).
|
---|
| 149 | my $web_url = "http://$file";
|
---|
| 150 | $web_url =~ s/\\/\//g; # for windows
|
---|
| 151 | $doc_obj->add_metadata($cursection, "URL", $web_url);
|
---|
[721] | 152 |
|
---|
[808] | 153 | # remove header and footer
|
---|
| 154 | if (!$self->{'keep_head'}) {
|
---|
| 155 | $text =~ s/^.*?<body[^>]*>//is;
|
---|
| 156 | $text =~ s/(<\/body[^>]*>|<\/html[^>]*>)//isg;
|
---|
| 157 | }
|
---|
[721] | 158 |
|
---|
[808] | 159 | # trap links
|
---|
| 160 | if (!$self->{'nolinks'}) {
|
---|
[721] | 161 |
|
---|
[808] | 162 | # usemap="./#index" not handled correctly => change to "#index"
|
---|
| 163 | $text =~ s/(<img[^>]*?usemap\s*=\s*\"?)([^\">\s]+)(\"?[^>]*>)/
|
---|
| 164 | $self->replace_usemap_links($1, $2, $3)/isge;
|
---|
[721] | 165 |
|
---|
[897] | 166 | $text =~ s/(<(?:a|area|frame|link)\s+[^>]*?(?:href|src)\s*=\s*\"?)([^\">\s]+)(\"?[^>]*>)/
|
---|
| 167 | $self->replace_href_links ($1, $2, $3, $base_dir, $file, $doc_obj, $cursection)/isge;
|
---|
[721] | 168 | }
|
---|
| 169 |
|
---|
[808] | 170 | # trap images
|
---|
| 171 | $text =~ s/(<img[^>]*?src\s*=\s*\"?)([^\">\s]+)(\"?[^>]*>)/
|
---|
[897] | 172 | $self->replace_images ($1, $2, $3, $base_dir, $file, $doc_obj, $cursection)/isge;
|
---|
[721] | 173 |
|
---|
[808] | 174 | $doc_obj->add_text ($cursection, $text);
|
---|
[721] | 175 |
|
---|
[808] | 176 | # add an OID
|
---|
| 177 | $doc_obj->set_OID();
|
---|
[721] | 178 |
|
---|
[808] | 179 | # process the document
|
---|
| 180 | $processor->process($doc_obj);
|
---|
[721] | 181 |
|
---|
[808] | 182 | return 1; # processed the file
|
---|
[721] | 183 | }
|
---|
| 184 |
|
---|
[808] | 185 | sub replace_images {
|
---|
| 186 | my $self = shift (@_);
|
---|
[897] | 187 | my ($front, $link, $back, $base_dir,
|
---|
| 188 | $file, $doc_obj, $section) = @_;
|
---|
[808] | 189 |
|
---|
| 190 | $link =~ s/\n/ /g;
|
---|
| 191 |
|
---|
| 192 | my ($href, $hash_part, $rl) = $self->format_link ($link, $base_dir, $file);
|
---|
[897] | 193 | return $front . $self->add_file ($href, $base_dir, $doc_obj, $section) . $back;
|
---|
[721] | 194 | }
|
---|
| 195 |
|
---|
[808] | 196 | sub replace_href_links {
|
---|
[585] | 197 | my $self = shift (@_);
|
---|
[897] | 198 | my ($front, $link, $back, $base_dir, $file, $doc_obj, $section) = @_;
|
---|
[585] | 199 |
|
---|
[808] | 200 | # attempt to sort out targets - frames are not handled
|
---|
| 201 | # well in this plugin and some cases will screw things
|
---|
| 202 | # up - e.g. the _parent target (so we'll just remove
|
---|
| 203 | # them all ;-)
|
---|
| 204 | $front =~ s/(target=\"?)_top(\"?)/$1_gsdltop_$2/is;
|
---|
| 205 | $back =~ s/(target=\"?)_top(\"?)/$1_gsdltop_$2/is;
|
---|
| 206 | $front =~ s/target=\"?_parent\"?//is;
|
---|
| 207 | $back =~ s/target=\"?_parent\"?//is;
|
---|
[721] | 208 |
|
---|
[808] | 209 | return $front . $link . $back if $link =~ /^\#/s;
|
---|
| 210 | $link =~ s/\n/ /g;
|
---|
[721] | 211 |
|
---|
[808] | 212 | my ($href, $hash_part, $rl) = $self->format_link ($link, $base_dir, $file);
|
---|
[585] | 213 |
|
---|
[850] | 214 | my ($filename) = $href =~ /^(?:.*?):(?:\/\/)?(.*)/;
|
---|
[897] | 215 |
|
---|
| 216 | ##### leave all these links alone (they won't be picked up by intermediate
|
---|
| 217 | ##### pages). I think that's safest when dealing with frames, targets etc.
|
---|
| 218 | ##### (at least until I think of a better way to do it). Problems occur with
|
---|
| 219 | ##### mailto links from within small frames, the intermediate page is displayed
|
---|
| 220 | ##### within that frame and can't be seen. There is still potential for this to
|
---|
| 221 | ##### happen even with html pages - the solution seems to be to somehow tell
|
---|
| 222 | ##### the browser from the server side to display the page being sent (i.e.
|
---|
| 223 | ##### the intermediate page) in the top level window - I'm not sure if that's
|
---|
| 224 | ##### possible - the following line should probably be deleted if that can be done
|
---|
| 225 | return $front . $link . $back if $href =~ /^(mailto|news|gopher|nntp|telnet|javascript):/is;
|
---|
| 226 |
|
---|
| 227 |
|
---|
[850] | 228 | if (($rl == 0) || ($filename =~ /$self->{'process_exp'}/) ||
|
---|
[808] | 229 | ($href =~ /\/$/) || ($href =~ /^(mailto|news|gopher|nntp|telnet|javascript):/i)) {
|
---|
[897] | 230 | &html::urlsafe ($href);
|
---|
| 231 | return $front . "_httpextlink_&rl=" . $rl . "&href=" . $href . $hash_part . $back;
|
---|
[808] | 232 |
|
---|
| 233 | } else {
|
---|
| 234 | # link is to some other type of file (image, pdf etc.) so we'll
|
---|
| 235 | # need to associate that file
|
---|
[897] | 236 | return $front . $self->add_file ($href, $base_dir, $doc_obj, $section) . $back;
|
---|
[721] | 237 | }
|
---|
[808] | 238 | }
|
---|
[721] | 239 |
|
---|
[808] | 240 | sub add_file {
|
---|
| 241 | my $self = shift (@_);
|
---|
[897] | 242 | my ($href, $base_dir, $doc_obj, $section) = @_;
|
---|
[808] | 243 | my ($newname);
|
---|
[585] | 244 |
|
---|
[808] | 245 | my $filename = $href;
|
---|
| 246 | $filename =~ s/^[^:]*:\/\///;
|
---|
| 247 | $filename = &util::filename_cat ($base_dir, $filename);
|
---|
| 248 | my ($ext) = $filename =~ /(\.[^\.]*)$/;
|
---|
[900] | 249 | if ($self->{'rename_assoc_files'}) {
|
---|
| 250 | if (defined $self->{'aux_files'}->{$href}) {
|
---|
| 251 | $newname = $self->{'aux_files'}->{$href}->{'dir_num'} . "/" .
|
---|
| 252 | $self->{'aux_files'}->{$href}->{'file_num'} . $ext;
|
---|
| 253 | } else {
|
---|
| 254 | $newname = $self->{'dir_num'} . "/" . $self->{'file_num'} . $ext;
|
---|
| 255 | $self->inc_filecount ();
|
---|
| 256 | }
|
---|
| 257 | $doc_obj->associate_file($filename, $newname, undef, $section);
|
---|
| 258 | return "_httpcollimg_/$newname";
|
---|
| 259 |
|
---|
[585] | 260 | } else {
|
---|
[900] | 261 | ($newname) = $filename =~ /([^\/\\]*)$/;
|
---|
| 262 | $doc_obj->associate_file($filename, $newname, undef, $section);
|
---|
| 263 | return "_httpcollimg_/_thisOID_/$newname";
|
---|
[585] | 264 | }
|
---|
[808] | 265 | }
|
---|
[585] | 266 |
|
---|
[721] | 267 |
|
---|
[808] | 268 | sub format_link {
|
---|
| 269 | my $self = shift (@_);
|
---|
| 270 | my ($link, $base_dir, $file) = @_;
|
---|
[585] | 271 |
|
---|
[808] | 272 | my ($before_hash, $hash_part) = $link =~ /^([^\#]*)(\#?.*)$/;
|
---|
| 273 | $hash_part = "" if !defined $hash_part;
|
---|
| 274 | if (!defined $before_hash || $before_hash !~ /[\w\.\/]/) {
|
---|
[850] | 275 | print STDERR "HTMLPlug: ERROR - badly formatted tag ignored ($link)\n"
|
---|
[808] | 276 | if $self->{'verbosity'};
|
---|
| 277 | return ($link, "", 0);
|
---|
[732] | 278 | }
|
---|
[808] | 279 |
|
---|
| 280 | if ($before_hash =~ s/^((?:http|ftp|file):\/\/)//i) {
|
---|
| 281 | my $type = $1;
|
---|
| 282 |
|
---|
| 283 | if ($link =~ /^(http|ftp):/i) {
|
---|
| 284 | # Turn url (using /) into file name (possibly using \ on windows)
|
---|
| 285 | my @http_dir_split = split('/', $before_hash);
|
---|
| 286 | $before_hash = &util::filename_cat(@http_dir_split);
|
---|
[585] | 287 | }
|
---|
| 288 |
|
---|
[808] | 289 | $before_hash = $self->eval_dir_dots($before_hash);
|
---|
| 290 |
|
---|
| 291 | my $linkfilename = &util::filename_cat ($base_dir, $before_hash);
|
---|
[617] | 292 |
|
---|
[808] | 293 | my $rl = 0;
|
---|
| 294 | $rl = 1 if (-e $linkfilename);
|
---|
[585] | 295 |
|
---|
[808] | 296 | # make sure there's a slash on the end if it's a directory
|
---|
| 297 | if ($before_hash !~ /\/$/) {
|
---|
| 298 | $before_hash .= "/" if (-d $linkfilename);
|
---|
| 299 | }
|
---|
[585] | 300 |
|
---|
[808] | 301 | return ($type . $before_hash, $hash_part, $rl);
|
---|
[721] | 302 |
|
---|
[808] | 303 | } elsif ($link !~ /^(mailto|news|gopher|nntp|telnet|javascript):/i) {
|
---|
[721] | 304 |
|
---|
[808] | 305 | if ($before_hash =~ s/^\///) {
|
---|
| 306 | # the first directory will be the domain name if w3mir was used
|
---|
| 307 | # to generate archives, otherwise we'll assume all files are
|
---|
| 308 | # from the same site and base_dir is the root
|
---|
| 309 | if ($self->{'w3mir'}) {
|
---|
| 310 | my @dirs = split /[\/\\]/, $file;
|
---|
| 311 | my $domname = shift (@dirs);
|
---|
| 312 | $before_hash = &util::filename_cat($domname, $before_hash);
|
---|
| 313 | $before_hash =~ s/\\/\//g; # for windows
|
---|
| 314 | }
|
---|
[721] | 315 |
|
---|
[808] | 316 | } else {
|
---|
| 317 | # Turn relative file path into full path
|
---|
| 318 | my $dirname = &File::Basename::dirname($file);
|
---|
| 319 | $before_hash = &util::filename_cat($dirname, $before_hash);
|
---|
| 320 | $before_hash = $self->eval_dir_dots($before_hash);
|
---|
| 321 | }
|
---|
[721] | 322 |
|
---|
[808] | 323 | # make sure there's a slash on the end if it's a directory
|
---|
| 324 | my $linkfilename = &util::filename_cat ($base_dir, $before_hash);
|
---|
| 325 | if ($before_hash !~ /\/$/) {
|
---|
| 326 | $before_hash .= "/" if (-d $linkfilename);
|
---|
| 327 | }
|
---|
[721] | 328 |
|
---|
[808] | 329 | return ("http://" . $before_hash, $hash_part, 1);
|
---|
[721] | 330 |
|
---|
[808] | 331 | } else {
|
---|
| 332 | # mailto, news, nntp, telnet, javascript or gopher link
|
---|
| 333 | return ($before_hash, "", 0);
|
---|
| 334 | }
|
---|
| 335 | }
|
---|
[721] | 336 |
|
---|
[808] | 337 | sub extract_metadata {
|
---|
| 338 | my $self = shift (@_);
|
---|
| 339 | my ($textref, $metadata, $doc_obj, $section) = @_;
|
---|
[585] | 340 |
|
---|
[850] | 341 | foreach my $field (split /,/, $self->{'metadata_fields'}) {
|
---|
[808] | 342 |
|
---|
| 343 | # don't need to extract field if it was passed in from a previous
|
---|
| 344 | # (recursive) plugin
|
---|
| 345 | next if defined $metadata->{$field};
|
---|
[721] | 346 |
|
---|
[808] | 347 | # see if there's a <meta> tag for this field
|
---|
| 348 | if ($$textref =~ /<meta(.*?)(?:name|http-equiv)\s*=\s*\"?$field\"?([^>]*)/is) {
|
---|
| 349 | my $content = $1 . $2;
|
---|
| 350 | if ($content =~ /content\s*=\s*\"?(.*?)\"?/is) {
|
---|
| 351 | if (defined $1) {
|
---|
| 352 | my $value = $1;
|
---|
| 353 | $value =~ s/\s+/ /gs;
|
---|
| 354 | $doc_obj->add_metadata($section, $field, $value);
|
---|
| 355 | next;
|
---|
| 356 | }
|
---|
| 357 | }
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | # special case for Title metadata - try <title> tags
|
---|
| 361 | # then first 100 characters of text
|
---|
| 362 |
|
---|
| 363 | if ($field =~ /^title$/i) {
|
---|
[721] | 364 |
|
---|
[808] | 365 | # see if there's a <title> tag
|
---|
| 366 | if ($$textref =~ /<title[^>]*>([^<]*)<\/title[^>]*>/is) {
|
---|
| 367 | if (defined $1) {
|
---|
| 368 | my $title = $1;
|
---|
| 369 | if ($title =~ /\w/) {
|
---|
| 370 | $title =~ s/\s+/ /gs;
|
---|
| 371 | $doc_obj->add_metadata ($section, $field, $title);
|
---|
| 372 | next;
|
---|
| 373 | }
|
---|
| 374 | }
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 | # if no title use first 100 characters
|
---|
| 378 | my $tmptext = $$textref;
|
---|
| 379 | $tmptext =~ s/<[^>]*>//g;
|
---|
| 380 | my $title = substr ($tmptext, 0, 100);
|
---|
| 381 | $title =~ s/\s+/ /gs;
|
---|
| 382 | $doc_obj->add_metadata ($section, $field, $title);
|
---|
| 383 | }
|
---|
| 384 | }
|
---|
[585] | 385 | }
|
---|
| 386 |
|
---|
[808] | 387 | # evaluate any "../" to next directory up
|
---|
| 388 | # evaluate any "./" as here
|
---|
| 389 | sub eval_dir_dots {
|
---|
| 390 | my $self = shift (@_);
|
---|
| 391 | my ($filename) = @_;
|
---|
[585] | 392 |
|
---|
[721] | 393 | my $dirsep_os = &util::get_os_dirsep();
|
---|
| 394 | my @dirsep = split(/$dirsep_os/,$filename);
|
---|
| 395 |
|
---|
| 396 | my @eval_dirs = ();
|
---|
[850] | 397 | foreach my $d (@dirsep) {
|
---|
[808] | 398 | if ($d eq "..") {
|
---|
[721] | 399 | pop(@eval_dirs);
|
---|
[808] | 400 |
|
---|
| 401 | } elsif ($d eq ".") {
|
---|
[721] | 402 | # do nothing!
|
---|
[808] | 403 |
|
---|
| 404 | } else {
|
---|
[721] | 405 | push(@eval_dirs,$d);
|
---|
| 406 | }
|
---|
[585] | 407 | }
|
---|
| 408 |
|
---|
[721] | 409 | return &util::filename_cat(@eval_dirs);
|
---|
| 410 | }
|
---|
| 411 |
|
---|
[808] | 412 | sub replace_usemap_links {
|
---|
| 413 | my $self = shift (@_);
|
---|
[721] | 414 | my ($front, $link, $back) = @_;
|
---|
| 415 |
|
---|
| 416 | $link =~ s/^\.\///;
|
---|
[808] | 417 | return $front . $link . $back;
|
---|
[721] | 418 | }
|
---|
| 419 |
|
---|
[808] | 420 | sub inc_filecount {
|
---|
| 421 | my $self = shift (@_);
|
---|
[721] | 422 |
|
---|
[808] | 423 | if ($self->{'file_num'} == 1000) {
|
---|
| 424 | $self->{'dir_num'} ++;
|
---|
| 425 | $self->{'file_num'} = 0;
|
---|
| 426 | } else {
|
---|
| 427 | $self->{'file_num'} ++;
|
---|
| 428 | }
|
---|
| 429 | }
|
---|
[721] | 430 |
|
---|
[585] | 431 | 1;
|
---|