On Friday 02 March 2007 17:24, Ben Hyde wrote:

Hi Ben, hi Yaron.

> On Mar 2, 2007, at 4:19 AM, Yaron Koren wrote:
> > Hi Ben,
> >
> > My site Discourse DB has formatted ask queries,
> >
> > not yet in the released version, I can send it to you.

I rewrote your patch and included the function into the SVN version. The 
syntax is slightly different in favour of a cleaner interface (IMHO). So you 
now write

<ask format="template" template="yourtemplate"> ... </ask>

where [[Template::yourtemplate]] will be used to render results. The result 
parameters (corresponding to the fields each row in format="table") are 
passed to the template and can be accessed there as {{{1}}}, {{{2}}}, ... 
Pretty much as in the DiscourseDB patch. An example template I use to 
generate mailing lists for being pasted into email clients is:

{{{1}}} <{{{2}}}>,

(the trailing comma after the final item is a minor issue), and queries then 
look like 

<ask format="template" template="maillist" link="none">[[interested 
in::Squash]] [[email:=*]]</ask>

(the squash-player's mailing list at our group wiki).

One reason that we use two parameters "format" and "template" is that we can 
think about augmenting other output formats with a template parameter as well 
(e.g. you could have "ul" with some template for each entry). This could 
solve the trailing-comma-problem in the above template, since format "list" 
knows how to separate result "rows" with commas.

We also use the fact that each format has exactly one name that appears in the 
parameter format to do filtering: you can set the array InlineQuery::$formats 
to contain only those format strings that you want to allow in your wiki (so 
people can switch off all formats they don't like).

>
> Oh!  That looks like it would scratch my itch!  So pretty please!
>
> My tables[1] with thank you!
>
> The syntax I mentioned was lifted from here
>    http://ontoworld.org/wiki/Help:Inline_queries#Output_formats
>
> But now I see here
>    http://ontoworld.org/wiki/Semantic_MediaWiki_development_activities
> at "Enable template-based output format" that it's in the that always
> challenging[2] 90% finished state. - ben

The 90% mainly say "please test me and report any bugs". The syntax is as 
straightforward as the above. there are some minor open issues, e.g. which 
separator should be used for multiple values in one result field ("table" 
format uses newlines to separate entries in one field, I think "template" 
currently uses colons but maybe should use a parameter like "sep" known 
from "list").

-- Markus

>
> ps. I presume the intent is to put examples and possibly further doc
> on the pages like Help:List format  I'd be happy to help with that.

Feel free to start such non-existant documentation pages. It would be nice to 
have a common formatting scheme (maybe: intro, usage and parameters, 
examples), but any additional information can be useful for a start.

>
> [1] http://simile.mit.edu/wiki/Exhibit/Examples#Folks_at_Work
> [2] "forceps doctor?"
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Semediawiki-user mailing list
> Semediawiki-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user

-- 
Markus Krötzsch
Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe
[EMAIL PROTECTED]        phone +49 (0)721 608 7362
www.aifb.uni-karlsruhe.de/WBS/     fax +49 (0)721 693  717

Attachment: pgpUc1TCtYrKp.pgp
Description: PGP signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Semediawiki-user mailing list
Semediawiki-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-user

Reply via email to