Title: Theory / Unimportant / CS / Descriptive / Wikipedia / Template
Tags: récupéré FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning mid1516974248815 todo

Name: Transclusion
Definition: Inclusion of the content of one document within another document by reference
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion

Instruction: {{bar:foo}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Include here the content of the page foo from the namespace bar
Language: Wikipedia
Context: media wiki

Instruction: {{foo}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Include here the content of the page foo from the template namespace
Language: Wikipedia
Assuming: foo is not a magic word

Instruction: {{subst:foo}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Replace this instruction by the content of page foo at the very moment this page is saved
Language: Wikipedia

Variable: foo:bar
Meaning: Page bar in namespace foo
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Language: Wikipedia

Name: namespace
Definition: A set of page
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Context: Wikipedia

Name: page name
Definition: A name, unique in a namespace, identifying a page
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Context: Wikipedia

Name: Template
Definition: pages that are written with the prime objective of being included in other pages
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion

Instruction: {{foo|bar_1| ... |bar_n|buz_1=plop_1| ... |buz_n=plop_n}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Call the template foo with parameters bar_i and plop_n
Language: wikipedia

Name: Named parameter
Definition: Parameters of the form foo=bar
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Context: Templates

Name: Unnamed parameter
Definition: Parameter determined by the position of the parameter
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Context: Templates
Name2: Positional parameter

Name: Composite page
Definition: Pages consisting, wholly or partly, of transcluded component pages.
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion

Instruction: <noinclude>foo</noinclude>
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: foo is some text, shown here but not when the template is included into another page
Language: wikipedia

Instruction: <onlyinclude>foo</onlyinclude>
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: foo is some text, and it is the only text shown in pages including this template
Language: wikipedia

Instruction: <includeonly>foo</includeonly>
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: foo is some text, not shown here, but shown in pages including this template
Language: wikipedia

Instruction: {{#section-h:foo|bar}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Transclude section bar from page foo
Language: wikipedia

Instruction: {{#section-h:foo}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Transclude heading section from page foo
Language: wikipedia

Instruction: {{foo/bar}}
Page: https://en.wikipedia.org/wiki/Wikipedia:Transclusion
Effect: Transclude subpage bar from page foo
Language: wikipedia

Instruction: <!-- Template:foo -->
Page: https://en.wikipedia.org/wiki/Help:Substitution
Effect: State that current text was obtained from substituing template foo
Language: wikipedia

Question: Why one would prefer substitution to transclusion
Answer: making the resulting page independent of future changes to the template
Page: https://en.wikipedia.org/wiki/Help:Substitution
Answer2: enabling other automatic replacements to occur (for example, a template may contain four tildes, which will be replaced by the user's signature and timestamp provided the template is substituted)
Answer3: enabling the page to be copied to another project without copying the template
Answer4: making page rendering faster for the server
Answer5: making the correspondence between wikitext and rendered page easier to understand (the opposite may also apply)

Question: Why one would prefer transclusion to substitution
Answer: Updates to the template will not be reflected on the target page
Page: https://en.wikipedia.org/wiki/Help:Substitution
Answer2: The resulting wikitext is longer and more complicated
Answer3: Other users cannot see that the text was produced using a template (and will not learn to use the template)

Question: How to keep a «subst» into a text
Answer: use
{{subst:<noinclude/>
Page: https://en.wikipedia.org/wiki/Help:Substitution
Extra: Todo: end the page (maybe?)

Question: What is done to named parameter's argument
Answer: Whitespace are stripped
Page: https://en.wikipedia.org/wiki/Help:Template

Question: What is done to unnamed parameter's argument
Answer: nothing
Page: https://en.wikipedia.org/wiki/Help:Template

Question: What is done to named parameter's argument not used in the template
Answer: nothing
Page: https://en.wikipedia.org/wiki/Help:Template

Question: How to put equal sign in parameters's argument
Answer: {{=}}
Page: https://en.wikipedia.org/wiki/Help:Template

Question: How to put a pipe sign in parameters's argument
Answer: {{!}}
Page: https://en.wikipedia.org/wiki/Help:Template
Answer2: &#124;

Page: https://en.wikipedia.org/wiki/Help:Template
Notation: foo is interpreted during substitution and not during definition of the template
Example: <noinclude><nowiki></noinclude>foo<noinclude></nowiki></noinclude>

Name: Subtemplate
Definition: Template used in a template
Page: https://en.wikipedia.org/wiki/Help:Template

Instruction: {{{i}}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The i-th unnamed parameter, or parameter named i
Language: wikipedia
Context: Template
Variables: i an integer

Instruction: {{{foo}}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The value of parameter foo
Language: wikipedia
Context: Template
Variables: foo a string

Instruction: {{{foo|bar}}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: Similar to {{{foo}}} if this value is defined. Replaced by bar otherwise
Language: wikipedia
Context: Template
Variables: foo a string or integer

Instruction: <nowiki>foo</nowiki>
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: foo is printed without being interpreted as a wiki text
Language: wikipedia
Variables: foo a string or integer

Instruction: {{uc: foo}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: foo in upper cap
Language: wikipedia

Instruction: {{lc: foo}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: foo in lower cap
Language: wikipedia

Instruction: {{NS: 1}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The name of the current namespace
Language: wikipedia

Instruction: {{fullurl: pagename}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The url of the current wikipedia page
Language: wikipedia

Instruction: {{#ifeq: foo|bar|ploup|yap}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: If foo equals bar, write ploup, otherwise yap
Language: wikipedia

Instruction: {{#if: foo|ploup|yap}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: If foo contains non-white space write ploup, otherwise yap
Language: wikipedia

Instruction: {{#ifexpr: foo|ploup|yap}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: If the mathematical expression foo is non0 write ploup, otherwise yap
Language: wikipedia

Instruction: {{#expr: foo}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The result of foo as a mathematical expression
Language: wikipedia

Instruction: {{PAGENAME}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The page name
Language: wikipedia

Instruction: {{FULLPAGENAME}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: Full page name, i.e. namespace:pagename
Language: wikipedia

Instruction: {{NAMESPACE}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The current name space
Language: wikipedia

Instruction: {{NUMBEROFUSERS}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: Number of registered users
Language: wikipedia

Instruction: {{PAGESINCATEGORY:foo}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: Number of pages in category foo
Language: wikipedia

Instruction: {{CURRENTVERSION}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The current version of mediawiki
Language: wikipedia

Instruction: {{REVISIONTIMESTAMP}}
Page: https://en.wikipedia.org/wiki/Help:Template
Effect: The time stamp of this revision
Language: wikipedia

Question: What happen when a template call itself
Answer: First iteration is done. Second one is ignored
Page: https://en.wikipedia.org/wiki/Help:Template

Question: What happen when a template has unmatched braces ?
Answer: In case of transclusion, they are printed as is, and ignored by the nested templates
Page: https://en.wikipedia.org/wiki/Help:Template
Context: WIkipedia
Answer2: In case of substitution, they are printed as is, and thus may be considered by nested template

Question: How to deal with templates beginning by :, ;, *, or #
Answer: start by <nowiki />, in order to avoid it to be interpreted as a list starter
Page: https://en.wikipedia.org/wiki/Help:Template

Question: How to debug template
Answer: Use substitution, to see what is really happening
Page: https://en.wikipedia.org/wiki/Help:Template
Answer2: Use msgnw, to see the wikitext of the template page
Answer3: expandtemplates to see full recursive expansion

Question: How to use a template to put articles in category without putting template in this category
Answer: Use <noinclude> around the category
Page: https://en.wikipedia.org/wiki/Help:Template