From 2794d7ef5abc4fa8fc2eb42d5c85ada197df0767 Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 2 Aug 2006 00:14:31 +0000 Subject: * Renamed GlobLists to PageSpecs. * PageSpecs can now include nested parens, "and", and "or". This remains backwards compatible to the old GlobList format. It's implemented by treating the GlobList as a very limited microlanguage that is transformed to perl code that does the matching. * The old GlobList format is deprecated, and I encourage users to switch to using the new PageSpec format. Compatability with the old format will be removed at some point, possibly by 2.0. * Wiki rebuild needed on upgrade to this version due to PageSpec change. * Add support for creation_month and creation_year to PageSpec. Closes: #380680 * Changes to index file encoding. --- IkiWiki/CGI.pm | 6 +++--- IkiWiki/Plugin/aggregate.pm | 2 -- IkiWiki/Plugin/brokenlinks.pm | 2 +- IkiWiki/Plugin/inline.pm | 2 +- IkiWiki/Plugin/orphans.pm | 2 +- IkiWiki/Plugin/pagecount.pm | 2 +- IkiWiki/Plugin/pagestats.pm | 2 +- IkiWiki/Render.pm | 29 ++++------------------------- IkiWiki/UserInfo.pm | 2 +- 9 files changed, 13 insertions(+), 36 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index fc5dfc2ef..f69f02a15 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -31,7 +31,7 @@ sub page_locked ($$;$) { #{{{ foreach my $admin (@{$config{adminuser}}) { my $locked_pages=userinfo_get($admin, "locked_pages"); - if (globlist_match($page, userinfo_get($admin, "locked_pages"))) { + if (pagespec_match($page, userinfo_get($admin, "locked_pages"))) { return 1 if $nonfatal; error(htmllink("", "", $page, 1)." is locked by ". htmllink("", "", $admin, 1)." and cannot be edited."); @@ -278,9 +278,9 @@ sub cgi_prefs ($$) { #{{{ $form->field(name => "password", type => "password"); $form->field(name => "confirm_password", type => "password"); $form->field(name => "subscriptions", size => 50, - comment => "(".htmllink("", "", "GlobList", 1).")"); + comment => "(".htmllink("", "", "PageSpec", 1).")"); $form->field(name => "locked_pages", size => 50, - comment => "(".htmllink("", "", "GlobList", 1).")"); + comment => "(".htmllink("", "", "PageSpec", 1).")"); if (! is_admin($user_name)) { $form->field(name => "locked_pages", type => "hidden"); diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 7142e6106..46f2d5128 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -108,8 +108,6 @@ sub delete (@) { #{{{ } #}}} sub loadstate () { #{{{ - eval q{use HTML::Entities}; - die $@ if $@; if (-e "$IkiWiki::config{wikistatedir}/aggregate") { open (IN, "$IkiWiki::config{wikistatedir}/aggregate" || die "$IkiWiki::config{wikistatedir}/aggregate: $!"); diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm index 09ce181cf..7fae9a2f2 100644 --- a/IkiWiki/Plugin/brokenlinks.pm +++ b/IkiWiki/Plugin/brokenlinks.pm @@ -21,7 +21,7 @@ sub preprocess (@) { #{{{ my @broken; foreach my $page (keys %IkiWiki::links) { - if (IkiWiki::globlist_match($page, $params{pages})) { + if (IkiWiki::pagespec_match($page, $params{pages})) { foreach my $link (@{$IkiWiki::links{$page}}) { next if $link =~ /.*\/discussion/i && $IkiWiki::config{discussion}; my $bestlink=IkiWiki::bestlink($page, $link); diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 6a0f00f0f..d8f2ca0d8 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -48,7 +48,7 @@ sub preprocess_inline (@) { #{{{ my @list; foreach my $page (keys %pagesources) { next if $page eq $params{page}; - if (globlist_match($page, $params{pages})) { + if (pagespec_match($page, $params{pages})) { push @list, $page; } } diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index ac4b77527..2219634ca 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -28,7 +28,7 @@ sub preprocess (@) { #{{{ my @orphans; foreach my $page (keys %IkiWiki::renderedfiles) { next if $linkedto{$page}; - next unless IkiWiki::globlist_match($page, $params{pages}); + next unless IkiWiki::pagespec_match($page, $params{pages}); # If the page has a link to some other page, it's # indirectly linked to a page via that page's backlinks. next if grep { diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index 8a1376e09..cfc962b6c 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -23,7 +23,7 @@ sub preprocess (@) { #{{{ return $#pages+1 if $params{pages} eq "*"; # optimisation my $count=0; foreach my $page (@pages) { - $count++ if IkiWiki::globlist_match($page, $params{pages}); + $count++ if IkiWiki::pagespec_match($page, $params{pages}); } return $count; } # }}} diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index a1b4c1d45..de559e2c5 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -34,7 +34,7 @@ sub preprocess (@) { #{{{ my %counts; my $max = 0; foreach my $page (keys %IkiWiki::links) { - if (IkiWiki::globlist_match($page, $params{pages})) { + if (IkiWiki::pagespec_match($page, $params{pages})) { my @bl = IkiWiki::backlinks($page); $counts{$page} = scalar(@bl); $max = $counts{$page} if $counts{$page} > $max; diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 1449b8931..7cb55f128 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -129,37 +129,16 @@ sub preprocess ($$$;$) { #{{{ sub add_depends ($$) { #{{{ my $page=shift; - my $globlist=shift; + my $pagespec=shift; if (! exists $depends{$page}) { - $depends{$page}=$globlist; + $depends{$page}=$pagespec; } else { - $depends{$page}=globlist_merge($depends{$page}, $globlist); + $depends{$page}=pagespec_merge($depends{$page}, $pagespec); } } # }}} -sub globlist_merge ($$) { #{{{ - my $a=shift; - my $b=shift; - - my $ret=""; - # Only add negated globs if they are not matched by the other globlist. - foreach my $i ((map { [ $a, $_ ] } split(" ", $b)), - (map { [ $b, $_ ] } split(" ", $a))) { - if ($i->[1]=~/^!(.*)/) { - if (! globlist_match($1, $i->[0])) { - $ret.=" ".$i->[1]; - } - } - else { - $ret.=" ".$i->[1]; - } - } - - return $ret; -} #}}} - sub genpage ($$$) { #{{{ my $page=shift; my $content=shift; @@ -441,7 +420,7 @@ FILE: foreach my $file (@files) { foreach my $file (keys %rendered, @del) { next if $f eq $file; my $page=pagename($file); - if (globlist_match($page, $depends{$p})) { + if (pagespec_match($page, $depends{$p})) { debug("rendering $f, which depends on $page"); render($f); $rendered{$f}=1; diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm index fabe495bb..a944cafa6 100644 --- a/IkiWiki/UserInfo.pm +++ b/IkiWiki/UserInfo.pm @@ -83,7 +83,7 @@ sub commit_notify_list ($@) { #{{{ length $userinfo->{$user}->{subscriptions} && exists $userinfo->{$user}->{email} && length $userinfo->{$user}->{email} && - grep { globlist_match($_, $userinfo->{$user}->{subscriptions}) } @pages) { + grep { pagespec_match($_, $userinfo->{$user}->{subscriptions}) } @pages) { push @ret, $userinfo->{$user}->{email}; } } -- cgit v1.2.3