Bản mẫu:Cây phả hệ

(Đổi hướng từ Bản mẫu:Familytree)
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]

Đây là một bản mẫu để vẽ cây phả hệ đơn giản gồm hộp và kết nối các dòng dựa trên cú pháp giống như nghệ thuật ASCII. Các cây được hiển thị theo dạng bảng HTML sử dụng các thuộc tính CSS, và có thể chứa mã wiki tùy ý trong hộp.

Cách sử dụng ví dụ sửa

Mã này:

{{Cây phả hệ/đầu |summary=Tôi có một anh trai Joe và một em gái: mẹ tôi kết hôn với cha tôi, và cha mẹ của cha tôi là bà nội và ông nội; họ đã có một đứa con, dì Daisy.}}
{{Cây phả hệ | | | | GMa |~|y|~| GPa | | GMa=Gladys|GPa=Sydney}}
{{Cây phả hệ | | | | | | | |)|-|-|-|.| }}
{{Cây phả hệ | | | MOM |y| DAD | |DAISY| MOM=Mẹ|DAD=Cha|DAISY=[[Dì Daisy]]}}
{{Cây phả hệ | |,|-|-|-|+|-|-|-|.| | | }}
{{Cây phả hệ | JOE | | ME  | | SIS | | | JOE=Anh trai tôi Joe|ME='''Tôi!'''|SIS=Em gái tôi}}
{{Cây phả hệ/cuối}}

Kết quả này:


 
 
 
Gladys
 
 
 
Sydney
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Mẹ
 
Cha
 
Dì Daisy
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Anh trai tôi Joe
 
Tôi!
 
Em gái tôi
 
 

Các thông số sửa

The |summary=text parameter of the {{Cây phả hệ/đầu}} template should be used to describe the overall layout of the tree. This summary is for accessibility: it is read aloud to visually impaired readers who use screen readers, and is invisible to sighted readers.

The {{Cây phả hệ}} template produces one row in a family tree table. The template accepts up to 80 unnamed parameters describing the contents of the table. Each parameter specifies a tile or a box.

  • Tiles are line drawing symbols consisting of horizontal and vertical lines and various corners and crossings thereof. Tiles are specified using single-character symbols that more or less approximate the shape of the tile in appearance. A special case of a tile is the empty tile, specified by a single space character. A table of supported tiles is given below.
Dòng rắn:
,
 
 
 
 
v
 
 
 
.
 
 
 
)
 
 
 
+
 
 
 
 
(
 
 
 
`
 
 
 
^
 
 
 
'
 
 
 
-
 
 
!
 
 
 
Dòng đứt nét:
F
 
 
 
 
V
 
 
 
7
 
 
 
D
 
 
 
%
 
 
 
 
C
 
 
 
L
 
 
 
A
 
 
 
J
 
 
 
~
 
 
:
 
 
 
Hỗn hợp (1):
r
 
 
 
 
y
 
 
 
n
 
 
 
]
 
 
 
#
 
 
 
 
[
 
 
 
c
 
 
 
h
 
 
 
j
 
 
 
~
 
 
!
 
 
 
Hỗn hợp (2):
p
 
 
 
 
u
 
 
 
q
 
 
 
E
 
 
 
*
 
 
 
 
3
 
 
 
b
 
 
 
t
 
 
 
d
 
 
 
-
 
 
:
 
 
 
Linh tinh:
T
 
 
 
 
G
 
 
 
 
X
 
 
 
 
K
 
 
 
k
 
 
 
U
 
 
 


  • Boxes can contain arbitrary wiki markup. The contents of boxes are specified using additional named parameters appended to the template call. Each box is three tiles wide and normally has a 2 pixels wide black border. Boxes can have any name that is a valid template parameter name, although single character names should be avoided to prevent conflicts with tile symbols.

Thuộc tính phong cách sửa

The appearance of the boxes may be controlled by the optional template parameters border and boxstyle. The former sets the width of the box border in pixels, while the latter can be used to append arbitrary CSS declarations directly to the box style attributes. For example, the following code:

{{Cây phả hệ/đầu |summary=Hộp 1 kết hôn với Hộp 2, với đứa  Hộp 3  Hộp 4}}
{{Cây phả hệ|border=0|boxstyle=background:#dfd;| | FOO |y| BAR | |FOO=Hộp 1|BAR=Hộp 2}}
{{Cây phả hệ|border=0|boxstyle=background:#dfd;| | |,|-|^|-|.| | }}
{{Cây phả hệ|border=0|boxstyle=background:#dfd;| | FOO | | BAR | |FOO=Hộp 3|BAR=Hộp 4}}
{{Cây phả hệ/cuối}}

tạo ra một kết quả như thế này:


 
Hộp 1
 
Hộp 2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Hộp 3
 
Hộp 4
 

thuộc tính phong cách thậm chí có thể được thiết lập cho hộp cá nhân, như trong ví dụ dưới đây:

{{Cây phả hệ/đầu |Hộp màu trắng với ba đứa con hộp màu đỏ, hộp màu xanh  cây, hộp màu xanh, tất cả đã kết hôn với nhau}}
{{Cây phả hệ| | | | |WHITE| | | | |WHITE=Hộp màu trắng
|boxstyle_WHITE = background-color: #fff;
}}
{{Cây phả hệ| |,|-|-|'|!|`|-|-|.| }}
{{Cây phả hệ|RED  |~|GREEN|~|BLUE |RED=Hộp màu đỏ|GREEN=Hộp màu xanh  cây|BLUE=Hộp màu xanh
|boxstyle_RED   = background-color: #faa;
|boxstyle_GREEN = background-color: #afa;
|boxstyle_BLUE  = background-color: #aaf;
}}
{{Cây phả hệ/cuối}}

trong đó kết quả đầu ra:


 
 
 
 
Hộp màu trắng
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Hộp màu đỏ
 
Hộp màu xanh lá cây
 
Hộp màu xanh
 
 

NOTE: When specifying style attributes for individual named boxes, make sure the box names are aligned to the left side of 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 {{Cây phả hệ/đầu}} template also accepts an optional |style= parameter that can be used to set CSS styles for the entire diagram, and an optional |align= parameter to set the chart alignment.

Xem thêm sửa