More actions
Content deleted Content added
Created page with "{{#if: {{{name|}}} | {{#ifeq: {{{name}}} | {{PAGENAME}} | [[Category:{{{1}}}]] }} | [[Category:{{{1}}}]] }}" |
// via Wikitext Extension for VSCode |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{#if: {{{name|}}} | {{#ifeq: {{{name}}} | {{PAGENAME}} | |
<includeonly>{{#ifexpr: (1 {{#if: {{{name| }}} | {{#ifeq: {{{name}}} | {{PAGENAME}} | * 1 | * 0 }} }}{{#if: {{{name| }}} | {{#ifeq: {{{name}}} | ''{{PAGENAME}}'' | + 1 | + 0 }} }}){{#if: {{{ns| }}} | {{#ifeq: {{{ns}}} | {{NAMESPACE}} | * 1 | * 0 }} }} | [[Category:{{{1}}}]] }}</includeonly><noinclude> |
||
== Template Frontend == |
|||
This template is used to categorize pages dynamically based on specific conditions. It evaluates the provided parameters and compares them to the current page name and namespace. |
|||
=== Parameters === |
|||
* <code>1</code>: str (required) |
|||
*: The category name to assign to the current page if all conditions are met. |
|||
* <code>name</code>: str (optional) |
|||
*: If provided, this parameter specifies the page name to compare against the current page. If it matches the current page's name, the condition is satisfied. |
|||
*: Defaults to an empty string if not provided, which means no name-based condition is applied. |
|||
* <code>ns</code>: str (optional) |
|||
*: If provided, this parameter specifies the namespace to compare against the current page's namespace. If it matches the current namespace, the condition is satisfied. |
|||
*: Defaults to an empty string if not provided, which means no namespace-based condition is applied. |
|||
=== Additional Information === |
|||
* All conditions must evaluate to true for the category to be added. Specifically: |
|||
* The <code>name</code> parameter must match the current page's name (if provided). |
|||
* The <code>ns</code> parameter must match the current page's namespace (if provided). |
|||
* If any condition fails, the category is not added to the page. |
|||
== Template Backend == |
|||
This template uses a combination of <code>#if</code>, <code>#ifeq</code>, and <code>#ifexpr</code> parser functions to check multiple conditions: |
|||
1. It checks if the <code>name</code> parameter matches the current page name. |
|||
2. It checks if the <code>ns</code> parameter matches the current namespace. |
|||
3. If all conditions are satisfied, it categorizes the page under the category specified by parameter <code>1</code>. |
|||
</noinclude> |
Latest revision as of 23:47, 8 February 2025
Template Frontend
This template is used to categorize pages dynamically based on specific conditions. It evaluates the provided parameters and compares them to the current page name and namespace.
Parameters
1
: str (required)- The category name to assign to the current page if all conditions are met.
name
: str (optional)- If provided, this parameter specifies the page name to compare against the current page. If it matches the current page's name, the condition is satisfied.
- Defaults to an empty string if not provided, which means no name-based condition is applied.
ns
: str (optional)- If provided, this parameter specifies the namespace to compare against the current page's namespace. If it matches the current namespace, the condition is satisfied.
- Defaults to an empty string if not provided, which means no namespace-based condition is applied.
Additional Information
- All conditions must evaluate to true for the category to be added. Specifically:
* Thename
parameter must match the current page's name (if provided). * Thens
parameter must match the current page's namespace (if provided).
- If any condition fails, the category is not added to the page.
Template Backend
This template uses a combination of #if
, #ifeq
, and #ifexpr
parser functions to check multiple conditions:
1. It checks if the name
parameter matches the current page name.
2. It checks if the ns
parameter matches the current namespace.
3. If all conditions are satisfied, it categorizes the page under the category specified by parameter 1
.