Jump to content

Help:साँचें

From mediawiki.org
This page is a translated version of the page Help:Templates and the translation is 70% complete.
Outdated translations are marked like this.
PD ध्यान दें: जब आप इस पृष्ठ को सम्पादित करते हैं, आप अपने योगदान को CC0 के अंतर्गत प्रकाशित करते हैं। अधिक जानकारी के लिए सार्वजनिक डोमेन के सहायता पृष्ठ की मदद लें। PD

अगर आपके पास कोई मानक टेक्स्ट है जो आप कई पृष्ठों पर जोड़ना चाहते हैं, मीडियाविकि द्वारा साँचे की सुविधा काम आती है। एक्सटेंशन्स और मीडिया फ़ाइलों के विपरीत, साँचों के लिए कोई केंद्रीय रिपॉज़िटरी नहीं है। नए साँचें लिखे जा सकते हैं, या फिर किए गए कार्यों की प्रतिलिपि बनाकर, या विकिपीडिया जैसे दूसरे विकियों से आयात करके सहेजे जा सकते हैं। Templates can be newly written or, to save duplicating work already done, exported from another wiki e.g. Wikipedia, and then imported into the target wiki.

Basic usage

साँचें मानक विकि पृष्ठ होते हैं जिनके सामग्री को दूसरे पृष्ठों पर ट्रांसक्लूड (एम्बेड) करने के लिए लिखा जाता है। साँचें एक मान का पालन करते हैं जिसके अनुसार उनपर "Template:" उपसर्ग लगाया जाता है और इससे उन्हें उस नामस्थान में जोड़ दिया जाता है; इसके अलावा, आप साधारण विकि पृष्ठों की तरह ही साँचें बना सकते हैं

To transclude a template, you used double open & close curly brackets {{template name}}.

साँचे का सबसे सरल प्रयोग कुछ इस प्रकार है। अगर आप "Template:Welcome" नामक एक पृष्ठ बनाते हैं जिसकी सामग्री है:

नमस्ते! आपका विकि पर स्वागत है।

आपने अपना पहला साँचा बना लिया है! अगर आप यह कोड कहीं डालते हैं:

{{Welcome}}

जब वह पृष्ठ खोला जाता है, {{Welcome}} की जगह टेक्स्ट "नमस्ते! आपका विकि पर स्वागत है।" दिखेगा। साँचे को दूसरे पृष्ठ पर "ट्रांसक्लूड" कर दिया गया है, यानी उसे उस पृष्ठ पर एकीकृत कर दिया गया है।

उसके बाद आप पृष्ठ पर किसी भी जगह पर {{Welcome}} जोड़कर सदस्य का स्वागत कर सकते हैं। मान लीजिए 100 पृष्ठों पर इसका इस्तेमाल किया जाता है। अगर आप साँचे की सामग्री को इससे बदल दें:

नमस्कार! इस निराले विकि पर आपका स्वागत है।

और उन 100 में से किसी भी पृष्ठ पर जाएँ जहाँ साँचे का प्रयोग किया गया है, आप मूल टेक्स्ट की जगह नया टेक्स्ट देखेंगे। इस तरह से आपने 100 पृष्ठों को संपादित किए बिना उनकी सामग्री को बदल दिया है, क्योंकि साँचे को उन पृष्ठों पर ट्रांसक्लूड किया जा रहा है।

यह बुनियादी क्रियाविधि है। ट्रांसक्लूशन की प्रक्रिया में कई चरण हैं जो इस क्रियाविधि और साथ में साँचों को काफ़ी उपयोगी बनाते हैं।

Ways to invoke a template

साँचों को इन तरीकों से दूसरे पृष्ठों पर जोड़ा जा सकता है:

  • {{नाम}} — जैसा ऊपर दर्शाया गया है, इस टेक्स्ट (जिसे आम तौर पर एक "साँचे का कॉल" कहा जाता है) को हर बार साँचे का इस्तेमाल कर रहे पृष्ठ को लोड करने (यानी विकि पर किसी सदस्य द्वारा देखे जाने) पर डायनामिक रूप से Template:नाम नामक पृष्ठ की सामग्री से बदल दिया जाएगा (एक प्रक्रिया जिसे "ट्रांसक्लूशन" कहा जाता है)। क्योंकि साँचे का कॉल पृष्ठ के स्रोत में रह जाता है, Template:नाम पर किसी भी बदलाव को साँचे के कॉल वाले हर पृष्ठ पर देखना संभव होगा। साथ ही, इस पृष्ठ को उन पृष्ठों के साथ सूचीबद्ध कर दिया जाएगा जो साँचे से "जुड़ते" हैं।
  • {{subst:नाम}} — जब इस साँचे की कड़ी को जोड़ा जाता है, इसे Template:Name के तब के एक स्टैटिक प्रतिलिपि से बदल दिया जाएगा जब साँचे के कॉल वाले पृष्ठ को सहेजा गया था। यानी, साँचे के कॉल को Template:Name की सामग्री से सब्सटिट्यूट कर दिया जाएगा। साँचे और पृष्ठ के बीच कोई कड़ी नहीं रखी जाती, तो एक को सम्पादित करने पर दूसरा प्रभावित नहीं होगा। देखा जाए तो इस तरह से सामग्री को सब्सटिट्यूट करने और इसे पृष्ठ को स्रोत में सदस्य द्वारा लिखने में बहुत कम अंतर है। See Help:Substitution for more information.
  • {{safesubst:नाम}} - इसे उन मामलों में प्रत्यावर्ती सब्सटिट्यूशन के लिए बनाया गया था जहाँ साँचों में दूसरे साँचों या पार्सर फ़ंक्शन्स के कॉल्स हों। अधिक जानकारी के लिए Help:Substitution देखें।
  • {{msgnw:नाम}} — यह साँचे की सामग्री को रॉ विकि सिनटैक्स के रूप में दिखाता है (जैसे ‎<nowiki> दिखाता है) जब इसे जोड़ने वाला पृष्ठ देखा जाता है। For example, {{msgnw:Template:Thankyou}} displays:

<noinclude> <languages/> </noinclude> '''आपका शुक्रिया...''' {{{reason|{{{1}}}}}} के लिए। सधन्यवाद, {{{signature|{{{2}}}}}} <noinclude> [[Category:Template examples{{#translation:}}|{{PAGENAME}}]] </noinclude>.

यहाँ तक कि, एक साधारण विकि पृष्ठ का भी साँचे की तरह इस्तेमाल किया जा सकता है। ऐसा करने के लिए बस इसका नामस्थान जोड़ दें, यानी:

  • {{Template:पृष्ठ}} Template:Pagename नामक पृष्ठ को ट्रांसक्लूड करता है ({{पृष्ठ}} के समान)
  • {{Talk:पृष्ठ}}, [[Talk:पृष्ठ]] नामक पृष्ठ को ट्रांसक्लूड करता है
  • {{:पृष्ठ}}, "पृष्ठ" नामक पृष्ठ को ट्रांसक्लूड करता है (यानी मुख्य नामस्थान में)
    • {{subst::पृष्ठ}}, "पृष्ठ" नामक पृष्ठ की सामग्री को सब्सटिट्यूट कर देता है

अगर निर्दिष्ट नामस्थान मौजूद नहीं होता है, पूरे नाम को एक साँचा मान लिया जाता है:

  • {{Foo:Bar}}, [[Template:Foo:Bar]] Template:Foo:Bar को ट्रांसक्लूड करता है

Regardless of what syntax is used, the name of the template can be relative to the current page For example, if {{/bar}} is called on page foo, it will transclude the page foo/bar.

It can also be generated dynamically. For example, {{ {{foo}} }} calls Template:foo and interprets the result as the name of another template to call.

पैरामीटर्स

ट्रांसक्लूशन की कार्यक्षमता को बढ़ाने के लिए मीडियाविकि पर साँचों को ट्रांसक्लूड करते समय पैरामीटर्स जोड़ने की सुविधा उपलब्ध है। पैरामीटर्स की मदद से साँचों पर अलग-अलग सामग्री या फिर बदलता स्वभाव जोड़ा जा सकता है।

मान लीजिए आप दूसरे सदस्यों के वार्ता पृष्ठों पर धन्यवाद वाला एक संदेश छोड़ना चाहते हैं, जैसे:


आपका शुक्रिया... अपने सभी कार्यों के लिए। सधन्यवाद, मैं


धन्यवाद के इस संदेश पर एक कारण होगा (इस मामले में "अपने सभी कार्यों") और एक हस्ताक्षर होगा ("मैं")। आपका लक्ष्य है कि किसी भी सदस्य के लिए किसी भी सदस्य को, किसी भी कारण से धन्यवाद देना संभव होना चाहिए।

ताकि संदेश हर जगह समान दिखे, आप साँचा:Thankyou नामक एक साँचा बना सकते हैं। हालाँकि संदेश हर जगह समान दिखना चाहिए, इसकी सामग्री (जैसे कारण और हस्ताक्षर) अलग होगी। इसके लिए आपको इन्हें पैरामीटर्स के तौर पर पास करवाना होगा। अगर हम बॉक्स को प्रारूपित करने और चित्र को जोड़ने वाले तत्वों को निकाल दें, बुनियादी साँचा कुछ ऐसा दिखेगा:

'''आपका शुक्रिया...'''
{{{1}}} के लिए।
सधन्यवाद, {{{2}}}

{{{1}}} और {{{2}}} के प्रयोग पर गौर करें। इससे साँचे का इस्तेमाल करते समय इसके अंदर पैरामीटर्स को पहचाना जा सकता है। ध्यान रखें कि साँच के अंदर हर पैरामीटर को तीन धनुकोष्ठकों से घेरा जाता है: {{{ }}}। हर साँचे के साधारण प्रयोग से अलग है।

किसी पृष्ठ पर साँचे का इस्तेमाल करते समय आप पैरामीटर्स में एक "पाइप" अक्षर (|) से अलग करते हुए वैल्यू जोड़ेंगे। मीडियाविकि पर पैरामीटर्स तीन तरीकों से पास करवाए जा सकते हैं: गुमनाम, क्रमित, और नामित।

गुमनाम पैरामीटर्स

गुमनाम पैरामीटर्स में पास करवाने के लिए, उन पैरामीटर्स के वैल्यू क्रमशः पास करवाएँ:

{{Thankyou|अपने सभी कार्यों|मैं}}

इस मामले में {{Thankyou}} साँचा पैरामीटर्स {{{1}}}=अपने सभी कार्यों और {{{2}}}=मैं प्राप्त करता है, और अंजाम होता है:


आपका शुक्रिया... अपने सभी कार्यों के लिए। सधन्यवाद, मैं


जिस क्रम से गुमनाम पैरामीटर्स पास करवाए जाते हैं, वह साँचे के स्वभाव पर बड़ा प्रभाव डालता है। पैरामीटर्स के क्रम को पलट देने पर, यानी:

{{Thankyou|मैं|अपने सभी कार्यों}}

का अंजाम होगा:


आपका शुक्रिया... मैं के लिए। सधन्यवाद, अपने सभी कार्यों


क्रम से पैरामीटर्स पहचानने की सुविधा ({{{1}}}, आदि से) सिर्फ और सिर्फ गुमनाम साँचों के साथ ही काम करती है। नाम से पहचाने जाने वाले किसी भी पैरामीटर, जैसा नीचे दर्शाया गया है, का इस्तेमाल क्रमित संख्याओं की मदद से नहीं किया जा सकता।
अगर साँचे के किसी गुमनाम पैरामीटर पर बराबर चिह्न (=) नज़र आता है, साँचे के उस पैरामीटर को एक नामित पैरामीटर माना जाएगा (जिसे इस दस्तावेज़ के नीचे की तरफ वर्णित किया गया है) जिसमें बराबर चिह्न के पहले का हिस्सा पैरामीटर का नाम होगा और उसके बाद का टेक्स्ट पैरामीटर के तर्क का वैल्यू। यह एक समस्या बन जाती है जब आपको कोई बाहरी कड़ी जोड़नी हो, या फिर एट्रीब्यूट वाला कोई HTML तत्व (टास्क T16235 देखें)। इसका समाधान है नामित पैरामीटर्स का इस्तेमाल करना, या फिर क्रमित पैरामीटर्स का इस्तेमाल करना, जैसा नीचे के अनुभाग में दर्शाया गया है।

क्रमित पैरामीटर्स

संख्या के आधार पर पैरामीटर्स पास करवाने के लिए पास करवाते समय हर पैरामीटर को पहचानें:

{{Thankyou|2=मैं|1=आपकी दोस्ती}}

इस बार साँचा {{Thankyou}} पैरामीटर्स {{{1}}}=आपकी दोस्ती और {{{2}}}=मैं प्राप्त करता है, हालाँकि इन्हें उलटा पास करवाया गया है, और इसका अंजाम होता है:


आपका शुक्रिया... आपकी दोस्ती के लिए। सधन्यवाद, मैं


यह तब भी उपयोगी हो सकता है जब किसी भी क्रमित पैरामीटर में "=" चिह्न हो।
उदाहरण
{{Thankyou|1="=" जोड़ने|2=मैं}}

का अंजाम होगा:


आपका शुक्रिया... "=" जोड़ने के लिए। सधन्यवाद, मैं

चेतावनी चेतावनी: इसे हर पैरामीटर को क्रमांकित करने की ज़रूरत होती है।

नामित पैरामीटर्स

पैरामीटर्स पास करवाने का तीसरा तरीका है संख्याओं की जगह नामों का इस्तेमाल करके। इस मामले में साँचे की सामग्री को इसमें बदल दिया जाएगा:

'''आपका शुक्रिया...'''
{{{reason}}} के लिए।
सधन्यवाद, {{{signature}}}

साँचे के अंदर हम हर पैरामीटर को पहचानने के लिए संख्याओं की जगह {{{reason}}} और {{{signature}}} का इस्तेमाल करेंगे। नामों के साथ ये पैरामीटर्स पास करवाने के लिए, पास करते समय हर पैरामीटर को पहचानें:

{{Thankyou|signature=मैं|reason=अपना व्यक्तित्व बरकरार रखने}}

इस मामले में साँचा {{Thankyou}} पैरामीटर्स {{{reason}}}=अपना व्यक्तित्व बरकरार रखने and {{{signature}}}=मैं प्राप्त करता है, और इसका अंजाम होता है:


आपका शुक्रिया... अपना व्यक्तित्व बरकरार रखने के लिए। सधन्यवाद, मैं


नामित पैरामीटर्स केस-संवेदनशील है, तो:

{{Thankyou|signature=मैं|Reason=अपना व्यक्तित्व बरकरार रखने|reason=केस-संवेदनशील होने}}

का अंजाम होगा:


आपका शुक्रिया... केस-संवेदनशील होने के लिए। सधन्यवाद, मैं


पैरामीटर्स के क्रम से असंवेदनशील होने के साथ-साथ, अपने साँचे में नामित पैरामीटर्स का इस्तेमाल करने का एक फ़ायदा यह है कि कई पैरामीटर्स होने पर साँचे के कोड को समझना काफ़ी आसान हो जाता है।

Spaces and newlines are automatically stripped from the start and end of named parameter names and values, but are preserved in unnamed parameters.

Mixing named and unnamed parameters

If the template supports it, both kinds of parameters can be used in one call.

For example, {{Thankyou|supporting both parameter types|signature=Me}} results in:


आपका शुक्रिया... supporting both parameter types के लिए। सधन्यवाद, Me


Be careful when doing this, because it can result in conterintuitive results as unnamed parameter counts are based only on the unnamed parameters, not the named parameters. For example, {{Thankyou|Me|reason=supporting both parameter types}} results in:


आपका शुक्रिया... supporting both parameter types के लिए। सधन्यवाद, {{{2}}}


The template is coded to prefer the named parameter for the reason over the unnamed parameter, resulting in the "Me" being lost and no signature being given. This results in a default value of {{{2}}} being shown, as explained below.

डिफ़ॉल्ट वैल्यू

अगर आप कोई ऐसा साँचा ट्रांसक्लूड करते हैं जिसे पैरामीटर्स की अपेेक्षी होती है, मगर आप उन्हें तर्क प्रदान नहीं करते, कुछ इस तरह:

{{Thankyou}}

उपरोक्त क्रमित पैरामीटर्स में आपको कुछ ऐसा अंजाम मिलेगा:


आपका शुक्रिया... {{{1}}} के लिए। सधन्यवाद, {{{2}}}


क्योंकि कोई तर्क पास नहीं करवाया गया था, साँचा पैरामीटर्स के वैल्यू के बजाय पैरामीटर्स को ही प्रस्तुत करता है। इन मामलों में पैरामीटर्स के लिए डिफ़ॉल्ट वैल्यू चुनने की सुविधा काम आ सकती है, यानी वैल्यू जो तब पास करवाए जाएँगे जब कोई वैल्यू सदस्य द्वारा पास न करवाया गया हो। उदाहरणस्वरूप, अगर साँचे की सामग्री को इसमें बदल दिया जाए:

'''आपका शुक्रिया...'''
{{{reason|हर चीज़}}} के लिए।
सधन्यवाद, {{{signature|मैं}}}

तब {{{reason|हर चीज़}}} परिभाषित करता है कि अगर पैरामीटर {{{reason}}} के लिए कोई तर्क प्रदान नहीं किया जाता है, वैल्यू हर चीज़ का इस्तेमाल किया जाएगा। उसी तरह, {{{signature|मैं}}} पैरामीटर {{{signature}}} का डिफ़ॉल्ट मैं पर सेट कर देता है। अब बिना कोई तर्क पास करवाए, साँचे को दोबारा ट्रांसक्लूड करने पर अंजाम होगा:


आपका शुक्रिया... हर चीज़ के लिए। सधन्यवाद, मैं


पैरामीटर का वैल्यू खाली स्ट्रिंग हो सकता है। उदाहरणस्वरूप, {{foo|bar=}} या {{foo|bar=|baz=qux}} foo साँचा bar पैरामीटर को "" मानता है। यह पैरामीटर को छोड़ देने से अलग है, जिससे इसे अपरिभाषित छोड़ दिया जाता है जिससे उपरोक्त डिफ़ॉल्ट वैल्यू तंत्र की शुरुआत होती है।
If you need to treat an empty string the same way as a missing parameter, you can use a conditional operator through an extension like ParserFunctions. For instance, {{#if:{{{1|}}}|{{{1|}}}|undefined}} returns undefined if the parameter is either undefined or empty, while {{{1|undefined}}} does so only if the parameter is undefined.

अक्सर, डिफ़ॉल्ट वैल्यूओं की मदद से पैरामीटर्स के लिए वैकल्पिक नाम परिभाषित किए जाते हैं। उदाहरणस्वरूप, अगर आपने {{{a|{{{b|}}} }}} जोड़ा है, साँचा पहले "a" नामक पैरामीटर की तलाश करेगा। अगर यह सेट नहीं किया जाता है, यह "b" नामक पैरामीटर का इस्तेमाल करेगा। अगर "a" या "b" में से कोई भी पैरामीटर सेट नहीं किया जाता है, आउटपुट में कुछ भी नहीं दिखेगा।

Passing parameters to other templates

If raw parameter syntax is generated by the above template call, and then passed through to another template, it is not interpreted as a parameter. This means that {{Thankyou2 }}, which just calls {{साँचा:Thankyou }} with no parameters, does not work: {{thankyou2|everything|me}} -> आपका शुक्रिया... {{{1}}} के लिए। सधन्यवाद, {{{2}}} .

You instead need to explicitly pass the parameter to the other template, i.e if {{Thankyou3 }} contains

{{thankyou|{{{1}}}|{{{2}}}}}}

then {{thankyou3|everything|me}} -> आपका शुक्रिया... everything के लिए। सधन्यवाद, me } works properly.

This example does not preserve emptiness vs. undefinedness in parameter values - you would need more complicated syntax if you wanted to do that.


Empty vs undefined parameters

The {{t2demo|| a }} (refer to {{T2demo }} ), with a double pipe, sets the first parameter to an empty string instead of leaving it undefined. It produces the output start--middle- a -end, similar to how {{t2demo|1=|2= a }} results in start--middle- a -end. On the other hand, explicitly setting the parameter "2" to "a," results in the first unnamed parameter being left undefined:

{{t2demo|2= a }} results in start-{{{1}}}-middle- a -end

If the second parameter should not be trimmed, it must be unnamed.

Therefore, you can assign an empty string to the first parameter, but you cannot leave it undefined.

Making emptiness and undefinedness equivalent

Good template coding practices result in passing an empty string to a parameter working the same as not assigning any value. This makes things easier and more consistent.

For example, using p= can show that a template has a parameter "p" that doesn't have a value yet.

To make an empty string and an undefined value equivalent, use the following approaches:

  • Use {{{p|}}} exclusively instead of {{{p}}} or q where "q" is a non-empty value.
  • Use conditional checks like {{#if:{{{p|}}}|..{{{p}}}..|..}}, to ensure {{{p}}} is only used when it has a value.

If for some reason you want to treat undefined parameters differently from empty parameters or any other possible value you can compare the same parameter twice with different defaults, i.e {{#ifeq:{{{foo|bar}}|{{{Foo|baz}}}|parameter is undefined|parameter is defined}}.

Using equals signs in unnamed parameters

Unnamed parameters can include equals signs, but this must be done indirectly. Here are some methods using template:T1demo:

Default Value for Undefined Parameter

Assign a default value to an undefined parameter:

{{T1demo|{{{1| a=b }}}}}

This renders as: start a=b end.

Using the {{=}} parser function

Use a parser function that safely includes an equals sign:

{{T1demo| a{{=}}b }}

This renders as: start a=b end.

HTML Entities

Replace the equals sign with an HTML entity for display:

{{T1demo| a=b }}

This renders as: start a=b end.

This renders correctly without affecting the other parameters.

Handling unmatched curly and square brackets

Unmatched curly brackets ({{, }}) or square brackets ([[, ]]) must be inside nowiki tags or use HTML entities:

  • Rendering curly brackets have two options:
    • Use <nowiki>{{</nowiki> or &#123; for {
    • Use <nowiki>}}</nowiki> or &#125; for }.
  • Use &#91; for [ and &#93; for ].

Below are some examples:

Unmatched curly brackets
{{T1demo| <nowiki>{{</nowiki>content<nowiki>}}</nowiki> }}

This correctly renders the braces without breaking the template.

Unmatched square brackets
{{T1demo| text [link] more text }}

This correctly renders the braces without breaking the template.

This renders as: start text [link] more text end

Unmatched pairs not placed in nowiki tags either prevent template expansion or are taken as closing braces for the template call.

Below are some examples:

{{T1demo|abc]]def[[ghi}}

This will not expand correctly because of unmatched brackets.

The correct use:

{{T1demo|abc<nowiki>]]</nowiki>def<nowiki>[[</nowiki>ghi}}

This renders as: startabc]]def[[ghiend

Template-generated brackets

An alternate technique for passing arguments with unmatched brackets is to wrap them in another template. In that situation, (which exists with {{(( }} and {{)) }}) on this wiki), the unmatched brackets will be rendered literally, and not decoded as another template call. For example:

{{t1demo|{{((}}t1demo{{))}}}}

results in: start{{t1demo}}end

When substituting a template, template inclusions are parsed once when the subst happens (with the same caveats explained above) and then a second time when rendering the resulting wikitext. For example:

{{subst:((}}t1demo|foo}}

will expand on save to:

{{((}}t1demo|foo}}

which will then render as:

startfooend

If the wikitext generated via the first subst itself includes "subst:" syntax it will not be processed on the same save, but may be on the next save. This technique may be used to implement recursive substitutions that take multiple saves to evaluate.

Using pipes in parameter values

A parameter value cannot contain a pipe character (|), because it would be interpreted as the end of that parameter and the start of the next parameter. This can be worked around by using the parser function {{!}}, or the HTML entity &124;. The two methods of doing this have slightly different behavior, which can be relevant in some corner cases like when a template is producing wikitable syntax.

Example: {{T1demo|abc|def}} produces: startabcend

The "def" doesn't display because it is treated as part of another unnamed parameter, which the template does not use.

{{T1demo|abc{{!}}def}} produces: startabc|defend

The "def" displays properly.

{{T1demo|abc|def}} produces: startabc|defend

The "def" displays properly again.

Formatting template calls using extra parameters

Since templates ignore parameters they are passed but do not handle specifically, they can be used as a way of a adding extra whitespace or unused content to the template call.

For example:

{{template name|foo|bar|baz|mumble|quux}}

is equivalent to, assuming the template doesn't recognize SPACEN as a parameter name:

{{template name|SPACE1=
|foo|SPACE1=
|bar|SPACE2=Random stuff
|baz|SPACE3=
   |mumble|SPACE4=
  quux
}}

It is also possible to use the same name for each spacer (often the empty string), but this will populate Category:Pages using duplicate arguments in template calls, which many wikis prefer to keep empty to catch instances of user error.

This can be used to make the template render in a way similar to its output, like showing each row of w:Template:Chess position on its own like to make the wikitext also look like a chessboard.

Tracking parameter usage


It may be wise for a template to add a link or category to a page if a certain parameter or combination of parameters is used, to make if possible to easily determine what pages are using a given parameter, and thus what the impacts of changing that parameter in the template would be.

मूल्यांकन

यह एक उन्नत विषय है और अगर आपको इसकी ज़रूरत न हो तो आप इसे छोड़ सकते हैं।

आम तौर पर बात करें तो साँचे के पैरामीटरों को टोकन बनाने के बाद सब्सटिट्यूट किया जाता है, मगर बिलकुल वैसे ही जैसे वे लिखे गए हैं। इनके प्रयोग करने तक इन्हें मूल्यांकित नहीं किया जाता है।

इसके कुछ अंजाम हैं।

  1. पहली बात तो, अगर आपको पास {{mytemplate वाला एक Template:Start है, और |foo=bar}} वाला एक Template:End है, और आप पृष्ठ पर {{start}}{{end}} जोड़ते हैं, 'mytemplate' को ट्रांसक्लूड नहीं किया जाएगा क्योंकि "|" जैसे टोकन्स को साँचों द्वारा नहीं जोड़ा जा सकता, जिस वजह से साँचों पर वे अपनी जगहों में ही रहते हैं। आप किसी पैरामीटर या साँचे के नाम को नियंत्रित करने के लिए साँचों का इस्तेमाल कर सकते हैं, मगर आप एक साँचे के कॉल को कई साँचों में नहीं बाँट सकते।
  2. इसका दूसरा अंजाम है मृत-कोड का हटाया जाना। अगर आप {{foo|{{DISPLAYTITLE:Bar}} }} जैसा एक साँचा कॉल जोड़ते हैं, और Template:Foo में {{{1}}} नहीं होता है, displaytitle का इस्तेमाल नहीं किया जाएगा, क्योंकि इसका मूल्यांकन सिर्फ तभी किया जाता है जब ज़रूरत पड़ती है, और ऐसा कोई पैरामीटर नहीं है जिसमें इसे सब्सटिट्यूट किया जा सके, जिस वजह से इसका मूल्यांकन किया ही नहीं जाता है। यह तब काम आता है जब आप एक्सटेंशन:ParserFunctions का इस्तेमाल कर रहे हों, और इसका प्रभाव मुख्य रूप से int: जादूई शब्द के साथ देखा जा सकता है जो सदस्य की भाषा पर निर्भर है। This isn't perfect, and in some cases even if the result of expanding a template is not used (because it is part of an if statement condition, for example), the process of evaluating it can still have side effects. For example, any links produced or other templates used will still be added to Special:WhatLinksHere even if they are not displayed.


Template parameters are pass by value, which means a template cannot modify its arguments. Parameters are treated as associative array, and parameter names are evaluated before parameter values. If the same parameter name is given more than once (either as named or unnamed), only the last instace is used, and the page is added to Category:Pages using duplicate arguments in template calls.

जादूई शब्द subst: या safesubst: से शुरू होने वाले साँचों के कॉल्स को ~~~~, और पाइप तरकीब का इस्तेमाल करने वाली कड़ियों को, एक प्राथमिक मूल्यांकन से गुज़ारा जाता है जो सिर्फ सहेजते समय होता है। अगर इन्हें प्राथमिक मूल्यांकन से मूल्यांकित नहीं किया जा सकता, subst: कॉल्स को अनदेखा कर दिया जाता है और safesubst: को एक साधारण साँचा माना जाता है।

कई पार्सर फ़ंक्शन्स, पार्सर टैग्स और ट्रांसक्लूड किए गए विशेष पृष्ठ साँचों की तरह सीधे जोड़े नहीं जाते, मगर उन्हें एक "स्ट्रिप चिह्न" से बदल दिया जाता है। यानी कि आप padleft: जैसे पार्सर फ़ंक्शन्स की मदद से परिणामों को बदला नहीं जा सकता, क्योंकि वे पार्सर फंक्शन की जगह स्ट्रिप चिह्न पाते हैं।

साँचों में प्रत्यावर्तन

किसी साँचे को अपने ही पृष्ठ पर जोड़ लेने पर मीडियाविकि हमेशा के लिए प्रत्यावर्तन नहीं करता रहेगा। मीडियाविकि साँचे के नाम को बोल्ड में लिखकर प्रत्यावर्तन को रोक देगा। उदाहरणस्वरूप, अगर Template:Aaaa का सामग्री है a {{Aaaa}} z, यह दिखाएगी "a a Template loop detected: Template:Aaaa z z"।

यह सुरक्षा-तंत्र एक संभवतः उपयोगी साँचा बोली से बचने के लिए है, जहाँ साँचा अपने कॉलिंग तर्कों को अपने आप मानक बनाता है। इस वांछित उदाहरण में template:d को या तो {{d|20200311}} या फिर {{d|y=2020|m=3|d=11}} से कॉल किया जा सकता है। अगर पहले तरीके से कॉल किया जाता है, यह अपने आपको दूसरे तर्क की संरचना में रीकर्स कर लेता है (जो पार्सर फ़ंक्श्स से प्राप्त की जाती है), जिसके बाद यह एक एकीकृत प्रोसेसिंग पथ पर चलता है।

{{#if:{{{1|}}}|{{d|y={{#sub:{{{1}}}|0|4}}|m={{#sub:{{{1}}}|4|2}}|d={{#sub:{{{1}}}|6|2}}}}|<!-- processing path with arguments y,m,d regardless of original call pattern -->}}

template:d को बदलकर template:d/2 में रीकर्स करवा दिया जाता है और template:d/2 template:d की एक समान हस्तनिर्मित प्रतिलिपि है, यह बोली ठीक से काम करती है, क्योंकि स्वतः रीकर्शन सुरक्षा-तंत्र सांख्यिकी के अनुसार नहीं, बल्कि डायनामिक रूप से काम करती है।

मीडियाविकि के लिए इस स्वतः रीकर्शन नियम को ढीला बनाने का एक तरीका होगा यह आवश्यक बनाना कि हर रीकर्सिव कॉल पर सभी पिछले सक्रिय कॉल्स से तर्कों की संख्या अनूठी होगी, और अधिकतम एक ही बार गैर-घटाव तर्कों की संख्या से रीकर्सिव कॉल का रीकर्शन हो सकता है। इससे अनंत स्वतः रीकर्शन के खिलाफ़ एक निश्चित आश्वासन मिलती है और साथ में यहाँ पर वर्णित बोली को लचीला बनाते हुए उपयोग में लाया जा सकता है।

अगर प्रोसेसिंग के पथ में ज़्यादा जटिलता न हो, एक साधारण समाधान है सिर्फ एक साँचे का इस्तेमाल करना, और हर कॉल को अपनी एक if/else शाखा में हैंडल करना, जिससे हर मामले में प्रोसेसिंग पथ के लॉजिक की एक प्रतिलिपि बनाई जाएगी। अगर प्रोसेसिंग का पथ ज़्यादा जटिल होता है, हर कॉल-संरचना मामले में एक कार्यान्वयन साँचा जोड़ा जा सकता है, जिसमें साँचे को स्वभाव प्रदान करने वाली एक एकीकृत कॉल संरचना होगी।

पैरामीटर्स में टेबल्स

क्योंकि पाइप कैरेक्टर (|) और बराबर चिह्न (=) के साँचे के कॉल्स और विकिटेबल्स पर अलग-अलग अर्थ हैं, किसी साँचे के वैल्यू पर टेबल मार्कअप का इस्तेमाल करने के लिए आपको आम तौर पर विशेष अक्षरों की मदद से उन कैरेक्टर्स को "एस्केप" करना होगा (यानी उन्हें साँचे का मार्कअप मान लिए जाने से बचाना होगा):

  • बिल्ट-इन जादुई शब्द {{!}} मीडिया 1.24 से | का एक "एस्केप किया हुआ" संस्करण देता है
  • बिल्ट-इन जादुई शब्द {{=}} मीडियाविकि 1.39 से = का एक "एस्केप किया हुआ" संस्करण देता है

इन जादुई शब्दों के आने से पहले विकियाँ ये काम करने के लिए साँचों का इस्तेमाल किया करते थे। ऐसे किसी विकि पर जादुई शब्द को समान नाम के साँचों से ज़्यादा प्राथमिकता दी जाती है।

उदाहरण टेबल

A B C
A1 B1 C1
A2 B2 C1

टेबल का कोड:

{| class=wikitable
!A!!B!!C
|-
|A1||B1||C1
|-
|A2||B2||C1
|}

एस्केप करने पर टेबल का कोड:

{{{!}} class{{=}}wikitable
!A!!B!!C
{{!}}-
{{!}}A1{{!}}{{!}}B1{{!}}{{!}}C1
{{!}}-
{{!}}A2{{!}}{{!}}B2{{!}}{{!}}C2
{{!}}}

गौर करें कि पहले धनुकोष्ठक ({) को एक शाब्दिक धनुकोष्ठक माना गया है क्योंकि इसके तुरंत बाद ही जादुई शब्द {{!}} है। उसी तरह, आखिर के दाएँ धनुकोष्ठक (}) को एक शाब्दिक दायाँ धनुकोष्ठक माना गया है क्योंकि इसके तुरंत बाद वही जादुई शब्द है। मगर कुछ मामलों में इन धनुकोष्ठकों से समस्याएँ आ सकती हैं, तो कुछ विकियों पर उन कैरेक्टर्स को एस्केप करने के भी उपाय हैं:

  • साँचे का कॉल {{(}}, { का एक "एस्केप" किया हुआ संस्करण दे सकता है
  • साँचे का कॉल {{)}}, } का एक "एस्केप" किया हुआ संस्करण दे सकता है

कुछ विकियाँ और भी आगे जाकर {{(!}}, {{!)}}, {{!!}} और $2 जैसे दूसरी सुविधाएँ प्रदान करने के लिए साँचे प्रदान करते हैं। ऐसे किसी विकि पर कोड को इस तरह सरलीकृत किया जा सकता है:

{{(!}} class{{=}}wikitable
!A!!B!!C
{{!}}-
{{!}}A1{{!!}}B1{{!!}}C1
{{!}}-
{{!}}A2{{!!}}B2{{!!}}C2
{{!)}}

साँचों के जुड़ाव को नियंत्रित करें

डिफ़ॉल्ट से साँचे की सामग्री को पूरी तरह से ट्रांसक्लूड किया जाता है, चाहे आप उसे साँचे के पृष्ठ पर देखें या फिर किसी और पृष्ठ पर ट्रांसक्लूड करने के बाद। मगर आप $noinclude, $includeonly और $onlyinclude टैग्स की मदद से नियंत्रित कर सकते हैं किस हिस्से को दिखाया जाएगा और किस हिस्से को जोड़ा जाएगा।

The template's page when viewed directly appears exactly as the template would render without any parameters. If the template requires parameters to function properly, this will result in raw wikitext syntax or errors as a result of them being missing.

However, you can control which parts of a template will be seen and included by the use of the ‎<noinclude>, ‎<includeonly> and ‎<onlyinclude> tags.

‎<noinclude> और ‎</noinclude> के बीच कोई भी सामग्री सिर्फ साँचे के पृष्ठ को सीधे देखने पर ही दिखेगी, मगर किसी दूसरे पृष्ठ पर जोड़ने पर नहीं। यह तब काम आता है जब आपको साँचे पर कोई ऐसा टेक्स्ट जोड़ना हो जिसे आप साँचे को जोड़ने वाले किसी भी पृष्ठ पर जोड़ना नहीं चाहते, जैसे:

  • सिर्फ साँचे को श्रेणीबद्ध करने के लिए श्रेणी कड़ियाँ
  • दूसरी भाषाओं में मेल खाते साँचों के लिए अंतरभाषा कड़ियाँ
  • साँचे के प्रयोग के बारे में वर्णन का टेक्स्ट

उसी तरह, ‎<includeonly> और ‎</includeonly> के बीच कोई भी सामग्री सिर्फ तभी दिखाई जाएगी जब पृष्ठ को जोड़ा जा रहा हो, मगर तब नहीं जब साँचे को सीधे देखा जा रहा हो। यह कुछ मामलों में काम आता है:

  • साँचे को जोड़ने वाले पृष्ठों को श्रेणीबद्ध करना। ध्यान रखें: इस तरीके से साँचे द्वारा जोड़े जाने वाली श्रेणी को बदलने पर इस साँचे को जोड़ने वाले पृष्ठों की श्रेणियों में कुछ समय तक कोई बदलाव न आ सकता है: इसका फैसला कार्य कतार द्वारा किया जाता है। किसी पृष्ठ को ज़बरदस्ती नई श्रेणी में जोड़ने के लिए पृष्ठ को सम्पादन के लिए खोलें और बिना कोई बदलाव किए सहेजें।
  • सुनिश्चित करना कि साँचे को पृष्ठ को देखते समय साँचे का कोड चलाया नहीं जाता है। आम तौर पर ऐसा तब किया जाता है जब साँचे में पैरामीटर्स हों, और बिना पैरामीटर्स के साँचे का इस्तेमाल करने पर, अनपेक्षित परिणाम मिलता हो।

‎<noinclude> और ‎<includeonly> से बाहर सारी सामग्री को साधारण रूप से प्रोसेस किया जाता है और दिखाया जाता है; यानी, जब साँचे को सीधे देखा जाए और जब इसे किसी दूसरे पृष्ठ पर जोड़ा जाए। विषय यह है कि इन दोनों टैग्स के बीच में क्या है।

‎<onlyinclude> टैग्स के बाहर किसी भी चीज़ को ट्रांसक्लूशन के समय नकार दिया जाता है। अगर includeonly में लपेटे अनुभागों को onlyinclude में न लपेटा जाए, तो इन्हें भी ट्रांसक्लूशन में नकार दिया जाता है। विषय यह है कि इस टैग के बाहर क्या है।

For example, if a page like Help:Templates/onlyinclude demo has the wikitext:

abc<onlyinclude>def</onlyinclude>ghi<includeonly>jkl</includeonly>

The result of transcluding it is def.

इन टैग्स को नेस्ट भी किया जा सकता है।

इन तीन ट्रांसक्लूशन टैग्स की मदद से आप इस बात पर पूरा नियंत्रण पा सकते हैं कि किसे प्रोसेस और रेंडर किया जाता है। टिप्पणियों की भी एक भूमिका है। Inclusion tags are respected when using {{subst:templatename}}, but they are not respected when using {{msgnw:templatename}} as that displays the raw wikitext without any processing.

Section transclusion

To transclude different sections of a template on different pages, you can wrap the content in onlyinclude tags and use an if statement on parameters to select which section.

Consider "Template:Example" with this wikitext:

== Section 1 ==
{{#ifeq:{{{1|1}}}|1|
Content of section one.
}}
{{#ifeq:{{{1|1}}}|1|
== Section 2 ==
Content of section two.
}}

This will render both sections on the example page itself, and allow other pages to transclude the first section with {{example|1}} and the second section with {{example|2}}.

Another approach is to use literal parameter syntax instead:

{{{section1|
== Section 1 ==
Content of section one.
}}}
{{{section2|
== Section 2 ==
Content of section two.
}}}

Transclude the first section with {{example|section2=}} and the second section with {{example|section1=}}. If neither parameter is used, then both sections will display.

A third approach is to use Labeled Section Transclusion.

साँचों को संगठित करना

साँचों के काम करने के लिए सदस्यों को साँचें ढूँढ़ने होंगे और उनका इस्तेमाल करना सीखना होगा।

उन्हें ढूँढ़ने के लिए सदस्य:

  1. विशेष पृष्ठ > सभी पृष्ठ पर क्लिक कर सकते हैं
  2. नामस्थान: सूची में Template चुनकर जाएँ पर क्लिक कर सकते हैं।

प्रयोग की जानकारी देने के लिए साँचे के पृष्ठ पर इस तरह का एक उदाहरण जोड़ें:

<noinclude>
== प्रयोग ==
सदस्यों का स्वागत करें:
{{Thankyou|reason=आपका कारण|signature=आपका हस्ताक्षर}}
</noinclude>

फिर, सम्पादक साँचे का इस्तेमाल करने के लिए उदाहरण की प्रतिलिपि बनाकर चिपका सकता है।

किसी पृष्ठ को सम्पादित करते समय सभी प्रयुक्त साँचों की सूची सम्पादन फ़ॉर्म के नीचे "Template used on this page:" नामक (प्रसंग के आधार पर इसका नाम "Template used in this preview:" या "Template used in this section:" भी हो सकता है) एक छोटा करने योग्य अनुभाग में प्रदान की जाती है। इस सूची में साँचे के पृष्ठ की एक सुविधाजनक कड़ी और इसके सुरक्षा स्थिति के बारे में जानकारी प्रदान की जाती है। अनुप्रेषित साँचों को इटैलिक्स में दिखाया जाता है, और अनुप्रेषण के लक्ष्य को सूची में एक अलग आयटम के रूप में जोड़ा जाता है। This list provides a convenient link to the template's page, as well as information about its protection status. Redirected templates are shown in italics, with the redirect target added as a separate list item.

साँचे की कड़ी जोड़ना

हर विकि पृष्ठ की तरह साँचों की भी कड़ियाँ जोड़ी जा सकती हैं। उदाहरणस्वरूप, विकिकोड [[Template:Navbar]] की मदद से Template:Navbar कड़ी बनाई जा सकती है।

कई विकियों पर Template:Tl को इस तरह से प्रारूपित करके कड़ी के साथ ट्रांसक्लूड किए बिना दिखाया जा सकता है कि उसके दोनों तरफ़ ट्रांसक्लूड करने के लिए आवश्यक "दो धनुकोष्ठक" हों। उदाहरणस्वरूप, कोड {{tl|Navbar}} से {{साँचा:Navbar }} कड़ी बनाई जा सकती है।

इस रचना का इस्तेमाल आम तौर पर प्रलेख पृष्ठों, सहायता पृष्ठों और वार्ता पृष्ठों पर साँचों को सन्दर्भित करने के लिए किया जाता है। इस तरह का प्रारूपण {{[[Template:Navbar|Navbar]]}} की मदद से भी प्राप्त किया जा सकता है, मगर {{Tl }} के इस्तेमाल से लिखने की ज़रूरत कम होती है। मगर हर विकि पर अगर Tl साँचा, अगर वह वहाँ मौजूद हो, यह सुनिश्चित नहीं करता है कि टेक्स्ट को एक "कोड" तत्व या फिर मोनोस्पेस फ़ॉण्ट में ही रेंडर किया जाएगा। अगर ऐसा नहीं होता (जैसा कि इस विकि पर), शायद कोई दूसरा समान साँचा ऐसा कर दे। उदाहरणस्वरूप, हमारे Template:Tl के प्रलेख का "See also" अनुभाग देखें।

Template naming

The name of a template is case-sensitive excluding the first character.

You make redirects for alternate capitalizations. For example, if a template is named "AdminAbbr", you can create a redirect named "Adminabbr". This way, the template can be called with either {{AdminAbbr}} or {{adminabbr}}. If an editor prefers a mix of upper and lower case for clarity, they can use functions like lc or uc. For instance, instead of {{CURRENTINTERNETTIME}}, they could use {{ {{uc:CurrentInternetTime}} }}

Because template names are interpreted in the same way to the names of other pages, underscores are replaced with spaces, and any text after a number sign (what would be a anchor in a standard link) is ignored.

An underscore _ can be alternative to a blank space.

Possible uses of templates

Templates can be used for any situation in which one wants two or more pages to contain identical or similar content that is edited together rather than independently. They can be used to:

  • Provide structured elements on many pages, like infoboxes, maintenance templates, navigational boxes, etc.
  • Perform calculations used as a programming tool on various pages, like w:Template:Sum.
  • Build composite pages that display the content of multiple existing pages together, like w:WP:Village pump (all) which includes content from each section of the village pump. The content of these pages can either be shown individually, or together, but the revision history, watchlist, etc. will only pick up changes to the transcluded pages and the raw wikitext of the composite page itself, not implicit changes to the composite page.
  • Share some content between a few related pages. For example, the list at Help:Preferences#Beta features is duplicated at Beta Features#Current Beta Features. While on MediaWiki.org that is built using Extension:LabeledSectionTransclusion instead, it could have been done using a template.
  • Store content referenced multiple times on the same page, so it only has to be written and calculated once. For example w:Template:Cite Monumentenregister/URL is called twice by w:Template:Cite Monumentenregister in two different places, and using another template means the URL pattern only has to be written once in the base template.
  • Use templates as a programming element to generate a loop: if Template:A calls Template:B 10 times with different parameters, then that crudely simulates a for loop. If Template:B calls Template:C 10 times, then you have a nested loop of 100 calls of Template:C. But keep in mind that it is easy to run into the template limits when using templates as advanced programming constructs, and using Scribunto is generally clearer and easier to follow.

एक विकि से दूसरे विकि पर प्रतिलिपि बनाना

It is possible, if allowed by the wiki configuration to transclude templates from other wikis. This configuration setting is disabled on Wikimedia wikis. Otherwise, you need to manually copy the template and its dependencies from the source wiki to the destination wiki to use it.

साँचों पर अक्सर CSS या दूसरे साँचों की ज़रूरत होती है, तो एक विकि से दूसरे विकि पर किसी साँचे की प्रतिलिपि बनाते समय सदस्यों को अक्सर परेशानी होती है। नीचे के चरण ज़्यादातर साँचों के लिए काम करते हैं।

मीडियाविकि कोड

अगर आपके पास नए विकि पर आयात करने के (खासकर कि importupload) अधिकार हैं:

  1. मूल विकि पर Special:Export पर जाएँ, और सभी आवश्यक साँचों के पूरे इतिहास के साथ एक .xml फ़ाइल डाउनलोड करें, जैसा नीचे दर्शाया गया है:
    • बड़े टेक्स्ट बॉक्स में साँचे का नाम दर्ज करें, जैसे "Template:Welcome"। बड़े अक्षरों और विशेष अक्षरों पर ध्यान दें - अगर साँचे का नाम सही नहीं हुआ, निर्यात तो हो जाएगा मगर शायद .xml फ़ाइल में सही डेटा न हो।
    • "साँचें भी जोड़ें" बॉक्स चुनें।
    • "पूरे इतिहास की जगह सिर्फ वर्तमान अवतरण को निर्यात करें" बॉक्स चुनें।
    • "निर्यात" पर क्लिक करें।
  2. नए विकि पर Special:Import पर जाएँ और .xml फ़ाइल अपलोड करें।

अगर आपके पास नए विकि पर आयात करने के अधिकार नहीं हैं:

  1. मूल विकि पर उस साँचे पर जाएँ जिसकी प्रतिलिपि आप बनाना चाहते हैं। सम्पादन पृष्ठ पर जाएँ और पूरे विकिटेक्स्ट की प्रतिलिपि बनाएँ।
  2. नए विकि पर उसी नाम के पृष्ठ पर जाएँ जिस नाम के साँचे से आपने मूल विकिटेक्स्ट की प्रतिलिपि बनाई थी। बनाएँ/सम्पादन पर क्लिक करें और प्रतिलिपि बनाए हुए विकिटेक्स्ट को चिपकाएँ। हर साँचे के सारांश में श्रेय देने के लिए मूल पृष्ठ की एक कड़ी जोड़ें।
  3. फिर मूल विकि पर सम्पादन विंडो में सम्पादन बॉक्स के नीचे "इस पृष्ठ पर प्रयुक्त साँचें" वाली सूची को देखें। वहाँ सूचीबद्ध हर साँचे के लिए ऊपर की विधि दुहराएँ। इन साँचों द्वारा भी प्रयुक्त साँचों के लिए ऐसा ही करें।
  1. On the new wiki, go to the page with the same name as the template you copied. Hit create/edit and paste the wikitext you copied. In the edit summary of each template, link to the original page for attribution.
  1. Back in the original wiki at the edit window, below the edit box, look at the list of "Templates used on this page". For each template listed follow these instructions. Also do that for any template used by any of these templates, and so on.

यह पूरे कोड की प्रतिलिपि बना देगा, और कुछ साँचों के लिए इतना काफ़ी होगा। ध्यान रखें कि सिर्फ पृष्ठ को रेंडर करते समय पार्स किए गए तत्वों को ही निर्यात किया जाता है, तो इस प्रक्रिया में प्रलेख पृष्ठों को निर्यात नहीं किया जाएगा। अगर यह काम नहीं करता, सम्पादन बॉक्स के नीचे "इस पृष्ठ के वर्तमान संस्करण पर ट्रांसक्लूड किए जाने वाले पृष्ठ:" अनुभाग में लाल कड़ियाँ ढूँढ़ें। अगर कोई लाल कड़ी होती है, ऊपर के चरण इन पृष्ठों के लिए भी दुहराएँ और मॉड्यूल्स के टेक्स्ट की भी प्रतिलिपि बनाएँ।

साँचे और इससे जुड़े हुए पृष्ठों को दूसरे विकि से सफलतापूर्वक आयात कर लेने के बाद साँचे को अनुकूलित करके अपने विकि के थीम में बसाएँ। उदाहरणस्वरूप, शायद आपको कोई लोगो बदलना पड़े, गलत कड़ियाँ या लाल कड़ियाँ हटानी पड़ें।

एक्सटेंशन्स

साँचों में अक्सर प्रयुक्त एक एक्सटेंशन है ParserFunctions। Extension:ParserFunctions पृष्ठ पर जाकर देखें कि वहाँ पर सूचीबद्ध कोई फ़ंक्शन उस साँचे में प्रयुक्त हैं या फिर नहीं। अगर ऐसा है, आपको ParserFunctions एक्सटेंशन स्थापित करना होगा। इसे स्थापित करने के लिए आपको अपने मीडिया स्थापना के सर्वर पर प्रबंधक वाली पहुँच होनी पड़ेगी।

साँचों में प्रयुक्त एक और निर्भरता, खासकर कि विकिपीडिया को साँचों पर, है लुआ। साँचे के कोड में {{#invoke: }} का होना इसका एक अच्छा चिह्न है। अगर इसका इस्तेमाल किया जाता है, आपको Scribunto एक्सटेंशन स्थापित करना होगा और सिस्टम प्रबंधक समूह की भी ज़रूरत होगी। एक्सटेंशन को स्थापित करने के बारे में अधिक विधि के लिए वह पृष्ठ देखें।

CSS और जावास्क्रिप्ट कोड

मीडियाविकि कोड के अलावा कई साँचें पूरी तरह से काम करने के लिए CSS का इस्तेमाल करते हैं और कुछ साँचें जावास्क्रिप्ट का। अगर प्रतिलिपि बनाए गए साँचें ठीक से काम नहीं कर रहे हैं, यह कारण हो सकता है। आवश्यक CSS और जावास्क्रिप्ट की प्रतिलिपि अपने विकि पर पाने के लिए बेशक आपको प्रबंधक के अनुमतियों की ज़रूरत होगी, क्योंकि आपको "मीडियाविकि:" नामस्थान में संदेशों को संपादित करना होगा।

  1. साँचे के टेक्स्ट CSS क्लास (class="foobar" जैसा टेक्स्ट) ढूँढ़ें। अगर वे क्लास "MediaWiki:Common.css" में नज़र आते हैं, उन क्लासों की प्रतिलिपि नए विकि पर "MediaWiki:Common.css" पर बनाएँ और जाँचें कि साँचा ठीक से काम कर रहा है या नहीं।
  2. अगर प्रतिलिपि साँचा अब भी ठीक से काम नहीं करता, जाँचें कि मूल विकि के "MediaWiki:Common.js" या "MediaWiki:Monobook.js" पर कोई कोड है या नहीं। अगर ऐसा है, नए विकि के "MediaWiki:Common.js" पर इसकी प्रतिलिपि बनाएँ। आम तौर पर सिर्फ विश्वसनीय स्रोतों से ही प्रतिलिपि बनाना चाहिए, और उचित हिस्सों को पहचान लेने का कौशल काम आता है। आपको शायद टिप्पणियाँ मिल जाए, जो हर हिस्से का महत्व बताए।

Redirection

If a page uses a redirect as a template, the redirect is resolved before processing the template and the target is used instead. This won't work if the target doesn't exist (a broken redirect), or is itself a redirect (a double redirect).

A page that just includes another page as a template might look like a redirect, but there are several differences between them:

  • The header of the result displays the title of the page it came from.
  • No "Redirected from" message is shown.
  • Buttons like edit, watch, talk, history, "what links here," and "last modified" point to the referring page. To access the target page, use a section edit link and navigate from there.
  • Unless includeonly and/or noinclude tags are used, the referring page shares the same categories as the target page.
  • "Double redirects" work when one or both are this type of pseudo-redirect.
Embedding works on pages that support redirects and doesn't work on pages without it.

Parser functions

MediaWiki also supports parser functions, which function similarly to templates but follow slightly different syntax:

  • Parser functions utilize a ":" instead of the initial "|".
  • An edit page does not display parser functions used on that page.
  • There is no "What links here" feature for parser functions to identify the pages where they are utilized.
  • Parser functions templates do not generally accept named parameters, so equal signs generally have no special significance. For example:
{{ #if: not blank | x=abc }} gives x=abc

ये भी देखें

साँचों का साधारण प्रयोग

साँचों में प्रयुक्त विशेष संरचनाएँ


दूसरी प्रासंगिक जानकारी

बाहरी कड़ियाँ