- Timestamp:
- 2021-02-26T19:39:51+13:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/cpan/Image/ExifTool/DjVu.pm
r24107 r34921 19 19 use Image::ExifTool qw(:DataAccess :Utils); 20 20 21 $VERSION = '1.0 3';21 $VERSION = '1.06'; 22 22 23 23 sub ParseAnt($); … … 29 29 %Image::ExifTool::DjVu::Main = ( 30 30 GROUPS => { 2 => 'Image' }, 31 NOTES => 'Information is extracted from the following chunks in DjVu images.', 31 NOTES => q{ 32 Information is extracted from the following chunks in DjVu images. See 33 L<http://www.djvu.org/> for the DjVu specification. 34 }, 32 35 INFO => { 33 36 SubDirectory => { TagTable => 'Image::ExifTool::DjVu::Info' }, … … 136 139 documentation endorses tags borrowed from two standards: 1) BibTeX 137 140 bibliography system tags (all lowercase Tag ID's in the table below), and 2) 138 PDF DocInfo tags ( uppercaseTag ID's).141 PDF DocInfo tags (capitalized Tag ID's). 139 142 }, 140 143 # BibTeX tags (ref http://en.wikipedia.org/wiki/BibTeX) … … 225 228 $tok .= '"'; # quote is part of the string 226 229 } 230 # must protect unescaped "$" and "@" symbols, and "\" at end of string 231 $tok =~ s{\\(.)|([\$\@]|\\$)}{'\\'.($2 || $1)}sge; 227 232 # convert C escape sequences (allowed in quoted text) 228 233 $tok = eval qq{"$tok"}; … … 231 236 # allow anything in key but whitespace, braces and double quotes 232 237 # (this is one of those assumptions I mentioned) 233 $$dataPt =~ /([^\s()"]+)/sg; 234 $tok = $1; 238 $tok = $$dataPt =~ /([^\s()"]+)/sg ? $1 : undef; 235 239 } 236 240 push @toks, $tok if defined $tok; … … 247 251 sub ProcessAnt($$$) 248 252 { 249 my ($e xifTool, $dirInfo, $tagTablePtr) = @_;253 my ($et, $dirInfo, $tagTablePtr) = @_; 250 254 my $dataPt = $$dirInfo{DataPt}; 251 255 … … 265 269 if ($tag eq 'metadata') { 266 270 # ProcessMeta() takes array reference 267 $e xifTool->HandleTag($tagTablePtr, $tag, $ant);271 $et->HandleTag($tagTablePtr, $tag, $ant); 268 272 } else { 269 273 next if ref $$ant[0]; # only process simple values 270 $e xifTool->HandleTag($tagTablePtr, $tag, $$ant[0]);274 $et->HandleTag($tagTablePtr, $tag, $$ant[0]); 271 275 } 272 276 } … … 281 285 sub ProcessMeta($$$) 282 286 { 283 my ($e xifTool, $dirInfo, $tagTablePtr) = @_;287 my ($et, $dirInfo, $tagTablePtr) = @_; 284 288 my $dataPt = $$dirInfo{DataPt}; 285 289 return 0 unless ref $$dataPt eq 'ARRAY'; 286 $e xifTool->VerboseDir('Metadata', scalar @$$dataPt);290 $et->VerboseDir('Metadata', scalar @$$dataPt); 287 291 my ($item, $err); 288 292 foreach $item (@$$dataPt) { … … 295 299 $name =~ tr/-_a-zA-Z0-9//dc; # remove illegal characters 296 300 length $name or $err = 1, next; 297 Image::ExifTool::AddTagToTable($tagTablePtr, $$item[0], { Name => ucfirst($name) });301 AddTagToTable($tagTablePtr, $$item[0], { Name => ucfirst($name) }); 298 302 } 299 $e xifTool->HandleTag($tagTablePtr, $$item[0], $$item[1]);300 } 301 $err and $e xifTool->Warn('Ignored invalid metadata entry(s)');303 $et->HandleTag($tagTablePtr, $$item[0], $$item[1]); 304 } 305 $err and $et->Warn('Ignored invalid metadata entry(s)'); 302 306 return 1; 303 307 } … … 309 313 sub ProcessBZZ($$$) 310 314 { 311 my ($e xifTool, $dirInfo, $tagTablePtr) = @_;315 my ($et, $dirInfo, $tagTablePtr) = @_; 312 316 require Image::ExifTool::BZZ; 313 317 my $buff = Image::ExifTool::BZZ::Decode($$dirInfo{DataPt}); 314 318 unless (defined $buff) { 315 $e xifTool->Warn("Error decoding $$dirInfo{DirName}");319 $et->Warn("Error decoding $$dirInfo{DirName}"); 316 320 return 0; 317 321 } 318 my $verbose = $e xifTool->Options('Verbose');322 my $verbose = $et->Options('Verbose'); 319 323 if ($verbose >= 3) { 320 324 # dump the decoded data in very verbose mode 321 $e xifTool->VerboseDir("Decoded $$dirInfo{DirName}", 0, length $buff);322 $e xifTool->VerboseDump(\$buff);325 $et->VerboseDir("Decoded $$dirInfo{DirName}", 0, length $buff); 326 $et->VerboseDump(\$buff); 323 327 } 324 328 $$dirInfo{DataPt} = \$buff; … … 326 330 # process the data using the default process proc for this table 327 331 my $processProc = $$tagTablePtr{PROCESS_PROC} or return 0; 328 return &$processProc($e xifTool, $dirInfo, $tagTablePtr);332 return &$processProc($et, $dirInfo, $tagTablePtr); 329 333 } 330 334 … … 349 353 =head1 AUTHOR 350 354 351 Copyright 2003-20 11, Phil Harvey (phil at owl.phy.queensu.ca)355 Copyright 2003-2021, Phil Harvey (philharvey66 at gmail.com) 352 356 353 357 This library is free software; you can redistribute it and/or modify it
Note:
See TracChangeset
for help on using the changeset viewer.