Difference between revisions of "Template:Lorem ipsum"

Jump to navigation Jump to search
1,857 bytes removed ,  15:12, 3 February 2009
m
1 revision
(uploaded "Image:1972 Chevrolet Impala Side.JPG": Importing image file)
m (1 revision)
 
Line 1: Line 1:
{{Documentation subpage}}
<includeonly>{{{2|}}}Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.{{{3|}}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{#ifexpr: {{{1|0}}} > 1 |<nowiki />  


This is the {{tl|main talk other}} meta-template.
{{{2|}}}Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 2 |<nowiki />


This template is used inside other templates that need to behave differently (usually look differently) depending on what type of page they are on. It detects and groups all the different [[Wikipedia:Namespace#Enumeration|namespaces]] used on Wikipedia into three types:
{{{2|}}}Fusce convallis, mauris imperdiet gravida bibendum, nisl turpis suscipit mauris, sed placerat ipsum urna sed risus. In convallis tellus a mauris. Curabitur non elit ut libero tristique sodales. Mauris a lacus. Donec mattis semper leo. In hac habitasse platea dictumst. Vivamus facilisis diam at odio. Mauris dictum, nisi eget consequat elementum, lacus ligula molestie metus, non feugiat orci magna ac sem. Donec turpis. Donec vitae metus. Morbi tristique neque eu mauris. Quisque gravida ipsum non sapien. Proin turpis lacus, scelerisque vitae, elementum at, lobortis ac, quam. Aliquam dictum eleifend risus. In hac habitasse platea dictumst. Etiam sit amet diam. Suspendisse odio. Suspendisse nunc. In semper bibendum libero.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 3 |<nowiki />


:'''main''' = Main/article space, as in normal Wikipedia articles.
{{{2|}}}Proin nonummy, lacus eget pulvinar lacinia, pede felis dignissim leo, vitae tristique magna lacus sit amet eros. Nullam ornare. Praesent odio ligula, dapibus sed, tincidunt eget, dictum ac, nibh. Nam quis lacus. Nunc eleifend molestie velit. Morbi lobortis quam eu velit. Donec euismod vestibulum massa. Donec non lectus. Aliquam commodo lacus sit amet nulla. Cras dignissim elit et augue. Nullam non diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In hac habitasse platea dictumst. Aenean vestibulum. Sed lobortis elit quis lectus. Nunc sed lacus at augue bibendum dapibus.{{{3|}}}
:'''talk''' = Any talk space, such as page names that start with "Talk:", "User talk:", "Image talk:" and so on.
}}{{#ifexpr: {{{1|0}}} > 4 |<nowiki />
:'''other''' = All other spaces, such as page names that start with "User:", "Image:", "Wikipedia:" and so on.


This page is also the documentation for some other templates:
{{{2|}}}Aliquam vehicula sem ut pede. Cras purus lectus, egestas eu, vehicula at, imperdiet sed, nibh. Morbi consectetuer luctus felis. Donec vitae nisi. Aliquam tincidunt feugiat elit. Duis sed elit ut turpis ullamcorper feugiat. Praesent pretium, mauris sed fermentum hendrerit, nulla lorem iaculis magna, pulvinar scelerisque urna tellus a justo. Suspendisse pulvinar massa in metus. Duis quis quam. Proin justo. Curabitur ac sapien. Nam erat. Praesent ut quam.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 5 |<nowiki />


* {{tl|main talk other flex}} – It works exactly the same, but it has some minor internal differences. Read more about that [[#Technical details|below]].
{{{2|}}}Vivamus commodo, augue et laoreet euismod, sem sapien tempor dolor, ac egestas sem ligula quis lacus. Donec vestibulum tortor ac lacus. Sed posuere vestibulum nisl. Curabitur eleifend fermentum justo. Nullam imperdiet. Integer sit amet mauris imperdiet risus sollicitudin rutrum. Ut vitae turpis. Nulla facilisi. Quisque tortor velit, scelerisque et, facilisis vel, tempor sed, urna. Vivamus nulla elit, vestibulum eget, semper et, scelerisque eget, lacus. Pellentesque viverra purus. Quisque elit. Donec ut dolor.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 6 |<nowiki />


* {{tl|main talk category other}} – It works exactly the same, apart from that it uses the type '''category''' for pages that start with "Category:", but it still uses the type '''talk''' for "Category talk:" pages.
{{{2|}}}Duis volutpat elit et erat. In at nulla at nisl condimentum aliquet. Quisque elementum pharetra lacus. Nunc gravida arcu eget nunc. Nulla iaculis egestas magna. Aliquam erat volutpat. Sed pellentesque orci. Etiam lacus lorem, iaculis sit amet, pharetra quis, imperdiet sit amet, lectus. Integer quis elit ac mi aliquam pretium. Nullam mauris orci, porttitor eget, sollicitudin non, vulputate id, risus. Donec varius enim nec sem. Nam aliquam lacinia enim. Quisque eget lorem eu purus dignissim ultricies. Fusce porttitor hendrerit ante. Mauris urna diam, cursus id, mattis eget, tempus sit amet, risus. Curabitur eu felis. Sed eu mi. Nullam lectus mauris, luctus a, mattis ac, tempus non, leo. Cras mi nulla, rhoncus id, laoreet ut, ultricies id, odio.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 7 |<nowiki />


* {{tl|main other}}, {{tl|talk other}}, {{tl|image other}} and {{tl|category other}} – Simpler versions that only differentiate between one type of pages and all other.
{{{2|}}}Donec imperdiet. Vestibulum auctor tortor at orci. Integer semper, nisi eget suscipit eleifend, erat nisl hendrerit justo, eget vestibulum lorem justo ac leo. Integer sem velit, pharetra in, fringilla eu, fermentum id, felis. Vestibulum sed felis. In elit. Praesent et pede vel ante dapibus condimentum. Donec magna. Quisque id risus. Mauris vulputate pellentesque leo. Duis vulputate, ligula at venenatis tincidunt, orci nunc interdum leo, ac egestas elit sem ut lacus. Etiam non diam quis arcu egestas commodo. Curabitur nec massa ac massa gravida condimentum. Aenean id libero. Pellentesque vitae tellus. Fusce lectus est, accumsan ac, bibendum sed, porta eget, augue. Etiam faucibus. Quisque tempus purus eu ante.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 8 |<nowiki />


=== Basic usage ===
{{{2|}}}Vestibulum sapien nisl, ornare auctor, consectetuer quis, posuere tristique, odio. Fusce ultrices ullamcorper odio. Ut augue nulla, interdum at, adipiscing non, tristique eget, neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut pede est, condimentum id, scelerisque ac, malesuada non, quam. Proin eu ligula ac sapien suscipit blandit. Suspendisse euismod. Ut accumsan, neque id gravida luctus, arcu pede sodales felis, vel blandit massa arcu eget ligula. Aenean sed turpis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sem eros, ornare ut, commodo eu, tempor nec, risus. Donec laoreet dapibus ligula. Praesent orci leo, bibendum nec, ornare et, nonummy in, elit. Donec interdum feugiat leo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque feugiat ullamcorper ipsum. Donec convallis tincidunt urna.{{{3|}}}
}}{{#ifexpr: {{{1|0}}} > 9 |<nowiki />


This template usually takes three parameters, and returns one of them depending on which type a page belongs to. Like this:
{{{2|}}}Suspendisse et orci et arcu porttitor pellentesque. Sed lacus nunc, fermentum vel, vehicula in, imperdiet eget, urna. Nam consectetuer euismod nunc. Nulla dignissim posuere nulla. Integer iaculis lacinia massa. Nullam sapien augue, condimentum vel, venenatis id, rhoncus pellentesque, sapien. Donec sed ipsum ultrices turpis consectetuer imperdiet. Duis et ipsum ac nisl laoreet commodo. Mauris eu est. Suspendisse id turpis quis orci euismod consequat. Donec tellus mi, luctus sit amet, ultrices a, convallis eu, lorem. Proin faucibus convallis elit. Maecenas rhoncus arcu at arcu. Proin libero. Proin adipiscing. In quis lorem vitae elit consectetuer pretium. Nullam ligula urna, adipiscing nec, iaculis ut, elementum non, turpis. Fusce pulvinar.{{{3|}}}
 
}}{{#ifexpr: {{{1|0}}} > 10 |<nowiki />
:{{tlc|main talk other|Article text|Talk page text|Other pages text}}
 
If the template is on a main space (article) page, it will return this:
 
:{{main talk other|demospace=main|Article text|Talk page text|Other pages text}}
 
If the template is on any talk page, it will return this:
 
:{{main talk other|demospace=talk|Article text|Talk page text|Other pages text}}
 
If the template is on any other page (such as this template page and its doc page), it will return this:
 
:{{main talk other|Article text|Talk page text|Other pages text}}
 
If you only feed a parameter for one or two of the types then this template returns an empty string for the rest of the types. That is, if it for instance is used in one of these ways:
 
:{{tlc|main talk other||Talk text}}
:{{tlc|main talk other||Talk text|}}
 
Then it doesn't render anything in mainspace and other space.
 
:{{main talk other||Talk text|}}  <!-- Don't remove this line. It is supposed to render nothing. But leave it so we see if it fails. -->
 
If this template is used without any parameters or only fed empty parameters (empty strings), then it returns an empty string. That is, then it renders nothing.
 
:{{main talk other}}  <!-- Don't remove this line. It is supposed to render nothing. But leave it so we see if it fails. -->
 
The extended {{tl|main talk category other}} template instead takes four parameters, also in the same order as the words in its name. Like this:
 
:{{tlc|main talk category other|Article text|Talk text|Category text|Other text}}
 
which renders like this:
 
:{{main talk category other|Article text|Talk text|Category text|Other text}}
 
For testing and demonstration purposes these templates can take a parameter named '''demospace''': if it has any of the values '''main''', '''talk''' or '''other''' it makes the template behave as if it is on a page of that type; if the parameter is empty or undefined, the actual page type determines the result.
 
=== Usage example ===
 
This example creates a message box, but these templates can of course be used for many other things than message boxes. This example uses numbered parameters and HTML tables, for the reasons why see the [[#Technical details|technical details section]] below.
 
<pre>
{{main talk other
| 1 = ''This messagebox should not be used in articles.''
| 2 = {{tmbox|text=Talk page notice}}
| 3 = {{ombox|text=Other pages notice}}
}}
</pre>
 
Which renders like this:
 
{{main talk other
| 1 = ''This messagebox should not be used in articles.''
| 2 = {{tmbox|text=Talk page notice}}
| 3 = {{ombox|text=Other pages notice}}
}}
 
Let's see how it looks on talk pages. So we change the first line in the code to this:
 
<pre>
{{main talk other|demospace=talk
</pre>
 
This is how it will render on any talk page:
 
{{main talk other|demospace=talk
| 1 = ''This messagebox should not be used in articles.''
| 2 = {{tmbox|text=Talk page notice}}
| 3 = {{ombox|text=Other pages notice}}
}}
 
And now let's test it for article pages:
 
<pre>
{{main talk other|demospace=main
</pre>
 
This is how it will render in an article:
 
{{main talk other|demospace=main
| 1 = ''This messagebox should not be used in articles.''
| 2 = {{tmbox|text=Talk page notice}}
| 3 = {{ombox|text=Other pages notice}}
}}
 
===== Additional code =====
 
Too make this example complete, here is the rest of the code that is needed to make it a fully equipped template:
 
<pre>
{{main talk other
| demospace = {{{demospace|}}}
| 1 =
| 2 =
| 3 =
}}<noinclude>


{{Lorem ipsum | {{#expr:{{{1}}}-9}} | {{{2|}}} | {{{3|}}} }}
}}</includeonly><noinclude>
{{documentation}}
{{documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS -->
</noinclude>
</noinclude>
</pre>
The line "<code><nowiki>| demospace = {{{demospace|}}}</nowiki></code>" means that your template also will understand the demospace parameter. That means you can demonstrate the different appearances of your template in the documentation for your template.
The "<code><nowiki>{{documentation}}</nowiki></code>" template creates a green [[Wikipedia:Template documentation|documentation]] box, like the one you are reading in right now.
=== Technical details ===
===== Numbered parameters and HTML tables =====
Templates have a problem to handle parameter data that contains equal signs "<code>=</code>". But that is easily solved by using numbered parameters, such as "<code>1=First&nbsp;parameter</code>" and "<code>2=Second&nbsp;parameter</code>".
[[Help:Template|Templates]] also 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.
===== Comparison =====
{{tl|main talk other}} and {{tl|main talk other flex}} behaves exactly the same but internally uses different code:
* {{tld|main talk other}} will still correctly detect all talk pages even if new namespaces are added to Wikipedia. The talk page and main space detection functions are also shorter and thus nicer if you want to copy them to use them elsewhere:
::{{nowrap|<code><nowiki>{{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}| talk | not talk }}</nowiki></code>}}
::{{nowrap|<code><nowiki>{{#ifeq:{{NAMESPACE}}|{{ns:0}}| main | not main }}</nowiki></code>}}
* {{tld|main talk other flex}} is more flexible in that its code is much easier to modify to detect any combination of namespaces as one wishes. But ''please'' copy the code to a new template before you do such modifications.
* If a new namespace is added to Wikipedia then {{tld|main talk other flex}} needs to be manually updated, otherwise it will detect the new talk space as type "other". Fortunately new namespaces is a very rare event.
So if you just need to detect '''main''', '''talk''' and '''other''' then use {{tld|main talk other}}. But if you want to detect other combinations then copy the code from {{tld|main talk other flex}}.
{{tl|main talk category other}} also will correctly detect all talk pages even if new namespaces are added to Wikipedia.
===== Copying to other projects? =====
<!--This section title is linked to from meta:Help:Namespace-->
If you copy these templates to another language Wikipedia or other Wikimedia project, then {{tld|main talk other}} should work as is, but you probably want to update the template's name and its parameter names to your local namespace naming. But you must update the code of {{tld|main talk category other}} and {{tld|main talk other flex}} to your local naming and add any extra namespaces that are local to your wiki, otherwise they will malfunction.
=== CSS namespace detection ===
CSS code can be used instead of these templates to detect namespaces. This can be used for those things that can be coded as CSS, such as colours and borders. See example on the [[Template talk:Main talk other#CSS namespace detection|talk page]].
=== See also ===
Easy to use namespace-detection templates:
* {{tl|main other}} – For article templates.
* {{tl|talk other}} – For talk page templates.
* {{tl|image other}} – For image templates.
* {{tl|category other}} – For category templates.
* {{tl|main talk other}} – Separates some namespaces.
* {{tl|main talk category other}} – Separates some more namespaces.
* {{tl|namespace detect}} – The very versatile one.
* {{tl|namespace detect showall}} – The extremely versatile one.
Technical stuff:
* [[Wikipedia:Namespace]] – Lists all the namespaces.
* [[Help:Magic words]] – About <code><nowiki>{{NAMESPACE}}</nowiki></code> etc.
* [[meta:Help:ParserFunctions]] – About <code><nowiki>{{#ifeq:|||}}</nowiki></code> etc.
<includeonly>
<!-- ADD CATEGORIES AND INTERWIKIS BELOW THIS LINE -->
[[Category:Wikipedia metatemplates|{{PAGENAME}}]]
</includeonly>
Budlight
Bots, Bureaucrats, Administrators
529

edits

Navigation menu