run_hooks(getopt => sub { shift->() });
if (grep /^-/, @ARGV) {
- print STDERR "Unknown option: $_\n"
+ print STDERR "Unknown option (or missing parameter): $_\n"
foreach grep /^-/, @ARGV;
usage();
}
return $file;
}
-sub pagetype ($) {
+sub isinternal ($) {
my $page=shift;
+ return exists $pagesources{$page} &&
+ $pagesources{$page} =~ /\._([^.]+)$/;
+}
+
+sub pagetype ($) {
+ my $file=shift;
- if ($page =~ /\.([^.]+)$/) {
+ if ($file =~ /\.([^.]+)$/) {
return $1 if exists $hooks{htmlize}{$1};
}
+ my $base=basename($file);
+ if (exists $hooks{htmlize}{$base} &&
+ $hooks{htmlize}{$base}{noextension}) {
+ return $base;
+ }
return;
}
-sub isinternal ($) {
- my $page=shift;
- return exists $pagesources{$page} &&
- $pagesources{$page} =~ /\._([^.]+)$/;
-}
-
sub pagename ($) {
my $file=shift;
my $type=pagetype($file);
my $page=$file;
- $page=~s/\Q.$type\E*$// if defined $type && !$hooks{htmlize}{$type}{keepextension};
+ $page=~s/\Q.$type\E*$//
+ if defined $type && !$hooks{htmlize}{$type}{keepextension}
+ && !$hooks{htmlize}{$type}{noextension};
if ($config{indexpages} && $page=~/(.*)\/index$/) {
$page=$1;
}