Commit ce6b0fd
xxwhirlpool
·
2026-05-26 15:44:38 -0400 EDT
parent fedd132
iconshare
4 files changed,
+85,
-1
+2,
-0
| ... | ... | @@ -49,5 +49,7 @@ config/.local/bin/uvx | |
| 49 | 49 | scripts/Scripts/.directory | |
| 50 | 50 | scripts/Scripts/icons | |
| 51 | 51 | scripts/Scripts/gallery.html | |
| 52 | + | scripts/Scripts/iconshare_pl/icons/* | |
| 53 | + | scripts/Scripts/iconshare_pl/out/* | |
| 52 | 54 | config/.local/bin/khal_reminder | |
| 53 | 55 | config/.config/khal/config_reminder |
| ... | ... | @@ -44,4 +44,4 @@ files = Dir[icondir].each do |icon| | |
| 44 | 44 | htmlfile.write(imghtml) | |
| 45 | 45 | end | |
| 46 | 46 | ||
| 47 | - | htmlfile.write("</main") | |
| 47 | + | htmlfile.write("</main>") |
| ... | ... | @@ -0,0 +1,44 @@ | |
| 1 | + | #!/usr/bin/env perl | |
| 2 | + | ||
| 3 | + | use 5.38.2; | |
| 4 | + | use strict; | |
| 5 | + | use warnings; | |
| 6 | + | ||
| 7 | + | use Template; | |
| 8 | + | use File::Slurp; | |
| 9 | + | use File::Copy; | |
| 10 | + | ||
| 11 | + | sub usage { | |
| 12 | + | die("Usage: iconshare.pl [DIR]\n"); | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | my ($icon_dir) = @ARGV; | |
| 16 | + | ||
| 17 | + | if (not defined $icon_dir) { | |
| 18 | + | usage | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | my @icons = read_dir($icon_dir, prefix => 1); | |
| 22 | + | ||
| 23 | + | mkdir("out"); | |
| 24 | + | ||
| 25 | + | if ( -d "out" ) { | |
| 26 | + | foreach my $icon (@icons) { | |
| 27 | + | copy($icon, "out") or die "copy failed: $!"; | |
| 28 | + | } | |
| 29 | + | } else { | |
| 30 | + | die("directory cannot be created: out, $!"); | |
| 31 | + | } | |
| 32 | + | ||
| 33 | + | my %data = ( | |
| 34 | + | title => "gallery", | |
| 35 | + | icons => \@icons, | |
| 36 | + | ); | |
| 37 | + | ||
| 38 | + | my $tt = Template->new({ | |
| 39 | + | INCLUDE_PATH => "./templates", | |
| 40 | + | INTERPOLATE => 1, | |
| 41 | + | }) or die "$Template::ERROR\n"; | |
| 42 | + | ||
| 43 | + | my $htmlfile = "out/gallery.html"; | |
| 44 | + | $tt->process("iconshare.tt", \%data, $htmlfile) or die $tt->error(), "\n"; |
| ... | ... | @@ -0,0 +1,38 @@ | |
| 1 | + | <!DOCTYPE html> | |
| 2 | + | <html lang="en"> | |
| 3 | + | <head> | |
| 4 | + | <title>[% title %]</title> | |
| 5 | + | ||
| 6 | + | <style> | |
| 7 | + | html { | |
| 8 | + | background: #eff1f5; | |
| 9 | + | display: flex; | |
| 10 | + | flex-direction: column; | |
| 11 | + | align-items: center; | |
| 12 | + | } | |
| 13 | + | ||
| 14 | + | .wrapper { | |
| 15 | + | background: #303446; | |
| 16 | + | padding-block: 1rem; | |
| 17 | + | padding-inline: 1rem; | |
| 18 | + | max-width: 27em; | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | .wrapper img { | |
| 22 | + | margin-block-end: 4px; | |
| 23 | + | padding-inline: 2px; | |
| 24 | + | } | |
| 25 | + | </style> | |
| 26 | + | </head> | |
| 27 | + | ||
| 28 | + | <body> | |
| 29 | + | ||
| 30 | + | <main class="wrapper"> | |
| 31 | + | [% FOREACH icon IN icons %] | |
| 32 | + | <img src="[% icon %]"> | |
| 33 | + | [% END %] | |
| 34 | + | </main> | |
| 35 | + | ||
| 36 | + | </body> | |
| 37 | + | ||
| 38 | + | </html> |