-
Notifications
You must be signed in to change notification settings - Fork 0
/
Crossover.pm
64 lines (50 loc) · 2.18 KB
/
Crossover.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package Page::Story::Magic::Crossover;
use v5.10.0;
use strict;
use warnings;
use Exporter qw(import);
use List::Util qw(any);
use Page::File qw(file_directory file_list);
use Page::HTML qw(anchor object figure);
use Page::Line qw(line);
use Page::Convert qw(textify searchify);
use Page::Story::Magic::Movie qw(movie_magic);
our $VERSION = "1.0";
our @EXPORT_OK = qw(crossover_magic);
sub crossover_magic {
my %opt = @_;
my $magic = movie_magic( dots => $opt{dots} );
# Start SVG groups
my $open_directory = file_directory('Fandom/Crossovers', 'imagesd');
my $link_directory = file_directory('Fandom/Crossovers', 'images');
my @cross_files = file_list($open_directory);
my @big_images = $opt{big} ? @{$opt{big}} : ();
for my $cross_file (@cross_files) {
my $text = textify($cross_file);
my $big = any { /\b$text\b/i } @big_images;
my $link = "$link_directory/$cross_file";
my $class = 'svg_group';
$class .= ' right' unless $big;
my $title = "$text chart";
$magic->{$text} = sub {
figure(6, sub {
line(7, anchor( '', { 'href' => $link, 'target' => 'new' } )) if $big;
line(7, object( '', { 'data' => $link, 'type' => 'image/svg+xml'} )); # object used instead of img, b/c img won't render svg properly
}, { 'class' => "$class", 'title' => $title });
};
}
# End SVG groups
# Start Thomas Holbrook links
$magic->{'Thommy'} = qq(A<Thomas Holbrookʼs groups|href="http://www.poobala.com/crossoverlistb.html#byreality" target="new">);
$magic->{'TH-DCU'} = qq(A<Thomas Holbrookʼs DCU group|href="http://www.poobala.com/crossoverlistb.html#DCU" target="new">);
for my $num (1..38) {
$magic->{"TH-$num"} = qq(A<Thomas Holbrookʼs group $num|href="http://www.poobala.com/crossoverlistb.html#G$num" target="new">);
}
# End Thomas Holbrook links
return $magic;
}
# Version 1.0
# Depends on Page::Convert, Page::File, Page::HTML, Page::Line, Page::Story::Magic::Movie, and Exporter
# This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See https://dev.perl.org/licenses/artistic.html.
# Copyright © 2020, Lady Aleena (aleena@cpan.org). All rights reserved.
1;