+ # turn glob into a safe regexp
+ my $re=IkiWiki::glob2re(shift);
+
+ my $val;
+ if (exists $pagestate{$page}{meta}{$field}) {
+ $val=$pagestate{$page}{meta}{$field};
+ }
+ elsif ($field eq 'title') {
+ $val = pagetitle($page);
+ }
+
+ if (defined $val) {
+ if ($val=~/^$re$/i) {
+ return IkiWiki::SuccessReason->new("$re matches $field of $page", $page => $IkiWiki::DEPEND_CONTENT);
+ }
+ else {
+ return IkiWiki::FailReason->new("$re does not match $field of $page");
+ }
+ }
+ else {
+ return IkiWiki::FailReason->new("$page does not have a $field");
+ }
+}
+
+package IkiWiki::PageSpec;
+
+sub match_title ($$;@) {
+ IkiWiki::Plugin::meta::match("title", @_);
+}
+
+sub match_author ($$;@) {
+ IkiWiki::Plugin::meta::match("author", @_);
+}
+
+sub match_authorurl ($$;@) {
+ IkiWiki::Plugin::meta::match("authorurl", @_);
+}
+
+sub match_license ($$;@) {
+ IkiWiki::Plugin::meta::match("license", @_);
+}
+
+sub match_copyright ($$;@) {
+ IkiWiki::Plugin::meta::match("copyright", @_);
+}