Bantuan:Kotak info

(Dilencongkan dari Bantuan:Infobox)


Kotak info adalah sebuah jadual berformat tetap yang ditambah pada sebelah sudut kanan atas sesebuah rencana untuk memaparkan suatu ringkasan bagi beberapa fakta-fakta serupa yang tekal, membolehkan penyatuan rencana-rencana untuk dikongsi bersama dan juga untuk menambah baik pandu arah kepada rencana-rencana yang berhubung kait. Kebanyakan kotak info juga memaparkan metadata berstruktur yang diperolehi oleh DBpedia dan pengguna semula pihak ketiga yang lain.

Apa yang kotak info lakukan?Sunting

Templat kotak info mengandungi fakta dan perangkaan penting dari jenis yang biasa kepada rencana yang berkaitan. Sebagai contoh, semua binatang mempunyai pengelasan saintifik (spesies, keluarga dan seterusnya), malah pada status pemuliharaannya. Menambah templat {{Kotak info taksonomi}} pada rencana-rencana haiwan menjadikannya lebih senang untuk mendapatkan maklumat yang berkenaan dan membandingkannya dengan rencana-rencana lain.

Templat kotak info adalah seperti lembaran-lembaran fakta, atau bar sisi, di dalam rencana majalah. Mereka dengan pantas akan menyimpulkan beberapa fakta penting di dalam format yang senang dibaca. Bagaimanapun, mereka bukanlah jadual-jadual "perangkaan" kerana mereka sepatutnya meringkaskan bahan-bahan di dalam rencana—maklumat itu masih harus ada di dalam teks utama, sebahagiannya kerana sesetengah pembaca mungkin tidak dapat mengakses kandungan kotak info. Dalam keadaan tertentu, jika suatu templat kotak info menyembunyikan lajur-lajur data di dalam jadual runtuh, maka pembaca yang menggunakan teknologi bantuan mungkin tidak sedar akan kewujudan mereka sepenuhnya.

Terdapat banyak kotak info juga mengeluarkan metadata seperti mikroformat.

Apa yang seharusnya ada pada kotak info?Sunting

Secara umumnya, data di dalam templat kotak info seharusnya:

  • Boleh dibandingkan. Jika terdapat banyak subjek berbeza yang kesemuanya berkongsi atribut sepunya (seperti semua orang mempunyai nama dan tarikh lahir), maka adalah berguna untuk dapat membuat perbandingan merentasi halaman yang berbeza. Ini juga membayangkan bahawa jika boleh, bahan harus dibentangkan dalam format piawai.
  • Ringkas. Templat kotak info hendaklah boleh dilihat sekali lalu dan digunakan untuk semakan fakta yang pantas. Badan teks yang panjang atau perangkaan yang sangat terperinci diletakkan pada kandungan utama rencana.
  • Relevan dengan subjek.
  • Sudah dipetik di tempat lain dalam rencana itu. Kotak-kotak info seperti pengenalan/pendahuluan rencana, seharusnya mengandungi bahan yang boleh diperluas dan disokong oleh petikan kepada sumber yang boleh dipercayai di tempat lain di dalam rencana. Walau bagaimanapun, jika perlu (contohnya, kerana rencana pada masa ini belum lengkap), adalah mungkin untuk memasukkan catatan kaki di dalam kotak info.

Apa yang tidak seharusnya ada pada kotak info?Sunting

Secara umumnya, data di dalam templat kotak info tidak seharusnya:

  • Panjang berjela. Badan teks yang panjang atau perangkaan yang sangat terperinci hendaklah diletakkan pada kandungan utama rencana.
  • Butiran remeh. Masalah biasa termasuklah bahan di dalam kotak info yang remeh dan sebaliknya tidak dimasukkan ke dalam badan rencana. Contohnya: jenis darah watak cereka mungkin dirujuk secara sambilan dalam suatu karya tetapi biasanya tidak berguna untuk memahami subjek. Templat kotak info tidak harus digunakan unutk butiram yang terlalu remeh termasuklah dalam badan rencana (terdapat beberapa pengecualian seperti ciri-ciri kimia).

Mencari templat kotak info bersesuaianSunting

Kotak info merupakan suatu sambungan atau lanjutan bagi Infoboxes are an extension of MediaWiki's template feature, and as such their implementations are kept in the Template namespace. There are two ways that editors typically want to access the underlying details of an infobox:

  • Second (and more commonly), when an editor is inspired by an infobox in a particular article, he or she can map the infobox onto its template implementation in the Template namespace.

For example, the article D-Terminal contains an infobox. Simply edit the article to determine which one:


{{ infobox connector

...

}}

The start of the template identifies the markup between the enclosing braces as an infobox instance. While the next word identifies the specific kind of infobox (in this case the "Connector" infobox), the underlying template is still located in the Template namespace under {{infobox Connector}}. Note that MediaWiki properly handles differences in capitalization so that {{infobox connector}} maps to the appropriate template as well.

Redesigning an existing infoboxSunting

You are well-advised to seek the opinions of other editors before embarking on a redesign. If your ideas are welcomed, consider prototyping your new design (see #Prototyping an infobox, below).

Once prototyped, propose the infobox changes to the appropriate WikiProject and gain Wikipedia:Consensus before deploying your new design.

Mencipata sebuah infobox yang baruSunting

You should research whether an existing infobox fits your purpose either by examining those in Category:Infobox templates or researching articles that might be candidates to receive the new infobox. You should prototype the proposed infobox in your own userspace first and research which Wikipedia:WikiProjects might be interested in the infobox.

Prototyped infoboxes should be placed on the Wikipedia:List of infoboxes/Proposed sub-page when proposed and added to the appropriate sub-category when implemented.

Prototyping sesuatu infoboxSunting

Infoboxes can be readily prototyped within the designing editor's own user space. For example, to create an infobox prototype called Infobox mysubject, a designing editor should simply start a standalone article from his or her user page: Special:Mypage/Infobox mysubject. The general steps in prototyping are:

  • Determining the general implementation approach
  • Designing the infobox
  • Implementing the infobox
  • Documenting, for other editors, how to use the infobox
  • Categorizing the infobox to make it more easily available to other editors
  • Testing the infobox implementation

Menialai pendekatan umumSunting

There are three techniques with which to construct a prototype:

  1. Use {{infobox}} to construct the prototype. This method is the easiest and hence strongly recommended. The rest of this section assumes the designing editor chooses this approach.
  1. Use a table to construct a "static infobox", converting to a template after the editor arrives at a "final" design. See also Wikipedia:Thinking outside the infobox.
  1. Use the MediaWiki template feature to construct the prototype using the documentation at mw:Help:Templates. While this provides the most flexibility, it is by far the most challenging approach (and is beyond the scope of this article)

MerangkaSunting

Editors generally compose infoboxes from four types of visual elements: A title, images, sections, and fields. Since these terms are not standard, we illustrate them here:

Title
 
Image caption
SectionA
FieldNameA1 FieldParameterA1
FieldNameA2 FieldParameterA2
FieldNameA3 FieldParameterA3
SectionB
FieldNameB1 FieldParameterB1
FieldNameB2 FieldParameterB2

The selection and arrangement of fields is an important design decision for which Wikipedia:Manual of Style (infoboxes) gives some general advice. The part of a field that varies from article to article becomes a parameter for the newly-prototyped infobox and must be consistently expressed in two distinct places:

  1. In the infobox implementation itself, to indicate where the article-specific text is to be displayed
  1. In the infobox documentation, to indicate which article-specific information editors are to provide when using the infobox

Additionally, the editor should decide whether a field (and hence its corresponding parameter) is required or optional. The difference between the two is that a required field is always displayed; an optional field is not displayed where articles referencing the infobox omit the parameter. If the field is required, the infobox designer should consider whether a default value for the field is useful.

MelaksanaSunting

Once an editor has decided upon the title, image, and arrangement of sections and fields, he or she is ready to map those visual elements onto the parameters of the infobox template. {{infobox}} documents how to use this template. While there many different infobox parameters, the most frequently used are:


{{ infobox

| abovestyle  =

| above       =

| image       =

| caption     =

| headerstyle =

| header1     =

| label1      =

| data1       =

| header2     =

| label2      =

| data2       =

...

| header20    =

| label20     =

| data20      =

}}

The mapping of visual elements onto infobox parameters is straightforward:

Visual element How to implement Parameters to implement Notes
Colored title and section bars |abovestyle = background:color;
|headerstyle = background:color;
None See http://www.w3.org/TR/CSS2/propidx.html for styles other than background
Title |above = {{{name|<includeonly>{{PAGENAME}}</includeonly>}}} {{{name}}}
Image |image = {{#if:{{{image|}}}|[[Image:{{{image}}}|22em]]}}
|caption = {{{caption|}}}
{{{image}}}, {{{caption}}} Images must be specified using the Wikipedia:Extended image syntax
Section |headern = Fixed section name None
Required field with no default value |labeln = Fixed field name
|datan = {{{Parameter name}}}
{{{Parameter name}}} Note that parameters are enclosed in triple braces {{{...}}}
Optional field |labeln = Fixed field name
|datan = {{{Parameter name|}}}
{{{Parameter name}}} Use | to specify an empty string as the default ({{{...|}}})
Required field with a default value |labeln = Fixed field name
|datan = {{{Parameter name|default-value}}}
{{{Parameter name}}}
Field conditionally displayed |labeln = Fixed field name
|datan = {{#if:{{{Parameter nameif specified|}}}|{{{Parameter namethen display this|}}} }}
{{{Parameter nameif specified}}},
{{{Parameter namethen display this}}}
General form is {{#if:test|then-text|else-text}}}

When making style decisions, editors should follow the Wikipedia:Manual of Style (infoboxes) as closely as possible. Images must be specified using the Wikipedia:Extended image syntax. When specifying styles (e.g., for abovestyle, bodystyle, and headerstyle), http://www.w3.org/TR/CSS2/propidx.html is an excellent reference.

The vast majority of editors use only the simple features of infobox in the ways described above. However, the more intrepid editor should be aware of the more esoteric features of {{infobox}}:

  • Displaying the title outside the infobox (as opposed to inside the infobox)
  • Displaying extra text below the title or at the bottom of the infobox (for "see also", footnotes, wikilink to "list of" article, etc.)
  • Displaying a second image
  • Displaying images anywhere other than the top of the infobox
  • Displaying the "view/edit/discuss" navigation bar for the infobox

Again, these features are documented in {{infobox}}.

MendokumentasiSunting

The goal of documenting the newly-created infobox is to allow other editors to quickly ascertain what information they need to provide when incorporating the infobox into articles. The convention is to keep documentation in a page separate from the infobox implementation and arrange for the implementation to transclude the documentation when the infobox is displayed directly, but not when the infobox is displayed in an article.

  • First, ensure {{Documentation}} is appended to the template, enclosed in elements.(See also below) Ensure there are no stray spaces between the end of template (}}) and as these, if present, will be transcluded into every article that uses the template.

{{ infobox

...

}}<noinclude>{{documentation}}<!-- Please add category and language links to the bottom of the /doc sub-page, not here --></noinclude>

  • Next, create the documentation page as a subpage from the infobox template itself (e.g., Special:Mypage/Infobox mysubject/doc). The easiest way to do this is by following the [create] link from the empty {{documentation}} transclusion. This will preload a skeleton documentation page which can be filled in with basic usage, links to similar templates, interwiki links, and category links (at the bottom, in the <noinclude></noinclude> section).
  • Finally, organize the documentation into the following sections:
  • Overview
  • Parameters (their meanings and whether they are optional, have a default value, or are conditionally displayed)
  • Blank template (suitable for copy-n-pasting into articles)
  • Examples (e.g., to show the effects of conditionally-displayed parameters)

MengkategoriSunting

In order for other editors to find an infobox more easily, categories and interwiki links should be added to the bottom of the infobox documentation (at Special:Mypage/Infobox mysubject/doc).

Note that by convention, the infobox should be categorized using an explicit sort key that drops the infobox prefix. In other words, rather than letting the category sort key default to Wikipedia:PAGENAME (in our example, "Infobox mysubject"), editors should explicitly supply "Mysubject" as the category sort key, as in [[Category:Mycategory infobox templates|Mysubject]].

MengujiSunting

Editors should test prototyped infoboxes in their own userspaces. The simplest means is for the editor to place the fully-qualified page name of the template to be tested within the template braces (e.g., {{Special:Mypage/Infobox mysubject}}) on his or her own user page, Special:Mypage.

Once the infobox prototype has been tested, it is ready for peer review and deployment.

Sebuah rangka infoboxSunting

The following can be used as a starting point for a new infobox; simply copy-n-paste into the page designated to hold the new infobox and add or delete parameters as needed. Editors who want to take advantage of the more advanced features of infobox can copy-n-paste the comprehensive skeleton from {{infobox}}.


{{ infobox

| abovestyle  =

| above       =

| image       =

| caption     =

| headerstyle =

| header1     =

| label1      =

| data1       =

| header2     =

| label2      =

| data2       =

| header3     =

| label3      =

| data3       =

| header4     =

| label4      =

| data4       =

| header5     =

| label5      =

| data5       =

| header6     =

| label6      =

| data6       =

| header7     =

| label7      =

| data7       =

| header8     =

| label8      =

| data8       =

| header9     =

| label9      =

| data9       =

| header10    =

| label10     =

| data10      =

}}<noinclude>

{{Documentation}}

<!-- Please add categories and interwiki links to /doc subpage, not here! -->

</noinclude>

Contoh infobox berdasarkan {{infobox}}Sunting

Lihat jugaoSunting