Help

Wiki Glossary

From Dogcraft Wiki

No edit summary
Tag: Visual edit
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{WIP}}
__NOTOC__
===Templates===
===Templates===
[[File:Transclusion(wtd-ck).png|thumb|379x379px|Templates work by including the content of one page inside the content of another, this is called "transclusion". Here B is the template, and it is being using on A, X and Y. ]]
[[File:Transclusion(wtd-ck).png|thumb|379x379px|Templates work by including the content of one page inside the content of another, this is called "transclusion". Here B is the template, and it is being using on A, X and Y. ]]
Line 11: Line 14:


* Here, the name of the template is Egg, and it doesn't have any parameters.
* Here, the name of the template is Egg, and it doesn't have any parameters.
* If you look at the Template:Egg page, you'll see the text "Eggs are great for breakfast.", that's the template's content.  
* If you look at the [[Template:Egg]] page, you'll see the text "Eggs are great for breakfast.", that's the template's content.  


Adding the template on any page will show that sentence once you exit the editor. So, <code><nowiki>{{Egg}}</nowiki></code> generates: "{{Egg}}". And if you were to change the text on the Template:Egg page to "Omelettes are great for breakfast.", then everywhere the Egg template is used would update automatically!
Adding the template on any page will show that sentence once you exit the editor. So, <code><nowiki>{{Egg}}</nowiki></code> generates: "{{Egg}}". And if you were to change the text on the Template:Egg page to "Omelettes are great for breakfast.", then everywhere the Egg template is used would update automatically!
Line 31: Line 34:
{{Notice|title=Creating parameters|message=If you are making a template, inside a its content, it can refer to a parameter by its name, which when its added to a page will be replaced by its specified value. A template's content is always edited using the Source Editor. In there, parameters are marked by their name being surrounded with 3 brackets. (Eg.: {{{parameter name}}})|icon=fas fa-puzzle-piece}}
{{Notice|title=Creating parameters|message=If you are making a template, inside a its content, it can refer to a parameter by its name, which when its added to a page will be replaced by its specified value. A template's content is always edited using the Source Editor. In there, parameters are marked by their name being surrounded with 3 brackets. (Eg.: {{{parameter name}}})|icon=fas fa-puzzle-piece}}


==Useful tools==
 
The following sections are not up to the standards of this page and serve more as a layout of what still remains to be written.
=== Modules ===
{{WIP}}
Similar to templates, modules live in the Module: namespace and work by including Lua scrips on a page. Module documentation is always found on the module's /doc subpage.
 
=== Gadgets ===
{{WIP}}
Gadgets are added by the extension of the same name. They are snippets of CSS and JavaScript that a user can choose to load. Gadgets can be enabled from the User Preferences.
 
=== MediaWiki:Common.css, Common.js, skin css and js and styles ===
The content of the [[MediaWiki:Common.css]] and [[MediaWiki:Common.js]] is loaded on all pages by default. The MediaWiki software also allows for skin-specific styles at skinname.css and skinname.js, in our case located at [[Dogcraft.css]] and [[Dogcraft.js]]. The skin specific versions may come with a performance drop, which is why they are not currently in use.
 
MediaWiki also allows for different global stylesheets to be loaded for each user group using the MediaWiki:Group-groupname.css or .js pages. Some of these ([[MediaWiki:Group-site-content-editor.css]] and [[MediaWiki:Group-sysop.css]]) were previously in use, but currently none are. See [[mw:Manual:User_group_CSS_and_JavaScript]] for more information.
 
In addition to the above, MediaWiki also allows for further style and script pages, but on the wiki, none of these are in use:
* User specific User:Username/Common.css and ./Common.js files - these are disabled on the wiki using a system preference ($wgAllowUserCss)
* User specific User:Username/skinname.css and ./skinname.js files - these are also disabled by $wgAllowUserCss.
* Global [[MediaWiki:Noscript.css]] and [[MediaWiki:Print.css]] pages, currently neither is in use
 
For more information see [[mw:Manual:Interface/Stylesheets]]
 
 
== Useful tools ==
This section contains more advanced information, useful for managing the wiki.


=== WhatLinksHere ===
=== WhatLinksHere ===
Special:WhatLinksHere/<pagename> lists every single page which has a link to <pagename>.  Template transclusions also count as a 'link', so you can get a list of all pages where a specific template is in use. Every page has a button in the bottom right red box pointing to its Special:WhatLinksHere page, so you can get here fast. (This can be useful for redirects too, which are also included as 'links'.)
Special:WhatLinksHere/<pagename> lists every single page which has a link to <pagename>.  Template transclusions also count as a 'link', so you can get a list of all pages where a specific template is in use. Every page has a button in the bottom right red box pointing to its Special:WhatLinksHere page, so you can get here fast. (This can be useful for redirects too, which are also included as 'links'.)


=== uselang=qqx ===
=== QQX language ===
When working with system messages, you can add <code>?uselang=qqx</code> to the end of the page URL (or <code>&uselang=qqx</code> if the URL already has a question mark), which will show all the messages in use on the page by their name instead of their content. This can be extremely useful to find what message to edit! [[Image]]
When working with system messages, you can add <code>?uselang=qqx</code> to the end of the page URL (or <code>&uselang=qqx</code> if the URL already has a question mark), which will show all the messages in use on the page by their name instead of their content. This can be extremely useful to find what message to edit. For example, you can check the system messages in use on this page: [{{SERVER}}{{#sub:{{ARTICLEPATH}}|0|-2}}{{FULLPAGENAMEE}}?uselang=qqx {{SERVER}}{{#sub:{{ARTICLEPATH}}|0|-2}}{{FULLPAGENAMEE}}?uselang=qqx]
 
=== Template documentation ===
There are several tools to make documenting a template easier. Templates should always be documented, to ensure that they can be easily understood and modified without contacting the template's creator, or months or years after the template's creation.
 
==== Template links ====
Using {{tt|template link}}, {{tt|template}}, {{tt|tl}} or {{tt|t}}
 
During template documentation, you might want to refer to the template itself, or link to a different template. In such cases, formatting the link to the template like a template in wikitext. The {{template link|template link}} template achieves that. In fact, the previous sentence used it.
 
To display the parameter names of a template, you can add them as unnamed parameters to the {{template link|template link}} template. They will be displayed as grayed out text like this: {{template link|notice|title|message}}
 
''Note: The {{t|t}}, {{tl|tl}} and {{template|template}} templates function as aliases for {{template link|template link}} and redirect to it. Using any of them will in actuality use {{template link|template link}}.''<br />
''Note: This template is from Wikipedia. If the documentation on this wiki is not enough for your uses, check [[wp:Template:Template link]]''<br />
''Note: Originally, {{t|template link}} served as an alias for {{t|t}}, until they were switched. Now {{t|t}} is an alias for {{template link|template link}}
 
<div class="mw-collapsible mw-collapsed">
===== Template link with braces =====
<div class="mw-collapsible-content">
Using {{tt|tt}}
 
Much like a normal template link, except for also including the braces inside the link. The "Using: <template>" portions on this page use this template.</div>
 
<div class="mw-collapsible mw-collapsed">
===== Expanded template link =====
<div class="mw-collapsible-content">
Using {{tt|tlx}}
 
An expanded version of the {{template link|template link}} template including multiple formatting options allowing for marking substitution and adding parameter values. For adding just the parameter names, the normal {{t|template link}} template should be used. This template should be used when you want to show example parameter values to be inputted. To display both parameter names and values, use the {{t|=}} template in place of the regulat '=' sign in the syntax.
 
Examples:
* With substitution shown: {{tlx|subst=1|notice}}
* With parameter values: {{tlx|notice|My notice|content}}
* With both parameter names and values: {{tlx|notice|title{{=}}My notice|message{{=}}content}}</div>
 
==== Template documentation subpages ====
Using {{tt|documentation}}
 
Some templates use the /doc page for the template's documentation. For especially longer templates, and/or longer documentation pages, separating the template itself and its documentation into different pages may make maintaining them easier. On templates like this, use the {{t|documentation}} template to include the /doc subpage on the template page itself.

Latest revision as of 02:09, 28 July 2024


Templates

Templates work by including the content of one page inside the content of another, this is called "transclusion". Here B is the template, and it is being using on A, X and Y.

Templates are a consistent way to re-use text (or other content) across the wiki, regardless of what page your editing. Every template has a name, some content, and may have parameters. A template's name is always the name of a wiki page in the Template: namespace.

When you add a template to a page, you only need to add its name (and any parameters), and when viewing said page, the template name will be replaced with whatever is on the Template: page the name is pointing to. When editing the page, you will continue to see the template behave differently from the rest of the page.

  • In the VisualEditor, you can add templates using their own popup menu, in the top-bar at Insert > Templates by searching for the template's name.
  • In the Source Editor, you can add a template using a popup menu (accessed from the top-bar with the template-wizard-button button), or by surrounding the template's name with two brackets like this: {{template name}}.

For example, lets look at the "Egg" template.

  • Here, the name of the template is Egg, and it doesn't have any parameters.
  • If you look at the Template:Egg page, you'll see the text "Eggs are great for breakfast.", that's the template's content.

Adding the template on any page will show that sentence once you exit the editor. So, {{Egg}} generates: "Eggs are great for breakfast.". And if you were to change the text on the Template:Egg page to "Omelettes are great for breakfast.", then everywhere the Egg template is used would update automatically!

Parameters

The contents of a template (whatever is on the Template:Template name page) can have special sections of text called a parameter. Parameters are kind of like variables or inputs, they can be specified on the page that's using the template. They usually have their own names and values.

  • In the VisualEditor the template popup menu has a textbox for every parameter.
  • In the Source Editor, the popup menu can be used, or parameters can be added like this: {{template name|parameter_name = value|another_parameter_name = value}}.

For example, lets look at the Read more template:

  • Here, the name of the template is "Read more"
  • It has 1 parameter called "name"
  • The content is "To read more about the topic, see the {{{name}}} page."

If you wanted to use this template on a page, you could do {{Read more | name = Leon}} to generate "To read more about the topic, see the Leon page."

Creating parameters: If you are making a template, inside a its content, it can refer to a parameter by its name, which when its added to a page will be replaced by its specified value. A template's content is always edited using the Source Editor. In there, parameters are marked by their name being surrounded with 3 brackets. (Eg.: {{{parameter name}}})


The following sections are not up to the standards of this page and serve more as a layout of what still remains to be written.

Modules

Similar to templates, modules live in the Module: namespace and work by including Lua scrips on a page. Module documentation is always found on the module's /doc subpage.

Gadgets

Gadgets are added by the extension of the same name. They are snippets of CSS and JavaScript that a user can choose to load. Gadgets can be enabled from the User Preferences.

MediaWiki:Common.css, Common.js, skin css and js and styles

The content of the MediaWiki:Common.css and MediaWiki:Common.js is loaded on all pages by default. The MediaWiki software also allows for skin-specific styles at skinname.css and skinname.js, in our case located at Dogcraft.css and Dogcraft.js. The skin specific versions may come with a performance drop, which is why they are not currently in use.

MediaWiki also allows for different global stylesheets to be loaded for each user group using the MediaWiki:Group-groupname.css or .js pages. Some of these (MediaWiki:Group-site-content-editor.css and MediaWiki:Group-sysop.css) were previously in use, but currently none are. See mw:Manual:User_group_CSS_and_JavaScript for more information.

In addition to the above, MediaWiki also allows for further style and script pages, but on the wiki, none of these are in use:

  • User specific User:Username/Common.css and ./Common.js files - these are disabled on the wiki using a system preference ($wgAllowUserCss)
  • User specific User:Username/skinname.css and ./skinname.js files - these are also disabled by $wgAllowUserCss.
  • Global MediaWiki:Noscript.css and MediaWiki:Print.css pages, currently neither is in use

For more information see mw:Manual:Interface/Stylesheets


Useful tools

This section contains more advanced information, useful for managing the wiki.

WhatLinksHere

Special:WhatLinksHere/<pagename> lists every single page which has a link to <pagename>. Template transclusions also count as a 'link', so you can get a list of all pages where a specific template is in use. Every page has a button in the bottom right red box pointing to its Special:WhatLinksHere page, so you can get here fast. (This can be useful for redirects too, which are also included as 'links'.)

QQX language

When working with system messages, you can add ?uselang=qqx to the end of the page URL (or &uselang=qqx if the URL already has a question mark), which will show all the messages in use on the page by their name instead of their content. This can be extremely useful to find what message to edit. For example, you can check the system messages in use on this page: https://dogcraft.net/wiki/Help:Wiki_Glossary?uselang=qqx

Template documentation

There are several tools to make documenting a template easier. Templates should always be documented, to ensure that they can be easily understood and modified without contacting the template's creator, or months or years after the template's creation.

Template links

Using {{template link}}, {{template}}, {{tl}} or {{t}}

During template documentation, you might want to refer to the template itself, or link to a different template. In such cases, formatting the link to the template like a template in wikitext. The {{template link}} template achieves that. In fact, the previous sentence used it.

To display the parameter names of a template, you can add them as unnamed parameters to the {{template link}} template. They will be displayed as grayed out text like this: {{notice|<title>|<message>}}

Note: The {{t}}, {{tl}} and {{template}} templates function as aliases for {{template link}} and redirect to it. Using any of them will in actuality use {{template link}}.
Note: This template is from Wikipedia. If the documentation on this wiki is not enough for your uses, check wp:Template:Template link
Note: Originally, {{template link}} served as an alias for {{t}}, until they were switched. Now {{t}} is an alias for {{template link}}

Template link with braces

Using {{tt}}

Much like a normal template link, except for also including the braces inside the link. The "Using: <template>" portions on this page use this template.
Expanded template link

Using {{tlx}}

An expanded version of the {{template link}} template including multiple formatting options allowing for marking substitution and adding parameter values. For adding just the parameter names, the normal {{template link}} template should be used. This template should be used when you want to show example parameter values to be inputted. To display both parameter names and values, use the {{[[Template:{{{1}}}|{{{1}}}]]}} template in place of the regulat '=' sign in the syntax.

Examples:

  • With substitution shown: {{subst:notice}}
  • With parameter values: {{notice|My notice|content}}
  • With both parameter names and values: {{notice|title=My notice|message=content}}

Template documentation subpages

Using {{documentation}}

Some templates use the /doc page for the template's documentation. For especially longer templates, and/or longer documentation pages, separating the template itself and its documentation into different pages may make maintaining them easier. On templates like this, use the {{documentation}} template to include the /doc subpage on the template page itself.