సహాయం:మూస: కూర్పుల మధ్య తేడాలు
Content deleted Content added
→ప్రాథమికం: కొంత అనువాదం |
Mpradeepbot (చర్చ | రచనలు) చి బాటు చేసిన మార్పు: ఆంగ్ల నేంస్పేసు పేర్లు తెలుగులోకి మార్పు |
||
పంక్తి 71:
{{Numbered list demo}}</pre>
using [[
{{Numbered list demo}}{{Numbered list demo}}
పంక్తి 85:
A template only works when referred to from a page in the same project. To use it in another project, one has to copy it to there. [[Bugzilla:1126]] is a request to lift that restriction, i.e. allow interwiki use of templates.
The adjustments needed in the copy, to work on the other project, can be reduced by using <nowiki>{{</nowiki>SERVER}}, localurl, and generic namespace names, and writing links in a way that works on multiple projects, e.g. [[m:Help:Table]]. For copying multiple templates, [[
Transclusion across projects, hence changing contents from a central place, is only possible:
పంక్తి 110:
A way to determine whether a parameter is defined is by comparing the results of two occurrences with different defaults, e.g. with <tt><nowiki>{{#ifeq: {{{a|+}}}|{{{a|-}}}|1|0}}</nowiki></tt>.
In the case of [[
===Example: named parameter substitution ===
Let's create a template called '''Name-example''' (that is, the template will be '''[[
Type the following in the new [[
<pre>
పంక్తి 152:
*give back the text of that argument, with no spaces before or after it, between "start-" and "-end":
:'''<nowiki>start-{{{1}}}-end</nowiki>'''
the definition of course being on page '''[[
#Calling the template named ''t0'' with a parameter value of "''a''", i.e.,
పంక్తి 196:
:'''<nowiki>start-{{{1|pqr}}}-end</nowiki>'''<br>
the definition of course being on page '''[[
#Calling the template named ''t'' with a parameter value of "''a''", i.e.,
#::<nowiki>{{t|a}}</nowiki>
పంక్తి 242:
====Pipe character====
To define a parameter value containing a pipe character (|) which is not part of a template call, parser function call, piped link or image tag, use [[
===Equals sign in parameter value===
పంక్తి 276:
</nowiki>
This continues to be true into version 1.8.2, though [[
==Template mechanism==
పంక్తి 328:
When [[m:ParserFunctions|ParserFunctions]] were not available yet, multiple assignments of parameters with the same name (and thus allowing parameter overrides) were ingeniously used to perform branching, e.g. in the now deleted [[:en:Template:If defined]].
See also [[
== Template tag lay-out ==
పంక్తి 406:
In simple cases this corresponds to treating the parameter tags as ordinary text, for example:
<nowiki>"{{t2demo}}"</nowiki> (using [[
Similarly, if part of the parameters is undefined, only those show up as {{{''parameter number or name''}}}.
పంక్తి 414:
Note also that variable tags are not shown, but evaluated.
With noinclude an informative template page can be produced, containing more demos and test cases than just the single default set. Typically, the noinclude-part of a template page contains examples including or [[
However, they are reflected in the rendered page after saving.
పంక్తి 421:
==A parameter value depending on parameters==
As mentioned above, if a parameter is left undefined, the triple braced parameter name in the result does not function as a parameter if the page is called as a template from another page; if it should, do not omit the parameter value but specify it in terms of a parameter of the calling page; compare:
*<nowiki>{{t2ademo|b}}</nowiki> (using [[
*<nowiki>{{t2a1|b}}</nowiki> (using [[
*Similarly, <nowiki>{{t2a2|b}}</nowiki> (using [[
The most straightforward way of expressing a parameter value in terms of a parameter is using the same name and making it equal, e.g. <nowiki>{{</nowiki>Lan is|lr=af|le={{{le}}}}} in [[
==Empty vs. undefined==
పంక్తి 434:
If the parameter is used in a tag like <nowiki><font size></nowiki> the default text may give invalid code that is conveniently ignored, rather than resulting in perhaps ugly code being rendered (but this may depend on the browser). See e.g. [[Template talk:Fontsize]].
Parameter names (as opposed to template names) are case-sensitive, even with respect to the first letter, and spaces are distinguished from underscores. The [[w:en:String_%28computer_science%29#Formal_theory|empty string]] is also a valid parameter name, see [[
Parameter 02 is distinguished from parameter 2: using {{timc|t pl0}}, <nowiki>{{</nowiki>t pl0|5|6|7}} gives {{t pl0|5|6|7}}
పంక్తి 448:
Examples:
[[
*<nowiki>{{msgnw:en}}</nowiki> gives {{msgnw:en}}
*<nowiki>{{en}}</nowiki> gives {{en}}
పంక్తి 459:
*<nowiki>start-{{{1|pqr}}}-end</nowiki>
[[
<nowiki>{{msgnw:Numbered list demo}}</nowiki> gives:
పంక్తి 467:
{{Numbered list demo}}
The edit box for [[
<pre>
#Amsterdam
పంక్తి 487:
Various combinations are possible. E.g., the last two could be combined, so that e.g. every language version of Wikipedia has the same Infobox Countries template (for each project a copy, because the template mechanism can not import across projects), which has parameters for the data, and refers to templates with translations of standard terms.
See also '''[[
===Composite pages===
పంక్తి 511:
A composite page has an integrated TOC and section numbering; the numbering is not reset for each component page.
Editing a section of a component page can be done directly from the composite page, see [[
On projects with the [[
For easy access to the component pages, links to them on the composite page (for example by self-links on the component pages) are convenient. Alternatively, access is through section editing, or, if the component pages are in the template namespace, through the list of templates called from the composite page, at its edit page.
పంక్తి 547:
Example:
*[[
For repetition of the same text the loop body can be a parameter, e.g. [[
A double loop is achieved by a second template that repeatedly calls the first. Similarly for a triple loop, etc. See e.g. [[w:Template:Ld]], [[w:Template:L2d]], and [[w:Template:L3d]].
An example where the same template is used for different loop levels is [[
Similarly [[
'''Providing effective repetition without repetition of similar template calls in the wikitext'''
పంక్తి 569:
Description of the old {{tim|List of template calls}}:
For an arbitrary template with up to three nameless parameters, it is equivalent to calling the template repeatedly, with the first parameter varying, and the possible other parameters fixed: one specifies the name, the values of the fixed parameters, and the list of values the first parameter should have in consecutive template calls, with a sequential number each, and ending with "end". The technique requires redirects like [[
If e.g. the second parameter varies, or two parameters, then a similar template can be made, but each version requires its own set of redirects.
పంక్తి 595:
*<nowiki>[[a{{tciit}}b|c{{tciil}}d]]</nowiki> {{ut2|tciit|tciil}} gives [[a{{tciit}}b|c{{tciil}}d]]
*<nowiki>{{tli|insert also in target|insert in label}}</nowiki> (using [[
*<nowiki>[[a{{tciit}}e|c{{tciil}}d]]</nowiki> (using [[
*<nowiki>{{la|Help:Tabl|tabl}}</nowiki> {{ut1|la}} gives: {{la|Help:Tabl|tabl}}
*[[
==Templates and external links==
పంక్తి 635:
Possible applications are:
# Categorising templates, see [[
# [[
# Pages in the [[
<nowiki>The converse is <includeonly>. Text between <includeonly> and
పంక్తి 659:
If the first included character of a template is one of the Wiki markup characters '''<tt>:;*#</tt>''', then it's interpreted as being at the begin of the line (even when the template call is not).
To avoid this effect use <tt><nowiki>#</nowiki></tt> or a [[w:en:Numeric character reference|NCR]] like say <tt>&#58;</tt> for a colon, this NCR is also useful in conjunction with definition [[
==Substitution==
:''Main article: '''[[
Putting "subst:" after the double opening braces causes an [[
==Redirection==
పంక్తి 679:
*"double redirects", with one or both being this kind of "pseudo-redirect", work.
Compare [[
In a page that in turn includes such a referring page there is no difference.
Note that embedding works for all pages where [[
==Comparison of linking and embedding==
పంక్తి 692:
==Predefined templates==
[[
Some additional differences:
పంక్తి 714:
*Subevaluations involving template calls add to the pre-expand include size (see [[w:Wikipedia:Template limits]]).
*[[w:Side effect (computer science)|Side effects]]:
**Subevaluations producing links add on the target page to the list of incoming links ([[
**Subevaluations involving template calls add on the template page in "What links here" and on the edit page of the page concerned to inclusion items, based on the [[mw:templatelinks table|templatelinks table]].
**Some extensions may perform some action during a subevaluation, e.g. with [[VariablesExtension]] a subevaluation may involve assignment of a value to a variable.
పంక్తి 726:
===Version 1.6===
* More magic words and the [[
* <tt><noinclude></tt> and <tt><includeonly></tt> (see above) were added.
===Version 1.5===
* More [[
===Version 1.4===
పంక్తి 748:
== Revision history of pages containing templates ==
Pages in the stored [[
==See also==
*[[m:Help:Advanced templates|Help:Advanced templates]]<!-- m: not directly portable due to examples -->
*[[
*[[
*[[m:ParserFunctions|ParserFunctions]]
*[[m:Help:Parameter default|Help:Parameter default]]<!-- m: -->
*[[
*[[
*[[
*[[
*[[
*[[mw:Manual:$wgEnableScaryTranscluding|interwiki transclusion]]
*[[m:Help:MediaWiki help policy|MediaWiki help templates]]
|