X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/ee84ed37709ab91e419cdfa748ab0d8e71bf99b6..fb67496a90881751dc86c774f1b9d99b960c2de4:/IkiWiki.pm?ds=sidebyside diff --git a/IkiWiki.pm b/IkiWiki.pm index d9559bde4..0907df6a1 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -16,7 +16,7 @@ use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %renderedfiles %pagesources %depends %hooks %forcerebuild}; sub defaultconfig () { #{{{ - wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$|\.rss$)}, + wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$)}, wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/, wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]*)\]\]/, wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/, @@ -432,7 +432,9 @@ sub template_params (@) { #{{{ my $text_ref = shift; $$text_ref=&Encode::decode_utf8($$text_ref); }, - filename => "$config{templatedir}/$filename", @_; + filename => "$config{templatedir}/$filename", + loop_context_vars => 1, + @_; } #}}} sub template ($;@) { #{{{ @@ -553,7 +555,7 @@ sub pagespec_translate ($) { #{{{ elsif ($word eq "(" || $word eq ")" || $word eq "!") { $code.=" ".$word; } - elsif ($word =~ /^(link|backlink|creation_month|creation_year|creation_day)\((.+)\)$/) { + elsif ($word =~ /^(link|backlink|created_before|created_after|creation_month|creation_year|creation_day)\((.+)\)$/) { $code.=" match_$1(\$page, ".safequote($2).")"; } else { @@ -598,6 +600,30 @@ sub match_backlink ($$) { #{{{ match_link(pop, pop); } #}}} +sub match_created_before ($$) { #{{{ + my $page=shift; + my $testpage=shift; + + if (exists $pagectime{$testpage}) { + return $pagectime{$page} < $pagectime{$testpage}; + } + else { + return 0; + } +} #}}} + +sub match_created_after ($$) { #{{{ + my $page=shift; + my $testpage=shift; + + if (exists $pagectime{$testpage}) { + return $pagectime{$page} > $pagectime{$testpage}; + } + else { + return 0; + } +} #}}} + sub match_creation_day ($$) { #{{{ return ((gmtime($pagectime{shift()}))[3] == shift); } #}}}