| 136 | | == How to use `#!td` and other table related processors == #Tables |
| 137 | | |
| 138 | | `#!td` or `#!th` processors are actually the main ones, for creating table data and header cells, respectively. The other processors `#!table` and `#!tr` are not required for introducing a table structure, as `#!td` and `#!th` will do this automatically. The `|-` row separator can be used to start a new row when needed, but some may prefer to use a `#!tr` block for that, as this introduces a more formal grouping and offers the possibility to use an extra level of indentation. The main purpose of the `#!table` and `#!tr` is to give the possibility to specify HTML attributes, like ''style'' or ''valign'' to these elements. |
| 139 | | |
| 140 | | ||= Wiki Markup =||= Display =|| |
| 141 | | {{{ |
| 142 | | #!td |
| 143 | | {{{ |
| 144 | | Simple 2x2 table with rich content: |
| 145 | | {{{ |
| 146 | | #!th align=left |
| 147 | | - Left |
| 148 | | - Header |
| 149 | | |
| 150 | | }}} |
| 151 | | {{{ |
| 152 | | #!th align=left |
| 153 | | - Right |
| 154 | | - Header |
| 155 | | |
| 156 | | }}} |
| 157 | | |---------------------------------- |
| 158 | | {{{ |
| 159 | | #!td style="background: #ffd" |
| 160 | | - Left |
| 161 | | - Content |
| 162 | | |
| 163 | | }}} |
| 164 | | {{{ |
| 165 | | #!td style="vertical-align: top" |
| 166 | | !RightContent |
| 167 | | |
| 168 | | }}} |
| 169 | | |---------------------------------- |
| 170 | | || ... and this can be mixed||\ |
| 171 | | ||with pipe-based cells || |
| 172 | | {{{ |
| 173 | | #!td colspan=2 |
| 174 | | Pick the style the more appropriate |
| 175 | | to your content |
| 176 | | |
| 177 | | See WikiFormatting#Tables for details |
| 178 | | on the pipe-based table syntax. |
| 179 | | |
| 180 | | }}} |
| 181 | | |
| 182 | | If one needs to add some |
| 183 | | attributes to the table itself... |
| 184 | | |
| 185 | | {{{ |
| 186 | | #!table style="border:none;text-align:center;margin:auto" |
| 187 | | {{{ |
| 188 | | #!tr ==================================== |
| 189 | | {{{ |
| 190 | | #!th style="border: none" |
| 191 | | Left header |
| 192 | | |
| 193 | | }}} |
| 194 | | {{{ |
| 195 | | #!th style="border: none" |
| 196 | | Right header |
| 197 | | |
| 198 | | }}} |
| 199 | | |
| 200 | | }}} |
| 201 | | {{{ |
| 202 | | #!tr ==== style="border: 1px dotted grey" |
| 203 | | {{{ |
| 204 | | #!td style="border: none" |
| 205 | | 1.1 |
| 206 | | |
| 207 | | }}} |
| 208 | | {{{ |
| 209 | | #!td style="border: none" |
| 210 | | 1.2 |
| 211 | | |
| 212 | | }}} |
| 213 | | |
| 214 | | }}} |
| 215 | | {{{ |
| 216 | | #!tr ==================================== |
| 217 | | {{{ |
| 218 | | #!td style="border: none" |
| 219 | | 2.1 |
| 220 | | |
| 221 | | }}} |
| 222 | | {{{ |
| 223 | | #!td |
| 224 | | 2.2 |
| 225 | | |
| 226 | | }}} |
| 227 | | |
| 228 | | }}} |
| 229 | | |
| 230 | | }}} |
| 231 | | |
| 232 | | |
| 233 | | |
| 234 | | }}} |
| 235 | | }}} |
| 236 | | {{{ |
| 237 | | #!td valign=top |
| 238 | | Simple 2x2 table with rich content: |
| 239 | | {{{ |
| 240 | | #!th align=left |
| 241 | | - Left |
| 242 | | - Header |
| 243 | | }}} |
| 244 | | {{{ |
| 245 | | #!th align=left |
| 246 | | - Right |
| 247 | | - Header |
| 248 | | }}} |
| 249 | | |---------------------------------- |
| 250 | | {{{ |
| 251 | | #!td style="background: #ffd" |
| 252 | | - Left |
| 253 | | - Content |
| 254 | | }}} |
| 255 | | {{{ |
| 256 | | #!td style="vertical-align: top" |
| 257 | | !RightContent |
| 258 | | }}} |
| 259 | | |---------------------------------- |
| 260 | | || ... and this can be mixed||\ |
| 261 | | ||with pipe-based cells || |
| 262 | | {{{ |
| 263 | | #!td colspan=2 |
| 264 | | Pick the style the more appropriate |
| 265 | | to your content |
| 266 | | |
| 267 | | See WikiFormatting#Tables for details |
| 268 | | on the pipe-based table syntax. |
| 269 | | }}} |
| 270 | | |
| 271 | | If one needs to add some |
| 272 | | attributes to the table itself... |
| 273 | | |
| 274 | | {{{ |
| 275 | | #!table style="border:none;text-align:center;margin:auto" |
| 276 | | {{{ |
| 277 | | #!tr ==================================== |
| 278 | | {{{ |
| 279 | | #!th style="border: none" |
| 280 | | Left header |
| 281 | | |
| 282 | | }}} |
| 283 | | {{{ |
| 284 | | #!th style="border: none" |
| 285 | | Right header |
| 286 | | |
| 287 | | }}} |
| 288 | | |
| 289 | | }}} |
| 290 | | {{{ |
| 291 | | #!tr ==== style="border: 1px dotted grey" |
| 292 | | {{{ |
| 293 | | #!td style="border: none" |
| 294 | | 1.1 |
| 295 | | |
| 296 | | }}} |
| 297 | | {{{ |
| 298 | | #!td style="border: none" |
| 299 | | 1.2 |
| 300 | | |
| 301 | | }}} |
| 302 | | |
| 303 | | }}} |
| 304 | | {{{ |
| 305 | | #!tr ==================================== |
| 306 | | {{{ |
| 307 | | #!td style="border: none" |
| 308 | | 2.1 |
| 309 | | |
| 310 | | }}} |
| 311 | | {{{ |
| 312 | | #!td |
| 313 | | 2.2 |
| 314 | | |
| 315 | | }}} |
| 316 | | |
| 317 | | }}} |
| 318 | | }}} |
| 319 | | }}} |
| 320 | | |
| 321 | | Note that by default tables are assigned the "wiki" CSS class, which gives a distinctive look to the header cells and a default border to the table and cells (as can be seen for the tables on this page). By removing this class (`#!table class=""`), one regains complete control on the table presentation. In particular, neither the table, the rows nor the cells will have a border, so this is a more effective way to get such an effect than having to specify a `style="border: no"` parameter everywhere. |
| 322 | | |
| 323 | | {{{ |
| 324 | | #!table class="" |
| 325 | | ||= Wiki Markup =||= Display =|| |
| 326 | | {{{ |
| 327 | | #!td |
| 328 | | {{{ |
| 329 | | {{{ |
| 330 | | #!table class="" |
| 331 | | || 0|| 1|| 2|| |
| 332 | | || 10|| 20|| 30|| |
| 333 | | || 11|| 22|| 33|| |
| 334 | | ||||||= numbers =|| |
| 335 | | |
| 336 | | }}} |
| 337 | | |
| 338 | | }}} |
| 339 | | |
| 340 | | }}} |
| 341 | | {{{ |
| 342 | | #!td |
| 343 | | {{{ |
| 344 | | #!table class="" |
| 345 | | || 0|| 1|| 2|| |
| 346 | | || 10|| 20|| 30|| |
| 347 | | || 11|| 22|| 33|| |
| 348 | | ||||||= numbers =|| |
| 349 | | |
| 350 | | }}} |
| 351 | | |
| 352 | | }}} |
| 353 | | }}} |
| 354 | | |
| 355 | | Other classes can be specified as alternatives (remember that you can define your own in [TracInterfaceCustomization#SiteAppearance site/style.css]). |
| 356 | | |
| 357 | | ||= Wiki Markup =||= Display =|| |
| 358 | | {{{ |
| 359 | | #!td |
| 360 | | {{{ |
| 361 | | {{{ |
| 362 | | #!table class="listing" |
| 363 | | || 0|| 1|| 2|| |
| 364 | | || 10|| 20|| 30|| |
| 365 | | || 11|| 22|| 33|| |
| 366 | | ||||||= numbers =|| |
| 367 | | |
| 368 | | }}} |
| 369 | | |
| 370 | | }}} |
| 371 | | }}} |
| 372 | | {{{ |
| 373 | | #!td |
| 374 | | {{{ |
| 375 | | #!table class="listing" |
| 376 | | || 0|| 1|| 2|| |
| 377 | | || 10|| 20|| 30|| |
| 378 | | || 11|| 22|| 33|| |
| 379 | | ||||||= numbers =|| |
| 380 | | |
| 381 | | }}} |
| 382 | | }}} |
| 383 | | |
| 384 | | |
| 385 | | == HTML comments == |
| 386 | | HTML comments are stripped from the output of the `html` processor. To add an HTML comment to a wiki page, use the `htmlcomment` processor (available since 0.12). For example, the following code block: |
| 387 | | ||= Wiki Markup =|| |
| 388 | | {{{ |
| 389 | | #!td |
| 390 | | {{{ |
| 391 | | {{{ |
| 392 | | #!htmlcomment |
| 393 | | This block is translated to an HTML comment. |
| 394 | | It can contain <tags> and &entities; that will not be escaped in the output. |
| 395 | | |
| 396 | | }}} |
| 397 | | |
| 398 | | }}} |
| 399 | | }}} |
| 400 | | |--------------------------------------------------------------------------------- |
| 401 | | ||= Display =|| |
| 402 | | {{{ |
| 403 | | #!td |
| 404 | | {{{ |
| 405 | | <!-- |
| 406 | | This block is translated to an HTML comment. |
| 407 | | It can contain <tags> and &entities; that will not be escaped in the output. |
| 408 | | --> |
| 409 | | |
| 410 | | }}} |
| 411 | | }}} |
| 412 | | |
| 413 | | Please note that the character sequence "--" is not allowed in HTML comments, and will generate a rendering error. |
| | 48 | Results in: |
| | 49 | Hello [[span(''WORLD'' (click [#world-anchor here]), style=color: green; font-size: 120%, id=world-anchor)]]! |