Dan Bolser wrote:

> Hi,
>
> Currently we have tabular format results and, if we want
> customization, we have 'template' format results.
> * Tabular format is great, but is quite inflexible.
> * Template format is very flexible, but complex, hard to develop and
> maintain.
>
> I'd like to suggest a half way house for simple column based tabular
> formatting. Something along the lines of the following:
>
> {{#ask: [[My Cat]]
>  |? My prop 1 # Template for p1
>  |? My prop 2 # Template for p2
>  |? My prop 3
>  |? My prop 4 = P4
> }}
>
> For each row, this would call the template 'Template for p1' with just
> one parameter, the value for 'My prop 1'. The resulting wikitext would
> then be passed back for regular tabular layout. As implied, these 'per
> column' templates could be mixed with 'unadorned' values, that would
> appear just as in regular tabular output.
>
> This would be a much lighter and easier way to 'tweak' the results of
> tabular format without going to the full blown (and sometimes
> unpopular) template format.
>
> I've posted here for discussion, but we can start a feature request
> instead.
>
>
I like this idea, and would like to piggyback a suggestion of my own here.

Sometimes, the reason why the template format is unpopular is because it is
overkill.  For instance, if you're only going to be formatting a single
#ask, creating a full template page for it seems like a bit much.  I'd like
to see an "inline" result format that works just like the template result
format except that it embeds the template directly into the query.  For
example:

{{#ask: [[Category:City]] [[Area::+]] [[Population::+]]
  | ?Population=Inhabitants
  | ?Area#km²=Size in km²
  | format=inline
  | inline={{{#2}}} people squeeze into the {{{#3}}} of {{{#1}}}.
  | limit=3
}}

The hash marks inside the triple-curlies are to distinguish these "inline
template" parameters from any regular template parameters that may be in
play if the #ask appears on a template page.

This is germane to Dan's proposal in that I would recommend inline templates
for what he's suggesting rather than regular templates:

{{#ask: [[My Cat]]
  |? My prop 1 # format string for p1
  |? My prop 2 # format string for p2
  |? My prop 3
  |? My prop 4 = P4
}}

As with my "inline result format" suggestion above, the value for each
cell's format would be specified as {{{#1}}}.  So:


{{#ask: [[Category:City]] [[Area::+]] [[Population::+]]
  | ?Population=Inhabitants # {{{#1}}} people
  | ?Area#km²=Size in km²
  | limit=3
}}

would produce something like:

{|
! Inhabitants !! Size in km²
|-
| Berlin <http://semantic-mediawiki.org/wiki/Berlin> || 3,391,409 people ||
891.85 km²
|-
| Frankfurt <http://semantic-mediawiki.org/wiki/Frankfurt> || 679,664 people
|| 248.31 km²
|-
| Karlsruhe <http://semantic-mediawiki.org/wiki/Karlsruhe> || 285,812 people
|| 173.46 km²
 |}

If you wish to utilize an actual template page, you can do so using the
regular wiki syntax for including a template; the only catch is that I think
that you'd have to explicitly pass the value into the template:

{{#ask: [[My Cat]]
  |? My prop 1 # {{template for p1|{{{#1}}}}}
  |? My prop 2 # {{template for p2|{{{#1}}}}}
  |? My prop 3
  |? My prop 4 = P4
}}

-- 
Jonathan "Dataweaver" Lang
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to