Difference between revisions of "Template:Ask/Main"

From Wikispooks
Jump to navigation Jump to search
(working?)
m (Robin moved page Template:Ask to Template:Ask/Main without leaving a redirect: Wrapping this in another level)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>'''Not to be confused with the parser function, #Ask: from Semantic MediaWiki, this template calls that one, but as a template it is more flexible in allowing a variable number of columns.'''<br/>
+
<noinclude>'''Not to be confused with the parser function, [https://semantic-mediawiki.org/wiki/Help:Inline_queries#Parser_function_.23ask #Ask:] from {{SMW}}, this template calls that one, but as a template it is more flexible in allowing a variable number of columns.'''<br/>
Usage:<br/>
+
Example Usage:<br/>
<poem><nowiki>
+
<poem><font face="courier"><nowiki>
 
{{ask
 
{{ask
|expr= [[Constitutes::{{PAGENAME}}]] OR [[DocType::{{PAGENAME}}]] OR [[DocType::{{Uncapitalize|{{PAGENAME}}}}]]
+
|expression= [[Constitutes::{{PAGENAME}}]] OR [[DocType::{{PAGENAME}}]] OR [[DocType::{{Uncapitalize|{{PAGENAME}}}}]]
 
|mainlabel=Example
 
|mainlabel=Example
 
|format=table
 
|format=table
|properties=Started/ON has cause/Has cause/Description ... Up to 7 properties, separated by / characters
+
|sort=Started
|headers=Date/Attributed to/Perpetrator(s)/Description ... A matching /-separated list of column captions
+
|order=desc
}}</nowiki></poem></noinclude><includeonly>
+
|properties=Started/ON has perpetrator/Has cause/Description
{{#if: {{#titleparts: {{{properties}}} | 7 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
+
|headers=Date/Attributed to/Perpetrator(s)/Description
 +
}}</nowiki></font></poem>
 +
Currently supports up to 7 columns specified by <font face="courier">|properties</font> and <font face="courier">|headers</font>, as a /-separated list
 +
</noinclude><includeonly>
 +
{{#if: {{#titleparts: {{{properties}}} | -6 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
Line 17: Line 21:
 
|?{{#titleparts: {{{properties}}}|1|6}}={{#titleparts: {{{headers}}}|1|6}}
 
|?{{#titleparts: {{{properties}}}|1|6}}={{#titleparts: {{{headers}}}|1|6}}
 
|?{{#titleparts: {{{properties}}}|1|7}}={{#titleparts: {{{headers}}}|1|7}}
 
|?{{#titleparts: {{{properties}}}|1|7}}={{#titleparts: {{{headers}}}|1|7}}
}}|
+
}}|{{#if: {{#titleparts: {{{properties}}} | -5 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
{{#if: {{#titleparts: {{{properties}}} | 6 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
 
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
Line 25: Line 28:
 
|?{{#titleparts: {{{properties}}}|1|5}}={{#titleparts: {{{headers}}}|1|5}}
 
|?{{#titleparts: {{{properties}}}|1|5}}={{#titleparts: {{{headers}}}|1|5}}
 
|?{{#titleparts: {{{properties}}}|1|6}}={{#titleparts: {{{headers}}}|1|6}}
 
|?{{#titleparts: {{{properties}}}|1|6}}={{#titleparts: {{{headers}}}|1|6}}
}}|
+
}}|{{#if: {{#titleparts: {{{properties}}} | -4 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
{{#if: {{#titleparts: {{{properties}}} | 5 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
 
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
Line 32: Line 34:
 
|?{{#titleparts: {{{properties}}}|1|4}}={{#titleparts: {{{headers}}}|1|4}}
 
|?{{#titleparts: {{{properties}}}|1|4}}={{#titleparts: {{{headers}}}|1|4}}
 
|?{{#titleparts: {{{properties}}}|1|5}}={{#titleparts: {{{headers}}}|1|5}}
 
|?{{#titleparts: {{{properties}}}|1|5}}={{#titleparts: {{{headers}}}|1|5}}
}}|
+
}}|{{#if: {{#titleparts: {{{properties}}} | -3 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
{{#if: {{#titleparts: {{{properties}}} | 4 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
 
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|3}}={{#titleparts: {{{headers}}}|1|3}}
 
|?{{#titleparts: {{{properties}}}|1|3}}={{#titleparts: {{{headers}}}|1|3}}
 
|?{{#titleparts: {{{properties}}}|1|4}}={{#titleparts: {{{headers}}}|1|4}}
 
|?{{#titleparts: {{{properties}}}|1|4}}={{#titleparts: {{{headers}}}|1|4}}
}}|
+
}}|{{#if: {{#titleparts: {{{properties}}} | -2 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
{{#if: {{#titleparts: {{{properties}}} | 3 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
 
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|3}}={{#titleparts: {{{headers}}}|1|3}}
 
|?{{#titleparts: {{{properties}}}|1|3}}={{#titleparts: {{{headers}}}|1|3}}
}}|
+
}}|{{#if: {{#titleparts: {{{properties}}} | -1 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
{{#if: {{#titleparts: {{{properties}}} | 2 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
 
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
 
|?{{#titleparts: {{{properties}}}|1|2}}={{#titleparts: {{{headers}}}|1|2}}
}}|
+
}}|{{#if: {{#titleparts: {{{properties}}} | 1 }}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table
{{#if: {{#titleparts: {{{properties}}} | 1 }}|{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table
 
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
 
|?{{#titleparts: {{{properties}}}|1|1}}={{#titleparts: {{{headers}}}|1|1}}
}}|
+
}}|{{#ask: {{{expression}}} |sort={{{sort|}}} |order={{{order|}}} |mainlabel={{{mainlabel|}}}|format=table}}
{{#ask: {{{expr}}} |mainlabel={{{mainlabel|}}}|format=table}}
 
 
}}}}}}}}}}}}}}</includeonly>
 
}}}}}}}}}}}}}}</includeonly>

Latest revision as of 08:09, 8 July 2016

Not to be confused with the parser function, #Ask: from SMW, this template calls that one, but as a template it is more flexible in allowing a variable number of columns.
Example Usage:


{{ask
|expression= [[Constitutes::{{PAGENAME}}]] OR [[DocType::{{PAGENAME}}]] OR [[DocType::{{Uncapitalize|{{PAGENAME}}}}]]
|mainlabel=Example
|format=table
|sort=Started
|order=desc
|properties=Started/ON has perpetrator/Has cause/Description
|headers=Date/Attributed to/Perpetrator(s)/Description
}}

Currently supports up to 7 columns specified by |properties and |headers, as a /-separated list