projects
/
matthijs
/
upstream
/
blosxom-plugins.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tagging: Allow using titles in for related stories.
[matthijs/upstream/blosxom-plugins.git]
/
gavinc
/
flavourpathinfo
diff --git
a/gavinc/flavourpathinfo
b/gavinc/flavourpathinfo
index 6ab1b9c660a836de4752db5b0e7bb7312a202f6b..e800a8bfa601166329e5cb8963f2cebe49bdeddb 100644
(file)
--- a/
gavinc/flavourpathinfo
+++ b/
gavinc/flavourpathinfo
@@
-1,7
+1,8
@@
# Blosxom Plugin: flavourpathinfo
# Author(s): Gavin Carr <gavin@openfusion.com.au>
# Blosxom Plugin: flavourpathinfo
# Author(s): Gavin Carr <gavin@openfusion.com.au>
-# Version: 0.00200
0
+# Version: 0.00200
2
# Documentation: 'perldoc flavourpathinfo'
# Documentation: 'perldoc flavourpathinfo'
+# Follows: extensionless
package flavourpathinfo;
package flavourpathinfo;
@@
-9,37
+10,34
@@
use strict;
# --- Configurable variables -----
# --- Configurable variables -----
-my $debug_level = 0;
+# None
# --------------------------------
# --------------------------------
-my $package = 'flavourpathinfo';
-sub debug {
- my ($level, @msg) = @_;
-
- if ($debug_level >= $level) {
- print STDERR "$package debug $level: @msg\n";
- }
-}
+# use Blosxom::Debug debug_level => 1;
sub start {
my $path_info = $blosxom::path_info;
sub start {
my $path_info = $blosxom::path_info;
- debug(1, "original path_info: $path_info");
- return 1 if -e "$blosxom::datadir/$path_info";
# Remove any trailing /
$path_info =~ s! /$ !!x;
# Remove any trailing /
$path_info =~ s! /$ !!x;
+ my $path_file = $blosxom::path_info;
+ $path_file =~ s/\.\w+$/.$blosxom::file_extension/;
+ return 1 if -e "$blosxom::datadir/$path_info" || -f "$blosxom::datadir/$path_file";
+
+ # debug(1, "original path_info: $path_info");
+
# Check file/flavour variant
if ($path_info =~ m! ^ (.*) / ([^/]+) $ !x) {
my $flavour = $2;
my $path_info_new = "$1.$flavour";
my $path_file = "$1.$blosxom::file_extension";
# Check file/flavour variant
if ($path_info =~ m! ^ (.*) / ([^/]+) $ !x) {
my $flavour = $2;
my $path_info_new = "$1.$flavour";
my $path_file = "$1.$blosxom::file_extension";
- debug(2, "path_file: $path_file, path_info_new: $path_info_new");
+
#
debug(2, "path_file: $path_file, path_info_new: $path_info_new");
if (-f "$blosxom::datadir/$path_file") {
if (-f "$blosxom::datadir/$path_file") {
- debug(1, "\$path_info_new exists - updating \$blosxom::path_info");
+
#
debug(1, "\$path_info_new exists - updating \$blosxom::path_info");
$blosxom::path_info = $path_info_new;
$blosxom::flavour = $flavour;
$blosxom::path_info_yr = undef;
$blosxom::path_info = $path_info_new;
$blosxom::flavour = $flavour;
$blosxom::path_info_yr = undef;
@@
-51,21
+49,21
@@
sub start {
if ($path_info =~ m! ^ (?: (.*) / )? ([^/]+) $ !x) {
my $dir = $1 || '';
my $flavour = $2;
if ($path_info =~ m! ^ (?: (.*) / )? ([^/]+) $ !x) {
my $dir = $1 || '';
my $flavour = $2;
- debug(2, "dir: $dir, flavour: $flavour");
+
#
debug(2, "dir: $dir, flavour: $flavour");
# Check there isn't an entry matching this
if (-f "$blosxom::datadir$dir/$flavour.$blosxom::file_extension") {
# Check there isn't an entry matching this
if (-f "$blosxom::datadir$dir/$flavour.$blosxom::file_extension") {
- debug(2, "entry $blosxom::datadir/$dir/$flavour.$blosxom::file_extension found - skipping");
+
#
debug(2, "entry $blosxom::datadir/$dir/$flavour.$blosxom::file_extension found - skipping");
return 1;
}
# Check $dir is a directory (sanity check - overly aggressive?)
if ($dir && ! -d "$blosxom::datadir/$dir") {
return 1;
}
# Check $dir is a directory (sanity check - overly aggressive?)
if ($dir && ! -d "$blosxom::datadir/$dir") {
- debug(2, "dir '$dir' is set but not a directory");
+
#
debug(2, "dir '$dir' is set but not a directory");
return 1;
}
return 1;
}
- debug(1, "dir '$dir' not set or exists and directory - setting \$blosxom::path_info");
+
#
debug(1, "dir '$dir' not set or exists and directory - setting \$blosxom::path_info");
$blosxom::path_info = $dir;
$blosxom::flavour = $flavour;
$blosxom::path_info_yr = undef;
$blosxom::path_info = $dir;
$blosxom::flavour = $flavour;
$blosxom::path_info_yr = undef;
@@
-111,8
+109,11
@@
map to:
=head1 USAGE
=head1 USAGE
-Should be loaded early as it manipulates $blosxom::path_info
-e.g. as 00flavourpathinfo.
+If used with the 'extensionless' plugin, it should be loaded
+*after* extensionless.
+
+But should be loaded early as it manipulates $blosxom::path_info
+e.g. as 02flavourpathinfo.
=head1 SEE ALSO
=head1 SEE ALSO