[pmwiki-users] Again: looking to add more randomness
Patrick R. Michaud
pmichaud at pobox.com
Wed Feb 15 08:51:44 CST 2006
On Tue, Feb 14, 2006 at 08:41:44PM -0800, Comit wrote:
> Well, here's the Random Page mod:
> http://www.pmwiki.org/wiki/Cookbook/RandomPage
>
> It's almost there. But as you can see you have to type in all the pages to
> include.
> Would be perfect if you could just do:
>
> (:randpage Banners/*) meaning to include all pages.
How about the following instead? (I'm looking to add this to
beta26.)
(:pagelist group=Banners order=random count=1 fmt=#include list=normal:)
Then one can select random pages from any pagelist. The above
will pick a "normal" page from the Banners group. One could also do
things like
- from a trail
(:pagelist group=Banners.IndexTrail order=random count=1 fmt=#include :)
- random page from a category (i.e., pages marked with [[!Banners]])
(:pagelist link=Category.Banners order=random count=1 fmt=#include :)
This could also be used for the "Did You Know" capability,
if you're willing to place each quote into its own wiki page:
%comment% display three quotes
(:pagelist group=Quotes order=random count=3 fmt=#include :)
But there's also some advantage to be had by maintaining the
quotes in a single page, so...
I've looked at the Cookbook.RandomQuotes recipe, and it's not
designed at all the way I would've done it. I think that it
ought to support multi-line quotations, and embedded wiki markup,
and not use the bullet character to separate quotations. Better would be
to format the quotes page and file as something like:
[[#yoda]]
* Do, or do not. There is no "try".
-> Yoda
[[#grandmother]]
* The impossible is only a little bit harder.
-> My Grandmother
[[#churchill_hell]]
* When you're going through hell, keep going.
-> Winston Churchill
Then the random quote recipe could do something like
(:randquote QuotesPage count=3:)
and grab + include three quotes at random from the page. Formatting
things this way also promotes re-use, since an author can then
grab a specific quote with
(:include QuotesPage#grandmother:)
I'll see about writing a version based on this design sometime
later today.
Pm
More information about the pmwiki-users
mailing list