#!/usr/bin/perl $in_page = 0; while (<>) { chomp; if (/^photosrc:(.+)/) { $photosrc = $1; if (-d $photosrc) { if (opendir(DIR, $photosrc)) { while ($file = readdir(DIR)) { -f "$photosrc/$file" || next; $lfile = $file; $lfile =~ tr/A-Z/a-z/; $file{$lfile} = $file; } closedir(DIR); } } next; } if (/^title:([^:]*):([^:]*):(.*)/) { $index = $1; $dir = $2; $title = $3; next; } if (/^main:(.*)/) { $heading = $1; next; } if (/^page:([^:]*):(.*)/) { $pagefile = $1; push(@pages, $pagefile); $heading{$pagefile} = $2; $tag{$pagefile} = $heading{$pagefile}; $contents{$pagefile} = ""; $photos{$pagefile} = ""; $in_page = 1; next; } if (/^tag:(.*)/) { $tag{$pagefile} = $1; next; } if (/^photo:(.*)/) { $in_page = 0; $photo = $1; $photos{$pagefile} = join(":", split(/:/, $photos{$pagefile}), $photo); next; } if ($in_page) { $contents{$pagefile} .= $_ . "\n"; } else { $photo{"$pagefile:$photo"} .= $_ . "\n"; } } open(INDEX, ">${index}.html") || die "Can't create index $index.html: $!\n"; select(INDEX); print < $title

$heading