From d2cbbf5012636f5d18c313d28488d2cb8240afb0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 28 Dec 2009 13:10:39 +0100 Subject: Add --title and --css option --- bin/gen-xhtml-thumbnails | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/gen-xhtml-thumbnails b/bin/gen-xhtml-thumbnails index 7b25023..db9a43c 100755 --- a/bin/gen-xhtml-thumbnails +++ b/bin/gen-xhtml-thumbnails @@ -4,15 +4,19 @@ use strict; use warnings; use Image::Imlib2; +use Getopt::Long; use constant { DEFAULT_FILEMODE => oct(644), THUMB_MAX_DIM => 150, THUMB_QUALITY => 60, }; -my $directory = shift || '.'; +my $directory = '.'; my $thumbdir = "$directory/.thumbs"; my $indexfile = "$directory/index.xhtml"; +my $title = ''; +my $css_line = ''; +my $css_source; my ($dx, $dy); my @files; my $number = 0; @@ -30,15 +34,29 @@ sub print_progress { return; } +GetOptions( + 'css=s' => \$css_source, + 'title=s' => \$title, +); + +if (@ARGV > 0) { + $directory = shift; +} + +if (defined($css_source)) { + $css_line = ""; +} + open(my $index, '>', $indexfile) or die("Cannot open $indexfile for writing: $!"); -print $index <<'EOD'; +print $index <<"EOD"; - + $title + $css_line
EOD -- cgit v1.2.3