![](//upload.wikimedia.org/wikipedia/commons/thumb/7/74/Ambox_warning_yellow.svg/40px-Ambox_warning_yellow.svg.png) |
Templat ini menggunakan ciri-ciri sintaks templat yang rumit.
Anda digalakkan untuk membiasakan diri dengan persediaan dan fungsi penghurai sebelum menyunting templat ini. Jika suntingan anda menyebabkan masalah yang tidak diduga, sila undurkannya dengan segera kerana templat ini mungkin digunakan di sebilangan besar halaman.
Ingat bahawa anda boleh menjalankan uji kaji dan perlu menguji semua penambahbaikan, sama ada di /kes-kes ujian atau laman pengguna anda sebelum melakukan sebarang perubahan. ( lihat sejarah) |
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.
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:
| | | Nenek | | | | Atuk | |
| | | |
| | | | | | | | | | | | | | |
| | | | |
| | Ibu | | Bapa | | Makcik Daisy |
| |
| | | | | | | | | | | | | | | |
| | | | | | | | | | |
Abang saya Joe | | Saya! | | Adik perempuan | | |
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 |
|
|
q |
|
|
|
|
|
|
|
|
f |
|
|
|
|
|
|
|
|
|
|
|
r2 |
|
|
|
|
|
E |
|
|
* |
|
|
3 |
|
|
|
|
|
k |
|
|
a |
|
|
l |
|
|
|
|
|
k2 |
|
|
a2 |
|
|
l2 |
|
|
b |
|
|
n |
|
|
d |
|
|
|
|
|
|
|
|
e |
|
|
|
|
|
|
|
|
|
|
|
q2 |
|
|
|
|
|
|
r |
|
|
y |
|
|
z |
|
|
|
|
|
|
|
|
m |
|
|
|
|
|
|
|
|
|
|
|
m2 |
|
|
|
|
|
6 |
|
|
t |
|
|
9 |
|
|
|
|
|
o |
|
|
i |
|
|
g |
|
|
|
|
|
o2 |
|
|
b2 |
|
|
p2 |
|
|
c |
|
|
h |
|
|
j |
|
|
|
|
|
|
|
|
w |
|
|
|
|
|
|
|
|
|
|
|
n2 |
|
|
|
|
|
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:
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 box | | Green box | | Blue 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
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 :
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.
- familytree.js – tool to easily create or update diagrams using these templates