Template:Food that grants: Difference between revisions

optimizing
(support nobullets option)
(optimizing)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq: {{{2|}}} | nobullets | |<ul><li>}}{{#invoke:CargoQuery|main
<includeonly>{{#ifeq: {{{2|list}}}| list | <ul><li> }}<!--
|q?tables=Food, GeneralData
-->{{#invoke:CargoQuery|compound
|q?join=Food._pageName=GeneralData._pageName
|1=tables=Food=F,GeneralData=GD
|q?fields=PlainName=Page
;join on=F.ObjectID=GD.ObjectID
|q?where=CookEffect HOLDS LIKE '%{{{1|}}}%' AND Food._pageNamespace = '0'
;fields={{Favilink format args}}
|template=favilink
;where=F.CookEffect HOLDS '{{{1|}}}' AND F._pageNamespace = '0'
|delimiter={{#ifeq: {{{2|}}} | nobullets |<br>|<li>}}
|2=tables=Liquids=L,GeneralData=GD
;join on=L.ObjectID=GD.ObjectID
;fields={{Favilink format args}}
;where=L.CookEffect HOLDS '{{{1|}}}' AND L._pageNamespace = '0'
|default=No Results!
|default=No Results!
|template=favilink format
|delimiter = {{#switch: {{{2|list}}} |list=<li> |linebreaks=<br> |,<nowiki> </nowiki> }}
}}
}}
{{#ifeq: {{{2|}}} | nobullets | |</ul>}}</includeonly><noinclude>[[Category:Query Templates]]
{{#ifeq: {{{2|list}}} | list | </ul> }}</includeonly><noinclude>[[Category:Query Templates]]
Template that returns a bulleted list of all food items that grant the specified cooking effect provided in the first argument. This uses <code>LIKE</code>, so as long as the first argument contains the word, it will return.
Template that returns a bulleted list of all food items that grant the specified cooking effect provided in the first argument.


==Basic example==
==Default example==
<pre>{{Food that grants|Heat}}</pre>
<pre>{{Food that grants|Heat and fire-based}}</pre>
Output:
Output:
{{Food that grants|Heat}}
{{Food that grants|Heat and fire-based}}


==Example with no bullets==
==Example with linebreaks instead of bullets==
<pre>{{Food that grants|Heat|nobullets}}</pre>
<pre>{{Food that grants|Heat and fire-based|linebreaks}}</pre>
Output:<br>
{{Food that grants|Heat and fire-based|linebreaks}}<br>
 
==Example with commas ==
<pre>{{Food that grants|Heat and fire-based|commas}}</pre>
Output:
Output:


{{Food that grants|Heat|nobullets}}</noinclude>
{{Food that grants|Heat and fire-based|commas}}</noinclude>