Imager-File-SIXEL
view release on metacpan or search on metacpan
tools/make-images view on Meta::CPAN
$outdated += storeImage($image, $file, $options{check});
}
exit($options{check} && $outdated ? 1 : 0);
# Dies unless the pod files together show exactly the pictures this
# script renders, each through an
# <img src="IMAGE_URL_BASE/TAG/images/NAME.png"> tag, then points every
# such tag to $tag. Returns the number of pod files that were (or, with
# $checkOnly, would be) changed. tools/pod2markdown turns the URLs into
# those of the master branch for the Markdown files.
sub updatePodPictures($podFiles, $tag, $checkOnly, @names) {
my $imageUrl = qr{<img src="\Q@{[IMAGE_URL_BASE]}\E/[^"/]+/images/([^"/]+)\.png"};
my (%shown, %updatedPods);
foreach my $podFile ($podFiles->@*) {
my $pod = readFile($podFile);
my @imageTags = $pod =~ m{(<img\b[^>]*>)}g;
my @badTags = grep { !/^$imageUrl/ } @imageTags;
die map {"$podFile: $_ does not start with <img src=\"@{[IMAGE_URL_BASE]}/TAG/images/NAME.png\"\n"} @badTags if @badTags;
$shown{$_} = 1 foreach $pod =~ m{$imageUrl}g;
(my $updated = $pod) =~ s{(<img src="\Q@{[IMAGE_URL_BASE]}\E/)[^"/]+/}{$1$tag/}g;
$updatedPods{$podFile} = $updated if $updated ne $pod;
( run in 1.678 second using v1.01-cache-2.11-cpan-500dd33cbaf )