Zum Inhalt springen

Vorlage:Namespace detect/Doku: Unterschied zwischen den Versionen

Added a "Technical details" section and some other fixes.
imported>Davidgothberg
(Noting that using an empty "other=" is also valid.)
imported>Davidgothberg
(Added a "Technical details" section and some other fixes.)
Zeile 49: Zeile 49:
| image    = Image page text
| image    = Image page text
| category = Category page text
| category = Category page text
| other    =
}}
}}
</pre>
</pre>


On any pages other than image and category pages the code above will render nothing.
On any pages other than image and category pages the code above will render nothing.
<!-- Do not remove this one. It is supposed to render nothing, but we have it here for testing purposes. -->
:{{namespace detect
:{{namespace detect
| image    = Image page text
| image    = Image page text
| category = Category page text
| category = Category page text
| other    =
}}
}}


Zeile 74: Zeile 77:
}}
}}


==== Demospace ====
=== Demospace ===


For testing and demonstration purposes this template can take a parameter named '''demospace'''. Demospace understands any of the page type names used by this template, including the '''other''' type. It tells the template to behave like it is on some specific type of page. Like this:
For testing and demonstration purposes this template can take a parameter named '''demospace'''. Demospace understands any of the page type names used by this template, including the '''other''' type. It tells the template to behave like it is on some specific type of page. Like this:
Zeile 103: Zeile 106:


If the '''demospace''' parameter is empty or undefined then the template will detect page types as usual.
If the '''demospace''' parameter is empty or undefined then the template will detect page types as usual.
=== Technical details ===
[[Help:Template|Templates]] do have a problem to handle parameter data that contains pipes "<code>|</code>", unless the pipe is inside another template <code><nowiki>{{name|param1}}</nowiki></code> or inside a piped link <code><nowiki>[[Help:Template|help]]</nowiki></code>. Thus templates can not handle [[Help:Table|wikitables]] as input unless you escape them by using the {{tn|!}} template. This makes it hard to use wikitables as parameters to templates. Instead the usual solution is to use "[[Help:HTML in wikitext|HTML wikimarkup]]" for the table code, which is more robust.
For more technical details such as about "copying to other projects" and "CSS based namespace detection" see {{tl|main talk other}} and its talk page.


=== See also ===
=== See also ===
Anonymer Benutzer