<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl

use XML::DT ;

my $filename = shift;

$f=sub{for (@isa) {$ind{$_}= [@{$ind{$_}},[$url,$title]]};
                        $url=$title="";
                        @isa=();
                        "&lt;li&gt;$c"};

%xml=( 'foto'    =&gt; $f,
       'desenho' =&gt; $f,
       'aguarela'=&gt; $f,
       'url'     =&gt; sub{$url=$c;""},
       'title'   =&gt; sub{$title=$c;"&lt;a href=\"$url\"&gt;$c&lt;/a&gt;[$res]&lt;br&gt;"},
       'isa'     =&gt; sub{push(@isa,n($c));" (&lt;i&gt;$c&lt;/i&gt;)"},
       'author'  =&gt; sub{ " &lt;b&gt;$c&lt;/b&gt; " },
       'resol'   =&gt; sub{$res=$c;""},
       'arq'     =&gt; sub{$c},
#      '-default'=&gt; sub{"&lt;li&gt; $q:$c"},
       '-outputenc' =&gt; 'ISO-8859-1',
     );

$imglist = "&lt;ol&gt;" . dt($filename,%xml). "&lt;/ol&gt;" ;

print "&lt;h1&gt;Arquivo de imagens&lt;/h1&gt;",
      mkind(%ind), 
      "&lt;h2&gt;Lista das imagens&lt;/h2&gt; $imglist";  
   
sub mkind{ my %a=@_;
  my $r="&lt;h2&gt;Indice&lt;/h2&gt;&lt;ul&gt;";
  for $p (sort keys %a){
    $r.= "&lt;li&gt;$p -- &lt;ul&gt; ".
          join("",map{"&lt;li&gt;&lt;a href=\"$_-&gt;[0]\"&gt;$_-&gt;[1]&lt;/a&gt;\n"} @{$a{$p}}).
         "&lt;/ul&gt;" ;
  }
  $r . "&lt;/ul&gt;";
}

sub n{ my $a= lc(shift) ;
  for($a){ s/^ +//; s/ +$//; s/  +/ /g; } $a; }
</pre></body></html>