{{i}} Документація шаблону[перегляд] [редагувати] [історія] [очистити кеш]

Шаблон:Intricate template The Chart2 family of templates are for rendering simple family trees consisting of boxes and connecting lines based on an ASCII art-like syntax. The trees are displayed as HTML tables using CSS attributes, and may contain arbitrary w:wiki markup within the boxes.

Example usage

ред.

This code:

{{chart2/start}}
{{chart2 |   |   |   |GRM| t |GRP|   |GRM =Grandma|GRP=Grandpa}}
{{chart2 |   |   |   |   | > | - |-. |}}
{{chart2 |   |   |MOM| t |DAD|   |DSY|MOM=Mom|DAD=Dad|DSY=[[Aunt Daisy]]}}
{{chart2 |   | .-| - | + | - |-. |   |   |}}
{{chart2 |   |JOE|   | ME|   |SIS|   |   |JOE=My brother Joe|ME='''Me!'''|SIS=My little sister}}
{{chart2/end}}

Produces this:

Grandma
Grandpa
Mom
Dad
Aunt Daisy
My brother Joe
Me!
My little sister

Parameters

ред.

The Chart2 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 content.

  • Tiles are line drawing symbols consisting of horizontal and vertical lines and various corners and crossings thereof. Tiles are specified using three-character combinations that more or less approximate the shape of the tile in appearance. A special case of a tile is the empty tile, specified by three spaces. A table of supported tiles is given below.


Straight lines:
 ! 
 
 
!  
 
 
  !
 
 
! !
 
 
!!!
 
 
!! 
 
 
 !!
 
 
 - 
 
 
 " 
 
 
 _ 
 
 
 : 
 
 
 3 
 
 
 6 
 
 
 9 
 
 
Corners:
 .-
 
 
-. 
 
 
 '-
 
 
-' 
 
 
 .'
 
 
'. 
 
 
 '.
 
 
.' 
 
 
 -'
 
 
'- 
 
 
 -.
 
 
.- 
 
 
.-'
 
 
'-.
 
 
Double/Mixed lines:
 ~ 
 
 
 ~!
 
 
!~ 
 
 
!~!
 
 
 t 
 
 
 t!
 
 
!t
 
 
!t!
 
 
 ~.
 
 
.~ 
 
 
!~.
 
 
.~!
 
 
Intersections:
 ^ 
 
 
 v 
 
 
 < 
 
 
 > 
 
 
 i 
 
 
 T 
 
 
 -!
 
 
!- 
 
 
 + 
 
 
!-!
 
 
 I 
 
 
!v!
 
 


  • Content can contain arbitrary wiki markup. Content is specified using additional named parameters appended to the template call. Each box is one tile wide and normally has no border. Content can have any name that is a valid template parameter name, although punctuation characters should be avoided to prevent conflicts with tile symbols.

Style attributes

ред.

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:

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

produces a result like this:

Box 1
Box 2
Box 3
Box 4

Style attributes can even be set for individual boxes, as in the example below:

{{chart2/start}}
{{chart2 |   |   |WHI|   |   |WHI=White box}}
{{chart2 | .-| - | + | - |-. |}}
{{chart2 |RED| ~ |GRE| ~ |BLU|RED=Red box|GRE=Green box|BLU=Blue box
|boxstyle_RED=background-color: #faa;
|boxstyle_GRE=background-color: #afa
|boxstyle_BLU=background-color: #aaf;
}}
{{chart2/end}}

which produces the output:

White box
Red box
Green box
Blue box

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

Content width

ред.

The width of a content area can be varied to improve the appearance of the table, by using the width_NAME parameter for any content area.

See also

ред.