Clay-UI
view release on metacpan or search on metacpan
tools/make-images view on Meta::CPAN
return [ sort @files ];
}
# Dies unless the pod files together show exactly the files this script
# renders: a PNG through an <img src="IMAGE_URL_BASE/TAG/images/NAME.png">
# tag preceded by a "=for text Figure: images/NAME.png" paragraph for
# readers without HTML, any other file through a link to
# FILE_URL_BASE/TAG/images/NAME.EXT. Then points every such URL to $tag.
# Returns the number of pod files that were (or, with $check_only, would
# be) changed.
sub update_pod_pictures ($pod_files, $tag, $check_only, @names) {
my $image_url = qr{<img src="\Q@{[IMAGE_URL_BASE]}\E/[^"/]+/images/([^"/]+\.png)"};
my $file_url = qr{\Q@{[FILE_URL_BASE]}\E/[^\s/>]+/images/([^\s/>]+)};
my (%shown, %updated_pods);
for my $pod_file (@$pod_files) {
my $pod = read_file($pod_file);
my @bad_tags = grep { !/^$image_url/ } $pod =~ m{(<img\b[^>]*>)}g;
die map {"$pod_file: $_ does not start with <img src=\"@{[IMAGE_URL_BASE]}/TAG/images/NAME.png\"\n"} @bad_tags if @bad_tags;
for my $name ($pod =~ m{$image_url}g) {
die "$pod_file: no '=for text Figure: images/$name' paragraph for the <img> that shows it\n"
unless $pod =~ m{^=for text Figure: images/\Q$name\E\b}m;
( run in 2.732 seconds using v1.01-cache-2.11-cpan-145b269f2f3 )