Package: ikiwiki
Version: 1.12
Severity: wishlist
Tags: patch

As discussed on IRC, here's a patch allowing you to restrict the
elements inlined by [[inline]]'s globbing according to date.  New
parameters are year, month and day, and you need to have a year if you
use a month (ditto for month and day).  You can then have monthly
pages such as:

,----[ 2006-07.mdwn ]
| Articles posted in July 2006:
| 
| [[inline pages="blog/* !*/Discussion" rootpage="blog" year="2006" month="07"]]
`----

  Automatically generating these pages, or the links to them, is left
as an exercise for the reader (or for cron, or for the next person
interested).

  You'll notice that the presence of a date spec (at least a year)
disables the "show" parameter: if you specify a date range, you get
all the articles in it.  You may remove this behaviour if you find it
obtrusive.

--- inline.pm~   2006-07-29 23:38:19.000000000 +0200
+++ inline.pm   2006-07-31 22:07:51.000000000 +0200
@@ -32,9 +32,18 @@
        if (! exists $params{archive}) {
                $params{archive}="no";
        }
-       if (! exists $params{show} && $params{archive} eq "no") {
+       if (! exists $params{show} && ! exists $params{year} && 
$params{archive} eq "no") {
                $params{show}=10;
        }
+       if (exists $params{day} && ($params{day} !~ /^\d{2}$/ || ! exists 
$params{month})) {
+               return "";
+       }
+       if (exists $params{month} && ($params{month} !~ /^\d{2}$/ || ! exists 
$params{year})) {
+               return "";
+       }
+       if ($params{year} && $params{year} !~ /^\d{4}$/) {
+               return "";
+       }
+       if ($params{year}) {
+           delete $params{show} ;
+       }

        # Avoid nested inlines, to avoid loops etc.
        if ($processing_inline) {
@@ -45,6 +54,11 @@
        my @list;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
+               my (undef,undef,undef,$d,$m,$y,undef,undef,undef) =
+                   gmtime($pagectime{$page}) ;
+               next if $params{year} && $y + 1900 != $params{year} ;
+               next if $params{month} && $m + 1 != $params{month} ;
+               next if $params{day} && $d != $params{day} ;
                if (globlist_match($page, $params{pages})) {
                        push @list, $page;
                }


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-k7
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages ikiwiki depends on:
ii  gcc [c-compiler]              4:4.1.1-5  The GNU C compiler
ii  gcc-3.3 [c-compiler]          1:3.3.6-13 The GNU C compiler
ii  gcc-4.0 [c-compiler]          4.0.3-6    The GNU C compiler
ii  gcc-4.1 [c-compiler]          4.1.1-10   The GNU C compiler
ii  libc6-dev [libc-dev]          2.3.6-16   GNU C Library: Development Librari
ii  libcgi-formbuilder-perl       3.03.01-1  Easily generate and process statef
ii  libcgi-session-perl           4.14-1     Persistent session data in CGI app
ii  libhtml-scrubber-perl         0.08-3     Perl extension for scrubbing/sanit
ii  libhtml-template-perl         2.8-1      HTML::Template : A module for usin
ii  libmail-sendmail-perl         0.79-4     Send email from a perl script
ii  libtime-duration-perl         1.02-1     Time::Duration -- rounded or exact
ii  libtimedate-perl              1.1600-5   Time and date functions for Perl
ii  libxml-simple-perl            2.14-4     Perl module for reading and writin
ii  markdown                      1.0.1-3    Text-to-HTML conversion tool
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 

Versions of packages ikiwiki recommends:
ii  hyperestraier                 1.3.3-1    a full-text search system for comm
ii  subversion                    1.3.2-5    Advanced version control system

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to