Templat:Chart

Daripada Wikipedia, ensiklopedia bebas.
Jump to navigation Jump to search
Pendokumenan templat[lihat] [sunting] [sejarah] [nyahcache]
Pendokumenan templat berikut ditransklusikan daripada Templat:Chart/doc [sunting]

This is a template for rendering simple diagrams consisting of boxes and connecting lines based loosely on an ASCII art-like syntax. The trees are displayed as HTML tables using CSS attributes, and may contain arbitrary wiki markup within the boxes. This implementation was based on the {{familytree}} template.

Penggunaan[sunting sumber]

Kod ini:

{{chart/start}}
{{chart| | | | GrMa |~|y|~| GrPa | | GrMa=Nenek|GrPa=Atuk}}
{{chart| | | | | | | |)|-|-|-|.| }}
{{chart| | | MOM |y| DAD | |DAISY| MOM=Ibu|DAD=Bapa|DAISY=[[Makcik Daisy]]}}
{{chart| |,|-|-|-|+|-|-|-|.| | | }}
{{chart| JOE | | ME  | | SIS | | | JOE=Abang saya Joe|ME='''Saya!'''|SIS=Adik perempuan}}
{{chart/end}}

Menghasilkan ini:

NenekAtuk
IbuBapaMakcik Daisy
Abang saya JoeSaya!Adik perempuan

Parameter[sunting sumber]

The template accepts up to 50 unnamed parameters with each parameter specifying a tile or a box.

  • Boxes can contain arbitrary wiki markup. The content of each box is specified using additional named parameters appended to the template call. Each box is three tiles wide and normally has a black border two pixels wide. Boxes can have any name that is a valid template parameter name, subject to a minimum of two alphabetical characters.
  • Tiles are line drawing symbols used to connect the boxes. They consist of various styles of horizontal and vertical lines along with corners and crossings as needed. Tiles are specified using their one- or two-character name: for the most common tiles, that character is more or less approximate to the tile's appearance. A special case of a tile is the empty tile, specified by a single space character. A table of available tiles is given below.
Garis sambung (A):
!
  ,
  v
  .
 
-
  )
  +
  (
 
`
  ^
  '
 
Garis putus-putus (B):
:
  F
  V
  7
 
~
  D
  %
  C
 
L
  A
  J
 
Garis titik-titik (C):
Q
  S
  M
  T
 
P
  H
  R
  G
 
Y
  W
  Z
 
Campuran (A+B), (A+C), (B+C):
p
  u
{{{u}}}
  q
        f
        r2
 
E
{{{E}}}
  *
  3
{{{3}}}
        k
  a
  l
        k2
  a2
  l2
 
b
  n
  d
        e
        q2
 
 
r
  y
  z
{{{z}}}
        m
        m2
 
6
{{{6}}}
  t
  9
{{{9}}}
        o
  i
  g
{{{g}}}
        o2
  b2
  p2
 
c
  h
  j
        w
{{{w}}}
        n2
 


Style attributes[sunting sumber]

Penampilan untuk kekotak boleh dikawal dengan templat parameter pilihan berikut:

  • border merujuk kepada kelebaran sempadan kekotak dalam unit pixels,
  • boxstyle boleh digunakan untuk menambah arbitrary CSS declarations terus kepada box style attributes.

Sebagai contoh, kod berikut:

{{chart/start}}
{{chart|border=0|boxstyle=background:#dfd;| | FOO |y| BAR | |FOO=Box 1|BAR=Box 2}}
{{chart|border=0|boxstyle=background:#dfd;| | |,|-|^|-|.| | }}
{{chart|border=0|boxstyle=background:#dfd;| | FOO | | BAR | |FOO=Box 3|BAR=Box 4}}
{{chart/end}}

akan menghasilkan carta:

Box 1Box 2
Box 3Box 4

Style attributes juga boleh disetkan kepada kekotak secara individu, seperti contoh dibawah:

{{chart/start}}
{{chart| | | | |CLEAR| | | | |CLEAR=Clear box}}
{{chart| |,|-|-|'|!|`|-|-|.| }}
{{chart|RED  |~|GREEN|~|BLUE |RED=Red box|GREEN=Green box|BLUE=Blue box
|boxstyle_RED  =background-color: #faa;
|boxstyle_GREEN=background-color: #afa;
|boxstyle_BLUE =background-color: #aaf;
}}
{{chart/end}}

yang mana menghasilkan ini:

Clear box
Red boxGreen boxBlue box

NOTE: When specifying style attributes for individual named boxes, make sure the box names are aligned to the left side of the area reserved for them in the template call (as in "|RED  |" instead of "| RED |" in the example above), otherwise the template will end up looking for a style parameter with spaces in its name.

The {{chart/start}} template also accepts an optional style parameter that can be used to set CSS styles for the entire diagram.

Migrasi dari templat familytree[sunting sumber]

Templat {{chart}} kebanyakannya sesuai digunakan dari templat asal {{familytree}}. Walaubagaimanapun, untuk menggunakan fungsi tambahan yang ditawarkan dengan templat ini, diagram mesti dikemaskini / diganti berdasarkan kaedah templat {{chart}}. Diagram templat dan sub-templat {{familytree}} boleh diubah kepada templat {{chart}} dengan menukar wikiteks familytree kepada chart. Beberapa penambahbaikan telah dilakukan dari {{familytree}} dengan menggabungkan garis sambung dan garis putus-putus dan gambarajah dibawah menunjukkan perbezaannya :

Tile {{familytree}} {{chart}}
{{{z}}}
n z
{{{6}}}
] 6
# t
{{{9}}}
[ 9
t n

Lastly, if any uses of the {{familytree}} template end with |}}, that vertical bar should be removed, leaving the last cell in that row containing either some text or a space.

The familytree.js tool below can be used to convert between syntaxes. Just change the start tag when in edit view, then click "Art → Templates" to toggle back to wikitext view. The other templates will be updated to match.

Errors[sunting sumber]

See also[sunting sumber]

  • familytree.js – tool to easily create or update diagrams using these templates