aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/filecheck.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-04-04 17:27:48 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-04-04 17:27:48 -0400
commit8e92468eae9ac0ab8161a0c71ff6c6a0a8aef07a (patch)
tree9e26465e0ca98a5f3cbc6c72a0cace4bf83b93db /IkiWiki/Plugin/filecheck.pm
parent78a69e5bd632eb86ef8135e9c1d05d2c48b43362 (diff)
parent08fda4c9d374de1d3de3172a192d4d915d3dc0c1 (diff)
downloadikiwiki-8e92468eae9ac0ab8161a0c71ff6c6a0a8aef07a.tar
ikiwiki-8e92468eae9ac0ab8161a0c71ff6c6a0a8aef07a.tar.gz
Merge branch 'master'
Conflicts: doc/ikiwiki-makerepo.mdwn
Diffstat (limited to 'IkiWiki/Plugin/filecheck.pm')
-rw-r--r--IkiWiki/Plugin/filecheck.pm32
1 files changed, 16 insertions, 16 deletions
diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
index 27f764e3b..8575ee108 100644
--- a/IkiWiki/Plugin/filecheck.pm
+++ b/IkiWiki/Plugin/filecheck.pm
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::filecheck;
use warnings;
use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
my %units=( #{{{ # size in bytes
B => 1,
@@ -37,9 +37,9 @@ my %units=( #{{{ # size in bytes
# ikiwiki, if you find you need larger data quantities, either modify
# yourself to add them, or travel back in time to 2008 and kill me.
# -- Joey
-); #}}}
+);
-sub parsesize ($) { #{{{
+sub parsesize ($) {
my $size=shift;
no warnings;
@@ -51,10 +51,10 @@ sub parsesize ($) { #{{{
}
}
return $base;
-} #}}}
+}
# This is provided for other plugins that want to convert back the other way.
-sub humansize ($) { #{{{
+sub humansize ($) {
my $size=shift;
foreach my $unit (reverse sort { $units{$a} <=> $units{$b} || $b cmp $a } keys %units) {
@@ -63,11 +63,11 @@ sub humansize ($) { #{{{
}
}
return $size; # near zero, or negative
-} #}}}
+}
package IkiWiki::PageSpec;
-sub match_maxsize ($$;@) { #{{{
+sub match_maxsize ($$;@) {
my $page=shift;
my $maxsize=eval{IkiWiki::Plugin::filecheck::parsesize(shift)};
if ($@) {
@@ -86,9 +86,9 @@ sub match_maxsize ($$;@) { #{{{
else {
return IkiWiki::SuccessReason->new("file not too large");
}
-} #}}}
+}
-sub match_minsize ($$;@) { #{{{
+sub match_minsize ($$;@) {
my $page=shift;
my $minsize=eval{IkiWiki::Plugin::filecheck::parsesize(shift)};
if ($@) {
@@ -107,9 +107,9 @@ sub match_minsize ($$;@) { #{{{
else {
return IkiWiki::SuccessReason->new("file not too small");
}
-} #}}}
+}
-sub match_mimetype ($$;@) { #{{{
+sub match_mimetype ($$;@) {
my $page=shift;
my $wanted=shift;
@@ -140,9 +140,9 @@ sub match_mimetype ($$;@) { #{{{
else {
return IkiWiki::SuccessReason->new("file MIME type is $mimetype");
}
-} #}}}
+}
-sub match_virusfree ($$;@) { #{{{
+sub match_virusfree ($$;@) {
my $page=shift;
my $wanted=shift;
@@ -182,9 +182,9 @@ sub match_virusfree ($$;@) { #{{{
else {
return IkiWiki::SuccessReason->new("file seems virusfree ($reason)");
}
-} #}}}
+}
-sub match_ispage ($$;@) { #{{{
+sub match_ispage ($$;@) {
my $filename=shift;
if (defined IkiWiki::pagetype($filename)) {
@@ -193,4 +193,4 @@ sub match_ispage ($$;@) { #{{{
else {
return IkiWiki::FailReason->new("file is not a wiki page");
}
-} #}}}
+}