[Pmwiki-users] 0.6-beta -- possible change to search results

Jonathan Scott Duff duff
Mon Jan 26 15:36:32 CST 2004


On Mon, Jan 26, 2004 at 02:05:07PM -0700, Patrick R. Michaud wrote:
> On Tue, Jan 27, 2004 at 09:49:09AM +1300, John Rankin wrote:
> > 
> >    [[$Searchresults ...]]
> > 
> > Now that this is a variable, does this make it easier to display a text
> > snippet after each result showing the first reference to $Needle? 
> > [...]
> > Or is this a step too far?
> 
> I actually hadn't considered displaying text snippets after the search
> results yet, but it's a worthy consideration.  So let me just say
> that at the moment it's a step farther than I want to take for the 0.6.0
> release.  Also, rather than adding a parameter to [[$Searchresults]], 
> I'd probably just create a separate directive such as [[$Searchsnippets]].

As long as we're talking about future steps you may or may not take, how
about another mini-language for formatting the output?

	[[$Searchresults:FormatPage]]

and then FormatPage is just a wiki "template" of what the output
should look like.  Of course, the crux of the matter is defining that
template :)  For instance,

=template $WikiGroup $WikiPage ... $WikiAuthor

might cause those things to be output for each and every item found
and maybe 

=template $WikiGroup $WikiPage $FirstPara

might make it show the first paragraph of each entry.  And maybe
what John said looks something like this:

=template $WikiGroup $WikiPage $SearchRef

Et cetera.  The =template lines would be interpretted and filled out
for each iteration of the search while whatever other text is on the
page would be interpretted as-is (as far as wikis go that is)

Hmm. That doesn't quite work does it?  How about some %-specifiers?

[[$Searchresults:format="%g/%p %a %d"]]

	%P - First paragraph of Wiki Page
	%a - wiki Author
	%g - wiki Group
	%G - wiki Group but only if different from previous line
	%m - Modification date (don't ask how to format that!)
	%p - wiki Page
	%r - Paragraph showing first reference to $Needle

The current output format could be achieved by something like
this though:

[[$Searchresults:format="%G/\t%p"]]

Okay, not quite because it'll look like this:

Group/	WikiPage1
	WikiPage2
	WikiPageEtc

or if the Group is long enough this:

SomeReallyLongGroupName/	WikiPage1
	WikiPage2
	WikiPageEtc.

But anyway ... there's a little kernel of applying some old tricks to
this new dog.

> Another consideration: in uploads one gets a list of available uploads
> by doing [[$Attachlist]].  Should that have been [[attachlist:...]]
> instead?  

Perhaps. Especially if you have a modifier to specify the format for the
attachment output like I was suggesting for the search output above.

Of course, I only think this because I'm too much of a programmer (can
you tell from the little brainstorm above? :). These things may need to
be out of the WikiUsers' hands and in the WikiAdministrator's alone.
The more I think about it, the more inclined I am toward that opinion
given PmWikiPhilosophies #1 and #3.

> And to pre-empt the obvious question: No, I really *don't* have a good
> distinction in meanings/interpretation between the [[$Word]] and
> [[word:...]] forms of directives. Originally things such as
> [[$Title]], [[$Group]], [[$Titlespaced]], [[$Groupspaced]],
> [[$Search]], etc. were named by way of reference to their $...Fmt
> variable equivalents, while [[noheader]], [[spacewikiwords]], and the
> like tended to be "directives" that affected the overall page and
> didn't produce any direct output. But [[include:]] and [[$Attachlist]]
> might not fit well into that model... :-( Should we try for something
> more consistent, or not bother?

I vote "not bother" for now.

-Scott
-- 
Jonathan Scott Duff
duff at lighthouse.tamucc.edu



More information about the pmwiki-users mailing list