సహాయం:మూస: కూర్పుల మధ్య తేడాలు

→‎ప్రాథమికం: కొంత అనువాదం
చి బాటు చేసిన మార్పు: ఆంగ్ల నేంస్పేసు పేర్లు తెలుగులోకి మార్పు
పంక్తి 71:
{{Numbered list demo}}</pre>
 
using [[Templateమూస:Numbered list demo]], gives
 
{{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, [[Helpసహాయము:Export|export]] and [[Helpసహాయము:Import|import]] can be helpful. It is also convenient if the template names can be the same on the other project. Therefore, when choosing template names, check which names are in use on other projects to which people might want to copy the templates. Note that if a template is referred to by something like abc<nowiki>{{</nowiki>NAMESPACE}}, a project with different namespace names requires a different template name, or a redirect.
 
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 [[Helpసహాయము:Substitution|page substitution]] with an undefined parameter, not the default but the parameter itself with default is substituted into the wikitext.
 
===Example: named parameter substitution ===
Let's create a template called '''Name-example''' (that is, the template will be '''[[Templateమూస:Name-example]]'''), with a parameter for the first name which we will call ''firstName'', and a parameter for the last name which we will call ''lastName''.<br>
 
Type the following in the new [[Templateమూస:Name-example]]:
 
<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 '''[[Templateమూస:t0]]'''.
 
#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 '''[[Templateమూస:t]]'''.<br>
#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 [[Templateమూస:!]] containing "<span style="background-color:#c8f0ff; padding:0 3px 2px 3px;">|</span>". Using {{tcw|t0}}, compare <nowiki>{{t0|a{{!}}b}}</nowiki> giving {{t0|a{{!}}b}}, <nowiki>{{t0|a&amp;#124;b}}</nowiki> giving {{t0|a&#124;b}} and <nowiki>{{t0|a|b}}</nowiki> giving {{t0|a|b}}. The difference between the first and the second is that in the first case the expanded wikitext is start-a|b-end, while in the second case it is start-a&amp;#124;b-end. This is rendered the same in final output but makes a difference when used in table syntax: this requires the "real" pipe character. For examples see [[m:Help:Template#Pipe character]].
 
===Equals sign in parameter value===
పంక్తి 276:
</nowiki>
 
This continues to be true into version 1.8.2, though [[Templateమూస:Hidden]] provides a puzzling exception. Any explanation?
 
==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 [[Helpసహాయము:Parameter default]].
 
== Template tag lay-out ==
పంక్తి 406:
In simple cases this corresponds to treating the parameter tags as ordinary text, for example:
 
<nowiki>"{{t2demo}}"</nowiki> (using [[Templateమూస:t2demo]] containing {{msgnw:t2demo}}) gives {{t2demo}}
 
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 [[Helpసహాయము:substitution|substituting]] the template. Changes in the working of the template (i.e. changes outside the noinclude-part) are not yet effective in these examples in preview and, in the case of [[Helpసహాయము:substitution|substitution]], in "show changes".
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 [[Templateమూస:t2ademo]] containing {{msgnw:t2ademo}}) gives {{t2ademo|b}}
*<nowiki>{{t2a1|b}}</nowiki> (using [[Templateమూస:t2a1]] containing {{msgnw:t2a1}}) gives {{t2a1|b}}.
*Similarly, <nowiki>{{t2a2|b}}</nowiki> (using [[Templateమూస:t2a2]] containing {{msgnw:t2a2}}) gives {{t2a2|b}}. See also below.
 
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 [[Templateమూస:Lan is mr]].
 
==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 [[Templateమూస:T empty string as parameter name]].
 
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:
 
[[Templateమూస:en]]
*<nowiki>{{msgnw:en}}</nowiki> gives {{msgnw:en}}
*<nowiki>{{en}}</nowiki> gives {{en}}
పంక్తి 459:
*<nowiki>start-{{{1|pqr}}}-end</nowiki>
 
[[Templateమూస:Numbered list demo]]
 
<nowiki>{{msgnw:Numbered list demo}}</nowiki> gives:
పంక్తి 467:
{{Numbered list demo}}
 
The edit box for [[Templateమూస:Numbered list demo]] shows:
<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 '''[[Helpసహాయము:Advanced templates]]'''.
 
===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 [[Helpసహాయము:Section#Editing sections of included templates|editing sections of included templates]]. After saving, one ends up at the page for the component page to which the section belongs.
 
On projects with the [[Helpసహాయము:Interwiki linking#Interlanguage_link_.28software_feature.29|interlanguage link feature]] the composite page shows the combined interlanguage links of all component pages, hence possibly multiple links for one language or even for one page.
 
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:
*[[Templateమూస:List of Languages]] - the "loop body" is in [[Templateమూస:Lang def]]; compared with putting the content of the latter directly in the list the advantage is that the variable part (the value of "code") occurs once each time in the code, although it is used twice. This is important because the fixed part of the list item code can be copied while the variable part is typically inserted manually.
 
For repetition of the same text the loop body can be a parameter, e.g. [[Templateమూస:X5]] (see [http://meta.wikimedia.org/w/index.php?title=Special%3AAllpages&from=X&namespace=10 list]).
 
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 [[Templateమూస:Loop 2]]. Because the software has a built-in protection against infinite nesting (if there is, there will be an error e.g. <code>Fatal error: Maximum execution time of 30 seconds exceeded in /w/includes/Parser.php on line 775</code>), a redirect is used for each level. The number of levels that the template can handle is determined by the number of parameters specified in the two template calls it comprises (because going up a level requires an extra parameter) and the number of existing redirects.
 
Similarly [[Templateమూస:Lanlp 1]] is used for both the inner and the outer of a double loop. Adding an item (here a language) adds to each row and also adds an extra row.
 
'''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 [[Templateమూస:List of template calls 3]], as many as the maximum number of repetitions.
 
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 [[Templateమూస:tli]]) gives {{tli|insert also in target|insert in label}} {{ne}}
*<nowiki>[[a{{tciit}}e|c{{tciil}}d]]</nowiki> (using [[Templateమూస:tciit]] and [[Templateమూస:tciil]]) gives [[a{{tciit}}e|c{{tciil}}d]] {{ne}}
 
*<nowiki>{{la|Help:Tabl|tabl}}</nowiki> {{ut1|la}} gives: {{la|Help:Tabl|tabl}}
 
*[[Templateమూస:Pvn]]
 
==Templates and external links==
పంక్తి 635:
Possible applications are:
 
# Categorising templates, see [[Helpసహాయము:template documentation|template documentation]].
# [[Helpసహాయము:Interwiki_linking|Interlanguage link]]s to similar templates in other languages.
# Pages in the [[Helpసహాయము:MediaWiki namespace|MediaWiki namespace]].
 
<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>&lt;nowiki&gt;#&lt;/nowiki&gt;</tt> or a [[w:en:Numeric character reference|NCR]] like say <tt>&amp;#58;</tt> for a colon, this NCR is also useful in conjunction with definition [[Helpసహాయము:list|list]]s.
 
==Substitution==
 
:''Main article: '''[[Helpసహాయము:Substitution]]'''''
 
Putting "subst:" after the double opening braces causes an [[Helpసహాయము:Automatic conversion of wikitext|automatic conversion of wikitext]] when the referring page is saved: the subst tag is replaced by the wikitext of the template, with the parameter values substituted for the parameters.
 
==Redirection==
పంక్తి 679:
*"double redirects", with one or both being this kind of "pseudo-redirect", work.
 
Compare [[Helpసహాయము:Template namespace]] with [[Helpసహాయము:Template namespace - demo of alternative for redirect]].
 
In a page that in turn includes such a referring page there is no difference.
 
 
Note that embedding works for all pages where [[Helpసహాయము:Redirect|redirecting]] works, and it also fails for all pages where a redirect won't work.
 
==Comparison of linking and embedding==
పంక్తి 692:
 
==Predefined templates==
[[Helpసహాయము:Variable|Variable]]s and [[helpసహాయము:parser function|parser function]]s can be considered predefined templates. They do not have a page that defines in terms of wikitext what they do, because their action is something extra that cannot be constructed from more basic wikitext functionality.
 
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 ([[Helpసహాయము:What links here|What links here]]), based on the [[mw:pagelinks table|pagelinks table]], even if there is no link on the resulting page.
**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 [[Helpసహాయము:parameter default|parameter default]] mechanism were added.
* <tt>&lt;noinclude&gt;</tt> and <tt>&lt;includeonly&gt;</tt> (see above) were added.
 
===Version 1.5===
 
* More [[Helpసహాయము:magic words|magic words]] were added.
 
===Version 1.4===
పంక్తి 748:
== Revision history of pages containing templates ==
 
Pages in the stored [[Helpసహాయము:Page history|page history]] consist of wikitext with possible ''references'' to templates and images. When viewing an old version of a page, these refer to the current versions of the templates and images, if these still exist. Thus the former composite page is not reconstructed.
 
==See also==
*[[m:Help:Advanced templates|Help:Advanced templates]]<!-- m: not directly portable due to examples -->
*[[Helpసహాయము:Calculation]]<!-- maybe portable, test it -->
*[[Helpసహాయము:Parser function]]
*[[m:ParserFunctions|ParserFunctions]]
*[[m:Help:Parameter default|Help:Parameter default]]<!-- m: -->
*[[Helpసహాయము:Magic words]]
*[[Helpసహాయము:Substitution]]<!-- maybe portable, test it -->
*[[Helpసహాయము:Template documentation]]
*[[Helpసహాయము:Variable]]
*[[Helpసహాయము:What links here]]
*[[mw:Manual:$wgEnableScaryTranscluding|interwiki transclusion]]
*[[m:Help:MediaWiki help policy|MediaWiki help templates]]
"https://te.wikipedia.org/wiki/సహాయం:మూస" నుండి వెలికితీశారు