Википедија:Документирање на предлошки: Разлика помеѓу преработките

Од Википедија — слободната енциклопедија
Избришана содржина Додадена содржина
с мала поправка
Ред 1: Ред 1:
{{како да направам|WP:DOC}}
{{како да направам|ВП:ДОК}}


[[Помош:Шаблон|Шаблоните]] се многу моќна алатка на [[MediaWiki]], но во исто време збунувачки за новите корисници, па дури и поискусните корисници со потешкотии го разбираат значењето на покомплексните шаблони. Шаблоните треба да бидат проследени со соодветна '''[[документација]]''' за да се објасни и зголеми нивната употреба.
[[Помош:Шаблон|Шаблоните]] се многу моќна алатка на [[MediaWiki]], но во исто време збунувачки за новите корисници, па дури и поискусните корисници со потешкотии го разбираат значењето на покомплексните шаблони. Шаблоните треба да бидат проследени со соодветна '''[[документација]]''' за да се објасни и зголеми нивната употреба.
Ред 64: Ред 64:


[[Категорија:Википедија шаблони|{{PAGENAME}}]]
[[Категорија:Википедија шаблони|{{PAGENAME}}]]
[[Категорија:Википедија како да направам|{{PAGENAME}}]]
[[Категорија:Водичи за Википедија|{{PAGENAME}}]]
[[Категорија:Документација за шаблони| ]]
[[Категорија:Документација за шаблони| ]]



Преработка од 01:38, 9 мај 2008

Предлошка:Како да направам

Шаблоните се многу моќна алатка на MediaWiki, но во исто време збунувачки за новите корисници, па дури и поискусните корисници со потешкотии го разбираат значењето на покомплексните шаблони. Шаблоните треба да бидат проследени со соодветна документација за да се објасни и зголеми нивната употреба.

Документацијата треба да објасни зошто служи и како се користи шаблонот. Треба да биде едноставна за да може и корисниците без некои пошироки познавања на синтаксата на шаблонот, во кои спаѓаат и многу искусни уредувачи кои своето внимание го имаат фокусирано на друго место, да може правилно и успешно да го користат. Ова посебно е важно за шаблоните кои се користат многу често.

Што да се вклучи во документацијата

Документацијата треба да го опфати следново:

  • Основната намена на шаблонот: што прави, и (ако не е очигледно) зошто треба тоа да го направи. Ако постојат други шаблони со слично име или намена, добро би било истото да се наведе во документацијата, за да се намалат можностите за погрешно користење на некој од нив.
  • Any parameters that the template takes. Explain whether they are numbered or named, whether they are optional (and if so, what the default value is), and what effect they have. If a parameter can take only a limited set of values ("yes" or "no", for example), must be a number, or is constrained in some other way, this should be made clear.
  • Usage examples. Specify the exact wikitext that should be used, and the result it produces. The wikitext can be enclosed in <tt>...</tt> tags to make it clear and easy to copy, like this. If the template can be used in several different ways (with or without optional parameters, for example), provide a range of examples. A good way to do so is to transclude the template itself into the documentation a few times, with different parameters each time, and list the parameters used in each case.
  • Related templates. If the template is one of a series of templates, include links to these – in particular, ensure that every template in the series is linked from each of the others, as this makes navigation easier. (A separate navigation template may be useful for this purpose; see for example Template:Protection templates).
  • Appropriate categories and interwiki links, where applicable. Like the documentation, these must be contained within <noinclude>...</noinclude> tags. Many template categories are available, go to Category:Wikipedia templates to browse through them.

Template documentation is often placed in a subpage of the template itself, which is then transcluded at the end of the template page. This separates the often complex template code from the documentation, making the documentation easier to edit. It also allows templates to be protected where necessary, while allowing anyone to edit the documentation. This method is sometimes referred to as the "template doc page pattern".

Documentation of any sort on a template page should always be enclosed by <noinclude>...</noinclude> tags, so that it does not show up when the template is used on another page. Text on the template page itself adds to the amount of text which must be processed when displaying the template, which is limited for performance reasons. Placing the documentation in a subpage avoids this (MediaWiki developers have recommended it for this reason).

Како да креирате подстраница на документацијата

Documentation subpages should be named and formatted using the following general pattern, for consistency.

Suppose your template is named Template:X. Create a subpage with the name Template:X/doc. Use the following wikitext as a start for the documentation:

<includeonly>{{template doc page transcluded}}</includeonly><noinclude>{{template doc page viewed directly}}</noinclude>
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->

<includeonly>
<!-- ADD CATEGORIES BELOW THIS LINE -->

<!-- ADD INTERWIKIS BELOW THIS LINE -->

</includeonly>

The top line will display one of two templates – {{template doc page transcluded}} or {{template doc page viewed directly}} – at the top of the documentation; this makes it clear to the reader that what followes is documentation, and provides a link to edit the /doc subpage.

Insert the documentation, categories and interwikis as below the appropriate comment lines – leaving the comments in place so that the layout is preserved when the page is edited in future.

Save the subpage, and return to the template itself, Template:X in this example. Edit the template and append the following at the end of the template code:

[--template code--]<noinclude>
{{template doc}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>

Важно: Make sure the opening <noinclude> begins on the same line as the last character of the template code (or text), and not on a new line. Otherwise, extra space will be inserted below the template when it is used, which is usually not wanted.

If the template is already protected, ask an administrator to do this, or request an edit by using {{editprotected}} on the template's talk page. If documentation, categories and interwiki links already exist in a section enclosed with <nowiki> tags, move them into the documentation subpage, as it is best not to have documentation split across two separate pages.

Пример

See the heavily-used Template:Cite web for an example of detailed template documentation. Note that the template itself is protected, but the documentation subpage, Template:Cite web/doc is unprotected and can still be edited.

Види исто така