]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FMediawikiTablePlugin
Add information about bordered, boxed and sortable tables
[SourceForge/phpwiki.git] / pgsrc / Help%2FMediawikiTablePlugin
1 Date: Mon, 16 Feb 2009 15:18:24 +0100
2 Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124)
3 X-Rcs-Id: $Id$
4 Content-Type: application/x-phpwiki;
5   pagename=Help%2FMediawikiTablePlugin;
6   flags=PAGE_LOCKED;
7   markup=2;
8   charset=iso-8859-1
9 Content-Transfer-Encoding: binary
10
11 The *~MediawikiTable* [[Help:WikiPlugin|plugin]] allows a user to specify a ##<table>## with (a subset of) the syntax used by Mediawiki.
12 The plugin is not meant to be called directly, just use the syntax below to insert your table.
13
14 == Mediawiki table syntax
15
16 * The table starts with a line <b>{~|</b> and ends with a line <b>|~}</b>.
17 * An optional table caption is made with a line starting with a pipe and a plus sign <b>|+</b> followed by the caption.
18 * An optional table summary is made with a line starting with a pipe and an equal sign <b>|=</b> followed by the summary.
19 * A table row starts with a pipe and a hyphen: <b>|-</b>.
20 * A table cell starts with a pipe on a new line, or a double bar <b>||</b> on the same line.
21 * A header table cell starts with an exclamation mark, or a double exclamation mark <b>!!</b> on the same line.
22
23 The summary syntax is an extension to the Mediawiki syntax. 
24 You can also simply put the summary as an attribute to the table.
25 The summary is necessary to be able to create accessible tables.
26
27 === HTML attributes
28
29 <?plugin RichTable
30 * class="bordered"
31 - style="font-weight:bold;background-color:#d8d8d8;", align=center
32 |
33 Attribute
34 |
35 Syntax
36 -
37 |
38 For the table
39 |
40 {| border="1"
41 -
42 |
43 For the caption
44 |
45 ~|+ style="font-weight: bold;"
46 -
47 |
48 For a row
49 |
50 ~|- style="height:100px"
51 -
52 |
53 For a cell
54 |
55 ~| align="right" | Cell 2 (right aligned)
56 ?>
57
58 The attributes might be put with or without double quotes.
59
60 === Predefined CSS classes
61
62 If you do not specify a class for the table, it will be rendered without border.
63
64 ==== Boxed and bordered tables
65
66 If you specify ##class="boxed"##, you will have a border around the table (but not around the cells).
67
68 If you specify ##class="bordered"##, you will have a border around the table and the cells
69
70 In both cases, the caption (if any) will be bold and centered under the table
71
72 In both cases, the headers (specified by ##!##) will have a ##"#d8d8d8"## background
73
74 ==== Sortable tables
75
76 If you specify ##class="sortable"##, the table columns will be sortable.
77
78 == Examples
79
80 === Example 1: simple table
81
82 {| border="1", style="width: 100%"
83 |+ style="font-weight: bold; font-size: 150%;" | This is the table caption
84 |= This is the table summary
85 |- style="white-space: nowrap"
86 ! Header 1
87 ! Header 2
88 ! Header 3
89 |- style=height:100px
90 | Cell I
91 | <b>Cell II</b>,  in bold
92 |align=right, width="100%" |Cell III
93 |- bgcolor=#f0f0ff, align=center
94 |Cell 1||Cell 2||Cell 3
95 |}
96
97 The above table is rendered from:
98
99 <verbatim>
100 {| border="1", style="width: 100%"
101 |+ style="font-weight: bold; font-size: 150%;" | This is the table caption
102 |= This is the table summary
103 |- style="white-space: nowrap"
104 ! Header 1
105 ! Header 2
106 ! Header 3
107 |- style=height:100px
108 | Cell I
109 | <b>Cell II</b>,  in bold
110 |align=right, width="100%" |Cell III
111 |- bgcolor=#f0f0ff, align=center
112 |Cell 1||Cell 2||Cell 3
113 |}
114 </verbatim>
115
116 === Example 2: table with paragraphs, lists and plugins in cells
117
118 {|
119 |- style="white-space: nowrap"
120 ! Header 1
121 ! Header 2
122 |- bgcolor=yellow
123 | First paragraph.
124
125 Second paragraph.
126 |
127 * One
128 * Two
129 * Three
130 |- bgcolor=#f0f0ff, align=center
131 |Current date || <<CurrentTime format=date>>
132 |}
133
134 The above table is rendered from:
135
136 <verbatim>
137 {|
138 |- style="white-space: nowrap"
139 ! Header 1
140 ! Header 2
141 |- bgcolor=yellow
142 | First paragraph.
143
144 Second paragraph.
145 |
146 * One
147 * Two
148 * Three
149 |- bgcolor=#f0f0ff, align=center
150 |Current date || <<CurrentTime format=date>>
151 |}
152 </verbatim>
153
154 === Example 3: sortable table
155
156 Click on a column header to sort the column.
157 Clicking a second time will reverse the sorting order.
158
159 {| class="bordered sortable"
160 |-
161 ! First name !! Name !! Age
162 |-
163 | John || Smith || 35
164 |-
165 | Albert || Wells || 5
166 |-
167 | Sam || Adam || 102
168 |}
169
170 The above table is rendered from:
171
172 <verbatim>
173 {| class="bordered sortable"
174 |-
175 ! First name !! Name !! Age
176 |-
177 | John || Smith || 35
178 |-
179 | Albert || Wells || 5
180 |-
181 | Sam || Adam || 102
182 |}
183 </verbatim>
184
185 === Example 4: nested tables
186
187 <<MediawikiTable
188 {| class="bordered", align=center
189 |+ Outer table caption
190 |-
191 ! Header A !! Header B
192 |-
193 | A numbered list:
194 # one
195 # two
196 # three
197 |
198 This cell contains a nested table.
199  {| class="bordered"
200  |+ Inner table caption
201  |-
202  ! Header A
203  ! Header B
204  |-
205  | Inner A1
206  | Inner B1
207  |-
208  | Inner A2
209  | Inner B2
210  |}
211 |-
212 | A paragraph
213
214 Another paragraph
215
216 | A plain list:
217 * apple
218 * pear
219 * apricot
220 |}
221 >>
222
223 The above table is rendered from:
224
225 <verbatim>
226 <<MediawikiTable
227 {| class="bordered", align=center
228 |+ Outer table caption
229 |-
230 ! Header A !! Header B
231 |-
232 | A numbered list:
233 # one
234 # two
235 # three
236 |
237 This cell contains a nested table.
238  {| class="bordered"
239  |+ Inner table caption
240  |-
241  ! Header A
242  ! Header B
243  |-
244  | Inner A1
245  | Inner B1
246  |-
247  | Inner A2
248  | Inner B2
249  |}
250 |-
251 | A paragraph
252
253 Another paragraph
254
255 | A plain list:
256 * apple
257 * pear
258 * apricot
259 |}
260 >>
261 </verbatim>
262
263 == Author
264
265 Marc-Etienne Vargenau, Alcatel-Lucent
266
267 == See Also
268 * [[http://meta.wikimedia.org/wiki/Help:Table|Mediawiki table help page]]
269
270 ----
271 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]