m LiaMinina moved page Help:Compact guide/Template basics to Help:Compact Guide for Editors/Template basics: More accurate title |
mNo edit summary |
||
Line 11: | Line 11: | ||
|Welcome to Moegirlpedia! | |Welcome to Moegirlpedia! | ||
}}</pre> | }}</pre> | ||
The word "font" in the above code is the name of the template; words between "|" and "=" | The word "font" in the above code is the name of the template; words between "|" and "=" li<!---->ke "color" and "size", are template parameters; words after "=" like "red" and "20px" are parameter values. A parameter value can be empty. Templates mostly ignore spaces and line breaks at the beginning and end of parameters, so they rarely affects the output. | ||
Some templates quote parameters that don't use "=" but numbers like "1" and "2" (so-called "anonymous parameters"), like: '''<nowiki>{{color|white|You can't see me!}}</nowiki>'''. In the example, "white" and "You can't see me!" are the parameter values of the template. These parameters can also be written in their equivalent: '''<nowiki>{{color|1=white|2=You can't see me!}}</nowiki>'''. In fact, changing to a named parameter can solve the error caused when the parameter value contains HTML tags or "=". | Some templates quote parameters that don't use "=" but numbers like "1" and "2" (so-called "anonymous parameters"), like: '''<nowiki>{{color|white|You can't see me!}}</nowiki>'''. In the example, "white" and "You can't see me!" are the parameter values of the template. These parameters can also be written in their equivalent: '''<nowiki>{{color|1=white|2=You can't see me!}}</nowiki>'''. In fact, changing to a named parameter can solve the error caused when the parameter value contains HTML tags or "=". | ||
Line 47: | Line 47: | ||
{{Template:Moegirlpedia help}} | {{Template:Moegirlpedia help}} | ||
[[Category:Help]] | [[Category:Help]] | ||
[[zh:Help:萌百编辑简明指南/模板基础]] |
If a piece of content or code needs to be used a lot (top banners, character information, etc.), a template will be created to make it easier to be referenced and edited. Give this content a name, and call it directly when needed. The content only needs to be changed in the template, and entries with it will also change, saving lots of maintenance time. If you have edited an article, you may notice code like {{content}}, which is a template, and in the source code, {{template name|template parameter}}, to enclose the template with a pair of double curly brackets, and use the pipe character "|" to separate the name and parameters, is the basic form of a template.
Simply put, calling the template is to fill in the blanks. The parameters are the prompt words in parentheses, and the parameter values are the answers you fill. Note that parameters cannot be increased just by using a template. For easier check, maintenance, (and acceptance from OCD), parameters with much content in a template are usually separated with line breaks or spaces, like:
{{font |color = red |size = 20px |Welcome to Moegirlpedia! }}
The word "font" in the above code is the name of the template; words between "|" and "=" like "color" and "size", are template parameters; words after "=" like "red" and "20px" are parameter values. A parameter value can be empty. Templates mostly ignore spaces and line breaks at the beginning and end of parameters, so they rarely affects the output.
Some templates quote parameters that don't use "=" but numbers like "1" and "2" (so-called "anonymous parameters"), like: {{color|white|You can't see me!}}. In the example, "white" and "You can't see me!" are the parameter values of the template. These parameters can also be written in their equivalent: {{color|1=white|2=You can't see me!}}. In fact, changing to a named parameter can solve the error caused when the parameter value contains HTML tags or "=".
Still confused? It doesn't matter, because templates are the most complex and difficult part to understand when getting started with Wikitext, and this section is just a general introduction of templates. We believe you will gradually understand in later study and practice. If you see a templates or parameter that you don't understand anywhere, to prevent errors in the call, please search for the template page typing its name like "Template:name" and check its documentation, to learn its parameters and how to use, otherwise do not use the template or parameters lightly.
The following will only introduce the basic usage of a few common templates. You can also click the template link and check their documentation to master advanced usage.
{{color|red|It is red.}}
→ It is red.{{font|color=red|size=20px|title=Welcome to Moegirlpedia!|Welcome!}}
→ Welcome!{{ruby|注|zhù}}{{ruby|音|yīn}}
(Chinese characters to Pinyin) → The sentence "Good morning" in Japanese is {{lj|おはよう}}, and "Good afternoon" {{lj|こんにちは}}, while "Good evening" in {{lang-ja|こんばんは}}.
→ The sentence "Good morning" in Japanese is おはよう, and "Good afternoon" こんにちは, while "Good evening" in Japanese: こんばんは.{{Spoiler|Flat-tan is so cute!|Jeez...who allowed you to hover on it.}}
→ Flat-tan is so cute!{{Hide|Title=Click the "Expand" on the right.|Text=The text hidden would be shown.}}
↓Click the "Expand" on the right. |
---|
The text hidden would be shown. |
More templates are listed on page Category:Templates, and you can seek Help:Templates or MGP:Template guidelines for more help, like how to create a template.
Moegirlpedia has consensus on the layout, and entries not meeting it need to be localized to conform to the layout regulations.