Template:Wn/si/තොරතුරු පැනලය
භාවිතය
[edit source]This template takes as its one parameter the name of a category, and generates a potentially customized infobox for that category. Customizations for any given category are specified in a simply formatted page for that category. Customizations do not involve passing additional parameters to {{Wn/si/තොරතුරු පැනලය}}, and do not involve hacking esoteric internals of templates.
For example,{{Wn/si/තොරතුරු පැනලය|Tuvalu}}
would produce the infobox on the right.
To specify customizations for some category Foobar
, create a page called Template:Wn/si/තොරතුරු පැනලය/lookup/Foobar
, containing a call to template {{Wn/si/තොරතුරු පැනලය වගුව}} with parameters to that template specifying the customizations for the Foobar infobox. Template {{Wn/si/තොරතුරු පැනලය වගුව}} formats these parameters into a wikitable; see for example the customization page for Tuvalu, here.
If there is no customization page for the named category, customizations are read from the table at {{Wn/si/තොරතුරු පැනලය/default}}.
(When editing a page containing a call {{Wn/si/තොරතුරු පැනලය|Wn/si/Foobar}}
, the Foobar infobox customization page appears under "templates used" even if the customization page has not been created.)
Optional parameter lookup
overrides the name of the customization table; for example, {{Wn/si/තොරතුරු පැනලය|Eswatini|lookup=Swaziland}} uses Category:Eswatini with customization page Template:Wn/si/තොරතුරු පැනලය/lookup/Swaziland.
Setting up infoboxes
[edit source]If you're converting an existing infobox template to use {{Wn/si/තොරතුරු පැනලය}}, check first to see whether the old version of the template categorized articles that used it, and if it did, check all the transcluding articles to make sure they are all directly categorized, so that converting the template won't cause those articles to drop out of the category(-ies).
Supposing the infobox template has the same name as the category it represents, cut-and-paste the following as the content of the template page:
{{Wn/si/තොරතුරු පැනලය|{{subst:PAGENAME}}}}<noinclude> An infobox for {{PAGENAME}} and its news. ''Are newer articles not showing? [{{fullurl:{{FULLPAGENAME}}|action=purge}} Refresh]'' Customize this infobox '''{{#ifexist:Template:Wn/si/තොරතුරු පැනලය/lookup/{{PAGENAME}}|[[Template:Wn/si/තොරතුරු පැනලය/lookup/{{PAGENAME}}|here]]|{{plainlinks|{{fullurl:Template:Wn/si/තොරතුරු පැනලය/lookup/{{PAGENAME}}|action=edit&preload=Template:Wn/si/තොරතුරු පැනලය+table/preload}}|here}}}}{{hidden use|Template:Wn/si/තොරතුරු පැනලය වගුව/preload}}'''. [[Category:Wn/si/තොරතුරු පැනල]] </noinclude>
Replace [[Category:Wn/si/තොරතුරු පැනල]]
with some subcategory when appropriate, such as [[Category:wn/si/Country infoboxes]]
. Put any interwiki markup immediately after the category and before the </noinclude>
.
When you preview (or save) the template page, at the bottom of the displayed documentation is a line "Customize this infobox here", with a wikilink on "here". If the customization page does not already exist, following this link provides a default setup for you, with sample contents for you to change. The default customization content provided contains not only a suitable table with customization fields, but also a sample infobox so anyone editing the customization page can see from the page preview what their customizations look like.
We usually fully protect the infobox template itself, as customization takes place on the customization page.
The customization page typically follows the following pattern:
{{Wn/si/තොරතුරු පැනලය වගුව |list dates=yes |image heading=Sample image |image=Example.svg }} {{Wn/si/තොරතුරු පැනලය|{{#titleparts:{{PAGENAME}}||-1}}}} Available fields are documented at {{Wn/si/tl|Wn/si/තොරතුරු පැනලය වගුව}}.
Internals
[edit source]This template uses subtemplates to decompose its operation into manageable subtasks. The main template is responsible only for checking for a customization file and, if found, parsing it. The result, or non-result, of this parse is passed on to {{Wn/si/තොරතුරු පැනලය/p1}}.
This template does not need to know the set of parameters used to customize the infobox. Those parameters are not passed to this template, and this template can parse a customizing table and pass on whatever parameters are specified by the customizing table, leaving it to subtemplates to worry about whether the parameters provided are valid. For explanations of the valid customization parameters, and how to change the set of them if necessary, see {{Wn/si/තොරතුරු පැනලය වගුව}}.
When parsing the customization file, square brackets []
and angle brackets <>
are removed, isolating markup functions involving those characters in the central template; however, pipe characters |
are left intact to allow customization of an image by means of field-display fields embedded in the image name, such as example.svg|border
.
මේවාත් බලන්න
[edit source] ඉහත දැක්වෙන උපදෙස්, Template:Wn/si/තොරතුරු පැනලය/උපදෙස් වෙතින් ගෙනැවිත් ඇත. (සංස්කරණය | ඉතිහාසය) සංස්කාරක වරුන් හට මෙම සැකිල්ලේ වැලිපිල්ල (නිර්මාණය | mirror) සහ testcases (නිර්මාණය) පිටු තුළ අත්හදා බැලීම් සිදු කළ හැකිය. කරුණාකර /උපදෙස් උප පිටුව තුළට ප්රවර්ග එක් කරන්න. මෙම සැකිල්ලේ උප පිටු. |