minor improvements

master
joey 2007-04-27 17:01:52 +00:00
parent 97f9de14ba
commit ed54f94ee7
3 changed files with 13 additions and 7 deletions

View File

@ -1012,8 +1012,8 @@ sub pagespec_match ($$;@) { #{{{
package IkiWiki::FailReason; package IkiWiki::FailReason;
use overload ( use overload (
'""' => sub { return ${$_[0]} }, '""' => sub { ${$_[0]} },
'0+' => sub { return 0 }, '0+' => sub { 0 },
'!' => sub { bless $_[0], 'IkiWiki::SuccessReason'}, '!' => sub { bless $_[0], 'IkiWiki::SuccessReason'},
fallback => 1, fallback => 1,
); );
@ -1025,8 +1025,8 @@ sub new {
package IkiWiki::SuccessReason; package IkiWiki::SuccessReason;
use overload ( use overload (
'""' => sub { return ${$_[0]} }, '""' => sub { ${$_[0]} },
'0+' => sub { return 1 }, '0+' => sub { 1 },
'!' => sub { bless $_[0], 'IkiWiki::FailReason'}, '!' => sub { bless $_[0], 'IkiWiki::FailReason'},
fallback => 1, fallback => 1,
); );

View File

@ -13,10 +13,10 @@ highlighting which part of the [[PageSpec]] is causing the match to fail.
\[[testpagespec pagespec="foopage or !bar*" match="barpage"]] \[[testpagespec pagespec="foopage or !bar*" match="barpage"]]
This will print out something like "no match: bar* matches barpage", since the part This will print out something like "no match: bar* matches barpage", since
of the [[PageSpec]] that fails is this negated match. the part of the [[PageSpec]] that fails is this negated match.
\[[testpagespec pagespec="foopage or barpage" match="barpage"]] \[[testpagespec pagespec="foopage or barpage" match="barpage"]]
This will print out something like "match: barpage matches barpage", This will print out something like "match: barpage matches barpage",
indicating the part of the [[PageSpec]] that did match. indicating the part of the [[PageSpec]] that caused it to match.

View File

@ -54,4 +54,10 @@ That would obsolete the current simple admin prefs for banned users and
locked pages. Suddenly all the access controls live in one place. locked pages. Suddenly all the access controls live in one place.
Wonderbar! Wonderbar!
(Note that pagespec_match will now return an object that stringifies to a
message indicating why the pagespec matched, or failed to match, so if a
pagespec lock like the above prevents an edit or upload from happening,
ikiwiki could display a reasonable message to the user, indicating what
they've done wrong.)
[[tag soc]] [[tag soc]]