[pmwiki-users] Capture all pages within date range.
Patrick R. Michaud
pmichaud at pobox.com
Tue May 22 13:23:30 CDT 2007
On Tue, May 22, 2007 at 01:59:47PM -0400, Ben Wilson wrote:
> On 5/22/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >On Tue, May 22, 2007 at 01:07:26PM -0400, Ben Wilson wrote:
> >> On 5/22/07, Ben Wilson <dausha at gmail.com> wrote:
> >> > Does anybody have a suggestion on how to capture a pagelist items
> >> > within a date range? For example, I want to list all journal pages
> >> > occurring this week (by page name "Journal-2007-05-21").
> >>
> >> (:pagelist occurring=2007W21:)
> >I can see about adding the ISO week notation if you like.
>
> I am using the ISO week, so that would be helpful.
>
> >We can also add a "thisweek" shortcut for the above, so that
> >it becomes
> >
> > (:pagelist if="date thisweek {=$Name}" :)
>
> However, I want to have a page (Summary-2007W21) list all journal
> entries for that week. Each week, there will be a new summary page. In
> six months, a visitor should be able to visit Summary-2007W21 and see
> the same pages as they would this week.
Okay, then
(:pagelist if="date {(ftime %GW%V {*$Name})} {=$Name}" :)
which returns all of the pages where the name is in the same
week as that of the current page.
> I've thought of using pagelist mapping to (:Week:2007W21:).[1]
> However, that necessitates that the page author embed the PTV, which
> may be asking a bit much.
Even simpler would be to make it a page variable instead of a
page text variable:
$FmtPV['$NameISOWeek'] =
"strftime('%GW%V', array_shift(DRange(\$name)))";
Then {$NameISOWeek} returns the ISO week corresponding to the page's name,
for any page. Then you can do pagelist of pages in the current ISO week
with:
# all pages in the current week
(:pagelist $NameISOWeek="{(ftime %GW%V)}" :)
And to get all of the pages in the same week as the current
page (e.g., Summary-2007W21 [1]):
(:pagelist $NameISOWeek={*$NameISOWeek} :)
This would even work if the Summary page has a "normal" date in its
name instead of a week date -- for example, all of the names below
would evaluate to the same value of $NameISOWeek (i.e., "2007W21"):
Summary-2007-05-24
Summary-20070521
Summary-20070527-XYZ
See, as an example, http://www.pmwiki.org/wiki/Test/NameISOWeek .
Pm
[1] The ability to parse a name like Summary-2007W21 as a date is
dependent on me adding the code to the date parsing routine
that can understand ISO week specifications.
More information about the pmwiki-users
mailing list