|
|
Line 1: |
Line 1: |
| <includeonly><!-- | | <includeonly><!-- |
| // Define the full array of possible recipes | | // Define the array of recipes using GetRecipesUsing template |
| -->{{#ask:[[Recipe::+]]|?Recipe=|format=array|name=$recipes}}<!--
| | -->{{#arraydefine:$recipes|{{GetRecipesUsing|{{{1|}}}}}|<MANY>}}<!-- |
| // Define the array of items that needs to be queried
| | // Start printing of recipes |
| -->{{#arraydefine:$queryitems|{{{1|}}}|;}}<!-- | | -->{{#arrayprint:$recipes||@recipe@|<!-- |
| // Start array printing of each recipe property
| | --> |
| -->{{#arrayprint:$recipes||@recipecollect@|<!--
| |
| // Define the result item
| |
| -->{{#vardefine:$resultitem|{{#explode:@recipecollect@|<PROP>|0}}}}<!--
| |
| // Split up recipes if having multiple
| |
| -->{{#arraydefine:$splitrecipes|{{#explode:@recipecollect@|<PROP>|1}}|<MANY>}}<!--
| |
| // Start printing of each recipe
| |
| -->{{#arrayprint:$splitrecipes||@recipe@|<!--
| |
| // Reset the validrecipe variable used at the end of each recipe printing
| |
| -->{{#vardefine:$validrecipe|}}<!--
| |
| // Explode the ingredients string and define an array of each ingredients
| |
| -->{{#arraydefine:$ingredients|{{#explode:@recipe@|<RCRD>|1}}|/}}<!--
| |
| // Start printing of each ingredient
| |
| -->{{#arrayprint:$ingredients||@ingredient@|<!--
| |
| // Start printing of each query item
| |
| -->{{#arrayprint:$queryitems||@queryitem@|<!--
| |
| // Define a variable with all the global ingredients in
| |
| -->{{#vardefine:$globalingr|{{#ask:[[@queryitem@]]|?GlobalIngredient=|format=array|pagetitle=hide}}}}<!--
| |
| // Define the array of ingredients to search for based on the items GlobalIngredient properties and its name
| |
| -->{{#arraydefine:$searchingr|{{#if:{{#var:$globalingr}}|{{#var:$globalingr}}<MANY>}}@queryitem@|<MANY>}}<!--
| |
| // Start printing of each ingredient to search for
| |
| -->{{#arrayprint:$searchingr||@searchingr@|<!--
| |
| // If recipe is already valid or ingredient contains the search ingredient, set validrecipe variable to 1
| |
| -->{{#ifeq:{{#expr:{{#if:{{#var:$validrecipe}}|1|0}} or {{#if:{{#pos:@ingredient@|@searchingr@}}|1|0}}}}|1|{{#vardefine:$validrecipe|1}}}}<!--
| |
| // End printing of each search ingredient
| |
| -->}}<!--
| |
| // End printing of each query item
| |
| -->}}<!--
| |
| // End printing of each ingredient
| |
| -->}}<!--
| |
| // If the recipe is valid, starting printing it
| |
| -->{{#if:{{#var:$validrecipe}}|<!--
| |
| // Print recipe @recipe@
| |
| -->
| |
| {{!}}- | | {{!}}- |
| {{!}} {{RecipePrint|{{#var:$resultitem}}|{{#explode:@recipe@|<RCRD>|0}}|{{#explode:@recipe@|<RCRD>|1}}|{{#explode:@recipe@|<RCRD>|2}}|delimiter= {{!}}{{!}} }} | | {{!}} {{RecipePrint|{{#var:$resultitem}}|{{#explode:@recipe@|<RCRD>|0}}|{{#explode:@recipe@|<RCRD>|1}}|{{#explode:@recipe@|<RCRD>|2}}|delimiter= {{!}}{{!}} }} |
| {{!}}-<!-- | | {{!}}-<!-- |
| // End printing of valid recipe
| | // End printing of recipes |
| -->}}<!--
| |
| // End printing of each recipe
| |
| -->}}<!--
| |
| // End array printing of recipes
| |
| -->}}<!-- | | -->}}<!-- |
| --></includeonly><noinclude>{{{{FULLPAGENAME}}/doc}}</noinclude> | | --></includeonly><noinclude>{{{{FULLPAGENAME}}/doc}}</noinclude> |