Jump to content

विकिपीडिया:धूळपाटी८

विकिपीडिया, मुक्‍त ज्ञानकोशातून
सहाय्य:साचापरिस्फोट

Substitution हे विकिटेक्स्टचे स्वयमेव रुपांतरण आहे.of a page referring to a साचा, variable, किंवा parser function when the referring page is saved.

In the case of साचा substitution the साचा call is replaced by the साचा content with substitution of the parameters. Thus a साचा is used as macro आणि the page is macro expanded when the page is saved rather than, as usually happens, when the page is viewed.

In the case of substitution of a variable किंवा parser function the reference to it is replaced by the resulting value.

Substitution is done by putting the विभाग:Help:Magic_words (चर्चा⧼dot-separator⧽+/−⧼dot-separator⧽इति⧼dot-separator⧽दुवे⧼dot-separator⧽doc⧼dot-separator⧽उपपाने⧼dot-separator⧽चाचणी (निकाल)) subst: after the double opening braces.

The result (in the form of the difference with the saved wikitext) can be seen before (किंवा without) saving by pressing "Show changes". However, if the text covers more than one paragraph this diff page is not very suitable for copying the result (e.g. for stepwise substitution without saving every step), because of plus signs in the margin.

Applications उपयोगिता

[संपादन]

Substitution of a साचा:

  • Make a rendered page independent of the साचा:
    • The rendered page does not change when the साचा is edited.
    • The page can be copied to another project without copying the साचा.
  • Make page rendering easier आणि therefore faster for the server.
  • Analyse आणि demonstrate the working of साच्यांचे. However, in some cases substitution works differently.
  • Make the correspondence between wikitext आणि rendered page easier to understand (this may apply, the opposite may also apply).

Substitution of a time-dependent variable:

  • Make a rendered page independent of the time.

Substitution of a page-dependent variable:

  • Make a rendered page independent of renaming of the page आणि of copying the wikitext to another page (the opposite applies if the variable PAGENAME is used in a no-include part of the page to include the page itself).

Some MediaWiki extensions have the restriction that if they are used in a साचा with parameters, they only work if the साचा is substituted. This applies for उदाहरण in the case of a साचा parameter inside an in-page query in Semantic MediaWiki.

ओव्हर व्ह्यू

[संपादन]

For the discussion of substitution, an "ordinary साचा" is any page included by {{subst:pagename }} for pages in the साचा namespace किंवा {{subst:fullpagename }} for pages in other namespaces. It's also possible to substitute variables आणि parser functions collectively known as "predefined साचे".

Substitution is a separate process before expansion of non-substituted साचे, parser functions, variables. आणि parameters. Substitutions in the expression for the name of the साचा किंवा parser function, in the parameter definitions of the substituted साचा किंवा parser function आणि in the body of the substituted साचा are done first. Non-substituted expansion is done later, so at the time of the substitution these expressions with pairs of double braces are treated as plain text. Thus during substitution there can be a parameter name with braces in the call of the substituted साचा (e.g. a{{bc}}d) that matches a parameter with the same name in the साचा body.

If one attempts to apply substitution to a non-existing साचा etc. there is no substitution, the "subst:" prefix is kept in the wikitext.

After the substitution process, expansion of साचे etc. आणि other processing of the resulting wikitext works as usual. However, this cannot undo a mismatch of parameter names during substitution (see also the second header "Partial substitution" below).

Substitution is only possible if the following has been fully evaluated:

  • the name of the साचा, parser function किंवा variable
  • in the case of a साचा: the parameter names in the साचा call आणि in the साचा itself
  • in the case of #if, #ifexpr, #ifexist, आणि #iferror, the parameter after the colon
  • in the case of #ifeq, the parameter after the colon आणि the next one
  • in the case of #switch, the parameter after the colon आणि the expressions to the left of the equals signs

Since, as said, substitution is done before other expansion, the abovementioned required evaluation has not taken place if the expressions involve non-substituted expansion.

Also in the case of other parser functions than mentioned, a not fully evaluated parameter after the colon causes the parser function to be applied to the wikitext with braces आणि not the expanded wikitext, affecting the result.

उदाहरणे:

  • {{subst:Help:L{{tc}}k}} using m:Template:tc (backlinks edit), does not do substitution, because Help:L{{tc}}k is not an existing page, although Help:L{{tc}}k is rendered as Help:L{{tlc|...}}k. Thus the resulting wikitext is the same as the original wikitext आणि rendered as {{subst:Help:L{{tlc|...}}k}}.
  • {{subst:#if:{{x0|abc}}|yes|no}} using m:Template:x0 (backlinks edit), gives the wikitext "yes", while {{subst:#if:{{subst:x0|abc}}|yes|no}} gives the wikitext "no", आणि {{#if:{{x0|abc}}|yes|no}} is rendered as "yes".

In principle the wikitext resulting from full substitution is, immediately after that, rendered the same as the wikitext with ordinary inclusion.

Note however that on substitution of a parser function, an undefined parameter with default, used in a parameter value, is not replaced by the default, आणि is for उदाहरण not allowed in the numerical expression evaluated on substitution of #expr:

  • {{#expr:2*{{{p|3}}}}} gives 6, while {{subst:#expr:2*{{{p|3}}}}} gives "Expression error: unrecognised punctuation character "{""

On substitution of a साचा that contains this, {{{p|3}}} is either replaced by the value of {{{p}}} किंवा by 3, so then there is no complication.

{{ {{t6}} }} using साचा:Tcw is rendered as {{ साचा:T6 }}; {{subst:{{subst:t6}} }} gives the wikitext {{subst:t2demo|a }} rendered the same as the wikitext, आणि on the next edit/save changed into start-a -middle-{{{2}}}-end; {{ {{subst:t6}} }} gives the wikitext {{ t2demo|a }}, rendered as साचा:T2demo. This is because, both without substitution आणि in the case of full substitution, the pipe characters in साचा calls, excluding those inside inner साचा calls, साचा parameters, links, आणि image tags, determine the separation of parameter definitions from each other आणि from the साचा name. This separation does not depend on possible extra pipe characters in the expanded form of the साचा name आणि parameter definitions. However, if after substitution of an inner साचा the pipe character is in the outer साचा call it is one like any other आणि plays its part in determining the separation. In other words, parsing is done first once for substitution, आणि then once for rendering, but in both cases not an extra time in between. In the case of substitution of the inner साचा only, two subsequent parsings are effective.

When substituting a साचा containing {{{p|q}}} (a parameter tag with default) this results in the value of p if it is defined, आणि otherwise in q. For उदाहरण, using साचा:Timc, {{subst:t pd}} gives the wikitext 2.

If a page substitutes itself (e.g. in the noinclude-part of a साचा page) it substitutes the old version.

उपयोग जकंसिडरेशन्स

[संपादन]

As mentioned, a change of an ordinary साचा after substitution does not affect the page in which it was substituted, आणि a substituted variable depending on time no longer depends on time, etc. However, a substitution of e.g. {{#expr:2*3}} does not affect rendering at all.

The relationship between wikitext of a page आणि its rendering can become easier to understand after substitution, because one has all wikitext together, आणि parameter substitutions have been performed.

It can also become more complex. Separately focusing on understanding a साचा call आणि understanding the साचा content can be easier. Wikitext after substitution is often more complex than when the required wikitext would have been written directly.

Unlike a साचा call (if one knows about साचे), wikitext after substitution does not show how one can produce a similar result. The wikitext can be long आणि complicated, आणि therefore cumbersome to write directly, किंवा it can be simple, e.g. a number resulting from a computation, but cumbersome to find directly. One may think that the wikitext is what one is supposed to write आणि find directly to get the result, even in cases where that would be very impractical.

In such cases documentation of the साचा call is useful. Just like in computer programming we change the source code आणि/किंवा the data to produce new results, आणि we do not directly change the object file, here we would change the साचा calls आणि/किंवा the साचे, instead of changing the wikitext resulting from substitution directly.

Ordinary साचे

[संपादन]

In the case of substituting an ordinary साचा, the साचा tag is replaced by the wikitext of the साचा, with the parameter values substituted for the parameters.

उदाहरण
m:Template:t2 (backlinks edit), containing
start-{{{1}}}-middle-{{{2}}}-end
आणि called as {{subst:t2|[[a]]|{{tc}}}} (see {{tc}}) gives the wikitext:
start-[[a]]-middle-{{tc}}-end, rendering as
start-a-middle-{{tlc|...}}-end.

Substitution removes the noinclude parts आणि the includeonly tags.

Parameters:

  • A substitution with p=r replaces {{{p}}} आणि {{{p|q}}} by r; this includes the cases that r is of the form {{{s}}} किंवा {{{s|t}}}.
  • A substitution with undefined p preserves {{{p}}} आणि replaces {{{p|q}}} by the default q.

With "subst:" the replacement of a साचा tag by wikitext does not work recursively. For full recursive substitution use विशेष:साचेविस्तारकरा. See also substall, आणि optional substitution below.

Stepwise substitution of साचे including other साचे including more साचे etc. can be useful for analyzing आणि documenting the behaviour of complex साचे, for an उदाहरण see m:Template talk:Lop.

However, after a substitution a page may render differently, e.g. if साचे produce braces, pipes, आणि/किंवा equals signs which after substitution determine expansion of other साचे, but without substitution are treated as plain text.

In the absence of parameters, साचा substitution can be compared with copying the wikitext, किंवा the rendering of a previewed किंवा saved {{ msgnw:pagename }} inclusion. However, साचा substitution excludes <noinclude> parts, removes <includeonly> tags, आणि replaces undefined parameters with defaults by the defaults.

प्रीडिफाईन्ड साचे

[संपादन]

In the case of substituting a predefined साचा, without parameters depending on other साचे, the tag is replaced by the result. Please note that subst: has to be added directly in front of the predefined साचा name without intervening spaces.

Applying subst to a variable works like applying it to a साचा. E.g. a timestamp:

{{subst:CURRENTYEAR}}-{{subst:CURRENTMONTH}}-{{subst:CURRENTDAY}} T {{subst:CURRENTTIME}} [[w:UTC|]]
2005-03-10 T 08:23 UTC

In the case of substituting a predefined साचा with a parameter depending on another साचा, that has to be substituted too, with a separate subst: modifier, otherwise the result is undefined.

  • {{subst:UC:{{subst:tc}}}} gives IN, the same wikitext as {{UC:{{tc}}}} is expanded to; UC: is applied to the output "in" of Tc.
  • {{subst:ns:{{subst:#expr:2*3}}}} gives Image.
  • {{ns:{{subst:#expr:2*3}}}} gives wikitext {{ns:6}} rendered as चित्र.
  • {{subst:t1|{{subst:NAMESPACE}}}} gives the wikitext startHelpend (see {{t1}})
  • {{subst:t1|{{subst:#expr:3*4}}}} gives the wikitext start12end
  • {{subst:t1|{{subst:uc:AbCdEf}}}} gives the wikitext startABCDEFend
  • {{subst:#expr:{{subst:3X|11*}}1}} gives the wikitext 1331
  • {{subst:UC:{{subst:3X|abc}}}} gives the wikitext ABCABCABC
  • {{subst:LC:{{subst:#expr:1/100000}}}} gives the wikitext 1e-05 (see LC:)
  • {{subst:#expr:2*{{subst:CURRENTDAY}}}} gives (at the time of writing) the wikitext 30
  • {{subst:UC:{{subst:CURRENTDAYNAME}}}} gives (at the time of writing) the wikitext THURSDAY

However:

  1. {{subst:UC:{{tc}}}} gives the wikitext {{TC}} rendered as साचा:TC.
  2. {{subst:ns:{{#expr:2*3}}}} stays {{subst:ns:{{#expr:2*3}}}}, rendered as {{subst:ns:6}} (see ns:).

As mentioned before, on substitution, all calls without substitution of साचे, variables, आणि parser functions are treated as plain text. As a result substitution of the outer x: in a nested {{ x:...{{ y:...}} }} often is only suitable if all inner y: are also substituted.

In the case of substitution of a predefined साचा, if the expression for one of its parameters contains {{{p|3}}} with undefined p, this code reduces to 3. However, on the page itself, {{{p|3}}} is treated as such, not as 3.

उदाहरणे:

  • {{#expr:2*{{{p}}}}} gives अभिव्यक्ती त्रुटी: अनोळखी उद्गारवाचक चिन्ह "{"
  • {{#expr:2*{{{p|3}}}}} gives 6
  • {{subst:#expr:2*{{{p|3}}}}} gives Expression error: Unrecognised punctuation character "{"
  • substituting a साचा containing {{<includeonly>subst:</includeonly>#expr:2*{{{p|3}}}}} किंवा {{{{{subst}}}#expr:2*{{{p|3}}}}} gives 6 if p is not assigned a value, आणि twice the number p if it is assigned a value.

Compare:

  • {{uc:2*{{{p}}}}} gives 2*{{{P}}}
  • {{uc:2*{{{p|q}}}}} gives 2*Q
  • {{subst:uc:2*{{{p|q}}}}} gives the wikitext 2*{{{P|Q}}} rendered as 2*Q

आणि also (from above):

  • {{subst:UC:{{subst:tc}}}} gives IN, just like {{UC:{{tc}}}} does; UC is applied to the output "in" of Tc.
  • {{subst:UC:{{tc}}}} gives the wikitext {{TC}} rendered as साचा:TC.

In the substitution of UC, the inclusion tag {{tc}} is treated as string just like {{{p|q}}}.

अर्धवट substitution

[संपादन]

Inside an ordinary साचा one can apply substitution to an ordinary साचा call containing a parameter, to replace it by the direct wikitext containing the parameter. It amounts to automatically merging the two साचे (creating a "composite साचा" like a composite function). It is not possible if the inner आणि/किंवा outer साचा is predefined. (However, manually merging e.g. a call of #expr inside another one is useful for increasing the accuracy of the result by avoiding intermediate rounding to 12 digits.)

This way one can dispense with the optional substitution technique described below, आणि apply substitution of the resulting outer साचा by simply using "subst:" (unless there are more nesting levels).

उदाहरण:

  • {{subst:t}}}} gives the wikitext start-{{{1|pqr}}}-end, just that of m:Template:t (backlinks edit), without noinclude parts आणि includeonly tags
  • {{subst:t|a{{{p|q}}}b}} gives the wikitext start-a{{{p|q}}}b-end

उदाहरणे with double substitution:

  • {{subst:3X|{{subst:t}}}} gives the wikitext start-{{{1|pqr}}}-endstart-{{{1|pqr}}}-endstart-{{{1|pqr}}}-endstart-{{{1|q}}}-end
  • {{subst:3X|{{subst:t|{{{1|q}}}}}}} gives the wikitext start-{{{1|q}}}-endstart-{{{1|q}}}-endstart-{{{1|q}}}-end

Multiस्तर substitution

[संपादन]

When substituting a साचा it may be desirable to carry out a substitution inside the साचा too. This requires "subst:" in the साचा. There are two methods to prevent premature substitution (i.e., when the साचा is saved): the code "subst:" can be the possible value of an expression containing a parameter, किंवा includeonly tags can be used (see below).

With the first-mentioned method (the code "subst:" can be the possible value of an expression) we can:

  • apply multilevel transclusion by making the expression the empty string;
  • apply one-level substitution by substituting the outer साचा आणि making the expression the empty string;
  • apply two-level substitution by substituting the outer साचा आणि making the expression evaluate to "subst:";
  • apply multi-level substitution by substituting the outer साचा, making the expression evaluate to "subst:", आणि calling the inner साचा with parameters controlling further inner substitutions in the same way; these parameters may depend on the substitution parameter controlling the substitution of the inner साचा, since if that is not substituted, inner substitutions within that साचा are not possible.

Similarly, if there are multiple साचे, parser functions, आणि/किंवा variables in the inner साचा(s) we can control substitution of all, either independently by using different parameters, किंवा with some किंवा all using the same parameter.

The simplest code to control whether we get the empty string of "subst:" is using a parameter which is assigned either value, for उदाहरण with the name "subst", possibly with a postfix, for independent control of multiple substitutions. We can also specify a default, either the empty string किंवा "subst:".

For उदाहरण, if साचा T uses parameter subst1:

  • with the empty string as default, T calls inner साचे आणि parser functions prefixing their names with {{{subst1|}}}; for calling T we can use:
    • {{t|..}} (no substitution)
    • {{subst:t|subst1=subst:|..}} (multilevel substitution)
  • with default "subst:", T calls inner साचे आणि parser functions prefixing their names with {{{subst1|subst:}}}; for calling T we can use
    • {{t|subst1=|..}} (no substitution)
    • {{subst:t|..}} (multilevel substitution)

To transfer the choice of substituting किंवा not to साचे आणि parser functions called inside the inner साचे of T, we can add to the call of these inner साचे something of the form subst2={{{subst1|}}} किंवा subst2={{{subst1|subst:}}}, respectively (parser functions आणि variables don't get the additional parameter).

See also Help:Calculation#Substitution आणि m:Template:Example table with computations, with optional substitution (backlinks edit).

अर्धवट substitution

[संपादन]

Using a साचा prepared for optional subst=subst: only with ordinary substitution, without specifying parameter values, allows to insert its code into another साचा, like copy आणि paste, but all <noinclude> parts आणि <includeonly> keywords automatically stripped. Executing inserted code instead of calling it may be more efficient for the server.

A typical उदाहरण for this technique is expanding, within another साचा, a साचा used as test expression in a #switch: like m:Template:len (backlinks edit):

  1. Development code:
    {{#switch: {{len|parameter tag }}|0=case 0 etc.}}
  2. Standard solution:
    {{{{{subst|}}}#switch: {{{{{subst|}}}len|parameter tag |subst={{{subst|}}}}}|0=case 0 etc.}}
  3. Better solution: create साचा code by applying substitution using this wikitext:
    {{{{{subst|}}}#switch: {{subst:len|parameter tag }}|0=case 0 etc.}}

साचा:Len is prepared for optional substitution, therefore both solutions work, but the latter solution substituting its code is simpler आणि more efficient.

See {{csn}} आणि {{lz12}} for cases where {{len}} was substituted in this way.

If a साचा uses a parameter whose name is an expression containing a साचा किंवा parser function, आणि the साचा is called with a corresponding parameter definition (in terms of the final name of the parameter) it expands properly only if at the time of expansion of the साचा the expression for the name of the parameter is किंवा has been evaluated. Thus if the साचा is substituted without substituting the expression for the parameter name, the parameter definition is "lost", so the parameter becomes undefined. Therefore in such a case no substitution can give the same rendered result as full substitution, while partial substitution gives a different result. See e.g. m:Template:ts1 (backlinks edit).

Composite operations

[संपादन]

By {{A|{{B|p}}}} a साचा A is called with, as parameter, a call of साचा B with a parameter p. We could integrate such साचा calls to a single call {{C|p}} of a "composite साचा" C with parameter p.

The wikitext for साचा C would be {{A|{{B|{{{1}}}}}}}, किंवा with optional substitution the following construct:
{{ {{{subst|}}} A|{{ {{{subst|}}} B|{{{1}}} |subst={{{subst|}}} }} |subst={{{subst|}}} }}
The subst={{{subst|}}} is only necessary for recursive substitution as explained above.

Note that it is not useful to specify "{{subst|subst:}}" since in the substitution phase this tag does not reduce to the default "subst:".

If A आणि/किंवा B is predefined the construct is similar, but without subst={{{subst|}}} for that साचा.

Includeonly

[संपादन]

A less versatile method for multilevel substitution is with a pair of includeonly tags: they can be used to prevent substitution on the page itself, while not having any effect when transcluding the page. Substitution is prevented by having the साचा call inside these tags. Substitution is also prevented by having one किंवा both tags anywhere in the साचा call except inside a parameter definition. Thus the tag(s) can be before, inside, किंवा after "subst:", किंवा inside किंवा after the साचा name. The positions of the two tags only influence the rendering of the साचा page itself. If the closing tag is put immediately after the opening tag the full wikitext is rendered, e.g.

{{<includeonly></includeonly>subst:tc}} is shown as {{subst:tc}}

The most common form of this technique, known as "includeonly subst magic", is {{<includeonly>subst:</includeonly>something}}. This suggests that substitution is prevented by discarding "subst:" on the page itself, but actually substitution is prevented because the subst-syntax is disturbed by the tags.

It doesn't substitute "something" at the time of the creation of the relevant साचा, but has the desired effect when the साचा is substituted. Please note that this works as expected only for substitution, not for normal (unsubstituted) inclusion. For उदाहरणे see "preload" in Help:Inputbox आणि "substitution" in Help:Variable.

Creating a page which applies substitution on the next save

[संपादन]

See Help:Recursive conversion of wikitext.

Forced substitution

[संपादन]

Some साचे deliberately refuse to work without substitution. This technique is essential for साचे like en:Template:prod (backlinks edit) producing some kind of timestamp, e.g. adding pages to dated categories.

The following code in any साचा T outputs a warning unless recursive substitution with subst=subst: is in effect
{{{{{subst|}}}ifdef|{{{{{subst|subst:}}}ns:0}}|'''Warning'''}}.
  1. Output for {{T}} किंवा {{subst:T}}: Warning,
  2. output for {{T|subst=subst:}}: साचा:Ifdef,
  3. output for {{subst:T|subst=subst:}}: nothing (no remaining wikitext).
This is a rare case where replacing ifdef by #if: doesn't work directly.

Substitution of part of the parameters

[संपादन]

Let साचा A use parameters 1 आणि 2. Consider creating a साचा B with one parameter 1, corresponding to A, with a given value q of parameter 2. Compare {{A|2=q}} आणि {{A|1={{{1}}}|2=q}}. They look the same on the साचा page, see e.g. m:Template:t ps (backlinks edit), but the first does not work because {{{1}}} is treated as text, not as parameter.

However, with substitution (using "subst:" किंवा विशेष:साचेविस्तारकरा) the resulting wikitext is the same, without distinction between a text {{{1}}} आणि a parameter, it is a parameter anyway, so "1={{{1}}}" is not needed.

If A contains e.g. #expr with an expression containing both parameters the same applies, except that we can only substitute the highest level (A), not the parser function, so we cannot use विशेष:साचेविस्तारकरा.

In general, substituting a parameter आणि applying a साचा किंवा parser function sometimes gives the same result as substituting the साचा किंवा parser function with the triple-braced parameter code आणि then substituting the parameter.

Without defaults (all rendered the same in one-step substitution as without substitution):

उदाहरणे with equality:

  • A साचा containing p{{{1}}}q{{{2}}}r substituted with 1=u, 2=v gives puqvr; substituted with 2=v it gives p{{{1}}}qvr, which itself, substituted with 1=u gives also puqvr.
  • Two-level substitution of a साचा containing {{#if:{{{4}}}|{{{3}}}p}} with 3=u, 4=v gives up; substituted with 4=v it gives {{{3}}}p, which itself, substituted with 3=u gives up.

उदाहरणे without equality:

  • Two-level substitution of a साचा containing {{#if:{{{3}}}|{{{4}}}p}} with 3=, 4=v gives the empty string; substituted with 4=v it gives vp, which itself, substituted with 3=u remains vp.
  • Two-level substitution of a साचा containing {{#if:{{{2}}}|{{{1}}}p}} with 1=u, 2=v gives up; substituted with 2=v it gives {{{1}}}pp (the bug), which itself, substituted with 3=u, gives upp.
  • Two-level substitution of a साचा containing {{#expr:{{{1}}}*{{{2}}}}} with 1=7, 2=8 gives 56; substituted with 2=8 it gives <strong class="error">Expression error: Unrecognised punctuation character "{"</strong>, which itself, substituted with 1=7, remains the same.

Thus without equality we may किंवा may not get an error message.

One उदाहरण shows that substitution of one parameter can be affected by the bug mentioned above. However, we can then replace e.g. {{{1}}} by {{{1{{{{{substvoid|}}}void}}}}} आणि do full substitution, except that substvoid is undefined, preventing the bug. The result works already correctly with transclusion. Subsequently it can be substituted with substvoid=subst: so that we get the plain {{{1}}}.

With defaults:

Rendered the same as without substitution:

  • Two-level substitution of a साचा containing p{{{1|d}}}q{{{2}}}r with 2=v gives p{{{1|d}}}qvr.
  • Two-level substitution of a साचा containing {{#if:{{{4}}}|{{{3|d}}}p}} with 4=v gives {{{3|d}}}p.

Not rendered the same as without substitution:

  • Two-level substitution of a साचा containing {{#if:{{{3|}}}|{{{4}}}p}} with 4=v gives vp.
  • Two-level substitution of a साचा containing {{#if:{{{2}}}|{{{1|d}}}p}} with 2=v gives {{{1|d}}}pp (the bug).
  • Two-level substitution of a साचा containing {{#expr:{{{1|6}}}*{{{2}}}}} with 2=8 gives <strong class="error">Expression error: Unrecognised punctuation character "{"</strong>.

After substitution with the parameter definition:

  • {{subst:#if:{{{3|}}}|vp}} gives vp.
  • {{subst:#if:v|{{{1|d}}}p}} gives {{{1|d}}}pp (the bug).
  • {{subst:#expr:{{{1|6}}}*8}} gives <strong class="error">Expression error: Unrecognised punctuation character "{"</strong>.

Rewritten:

  • {{subst:#if:{{subst:#ifeq:{{{3|+}}}|{{{3|-}}}|vp}}}} gives the empty string.
  • {{subst:#if:v|{{subst:#ifeq:{{{1|+}}}|{{{1|-}}}|{{{1}}}|d}}p}} gives dp.
  • {{subst:#expr:{{subst:#ifeq:{{{1|+}}}|{{{1|-}}}|{{{1}}}|6}}*8}} gives 48.

Documenting substitution

[संपादन]

Usage of a साचा through subst: does not automatically show up in page histories. Therefore providing the line of wikitext containing "subst:" in the edit summary is especially useful.

Also pages with a substituted साचा do not show up in backlinks, आणि the साचा does not appear in the list of transcluded साचे on the edit page. The साचा could add pages to a category to track substitutions, but listing this category on a page may clutter the list of content-based categories the page is in. Also, comments outside noinclude tags are included in the wikitext. Thus a comment can be used to mention the साचा. It can even contain the values of the parameters, because substitution of parameters works even in comments.

हे सुद्धा पहा

[संपादन]