Planungskompendium Energieverteilung:Syntax/Tables: Unterschied zwischen den Versionen

Aus Planungskompendium Energieverteilung
Wechseln zu:Navigation, Suche
Keine Bearbeitungszusammenfassung
 
K (1 Version importiert: Syntax pages - exported from PPR-FR)
 

Aktuelle Version vom 7. Dezember 2021, 10:08 Uhr

Overview

General Syntax for simple tables

{{tb-start | id=<table-ID> | num=<figure-number> | title=<figure-title> | cols=<table-standard-max-width> }}
{| class="wikitable"
|-
| ... table syntax as usual here ...
|-
|}

The main specificity compared to usual wiki table = they are not just a table, but a "figure" in this wiki, requiring some complementary specific attributes:

  • a figure number (example: A1 in the example below)
  • a figure title (This is my table title)
  • a table ID (Tab1001 - not visible for visitors)
  • an (optional) parameter to define the (standardized) max width of the table. Used for large screens. (2 in the example)

Syntax with all options

{{tb-start | id=Tab1001 | num=A1 | title=This is my table title | cols=2}}
{| class="wikitable"
|-
! The table
! syntax
! is just
! as usual
|-
| a cell
| you can also add table notes{{tn|A}}
| {{tb-HC1}} | You can also highlight cells - type 1
| {{tb-HC2}} | You can also highlight cells - type 2
|-
|}
{{tb-notes
|A=text of ref note A
|txn1=purely textual note 1}}


Result:

Abb. A1 – This is my table title
The table syntax is just as usual
a cell you can also add table notes[a] You can also highlight cells - type 1 You can also highlight cells - type 2
  • purely textual note 1
  1. ^ text of ref note A
  • the table ID is not visible to visitors, but is used as an html anchor, to make it possible to link to that table. It also uniquely identifies each table (accross languages)
  • it also adds a semantic property to the page where the table is used. This property can be used to search the page where a table is situated
  • table note refs are now active (they use cite reference syntax). Their IDs is now uppercase letters ('A' ... 'Z')


Standard Table, just with a figure title

This is the most common type of table accross the Electrical Installation Wiki.

{{tb-start | id=Tab1001 | num=A1 | title=This is my table title | cols=3}}
{| class="wikitable"
|-
! header
! header
|-
| the table syntax is as usual
| another cell
|-
|}


Result:

Abb. A1 – This is my table title
header header
the table syntax is as usual another cell


Table with table NOTES

{{tb-start | id=Tab1001 | num=A1 | title=Standard voltages | cols=3 }}
{| class="wikitable"
|-
! header
! header{{tn|A}}
|-
| cell{{tn|B}}
| cell
|-
|}
{{tb-notes
|A=text of ref note A
|B=text of ref note B
|txn1=purely textual note 1
|txn2=purely textual note 2}}


Result:

Abb. A1 – Standard voltages
header header[a]
cell[b] cell
  • purely textual note 1
  • purely textual note 2
  1. ^ text of ref note A
  2. ^ text of ref note B


Highlighting cells (sub-heading)

Example

Abb. A1 – table with highlighted cells
header header header
highlighted cell (type 1) highlighted cell (type 1) highlighted cell (type 1)
highlighted cell (type 2) highlighted cell (type 2) highlighted cell (type 2)
standard cell standard cell standard cell

Syntax used to highlight a cell

a normal cell defined as:

| content of the cell

is highlighted with this type of syntax:

| {{tb-HC1}} | content of the cell
| {{tb-HC2}} | content of the cell

It uses 2 templates, tb-HC1 and tb-HC2 for these 2 variants of highlighting styles.

The action of these 2 templates is to add a class to the cell.


TO DO = simplify syntax to highlight complete row

Tested feasibility, idea = use the same template, but on the row definition, eg a syntax like that:

|- {{tb-HC1}}

It requires modifications/additions in CSS to manage it (for borders also !) - TO DO in the future


Standardize the width of tables

There are 4 "standard" widths for tables: 2, 3, 4 and 5.

This numbering is inherited from the book, and corresponds to the number of "A4 page columns" this table is spreading on (in Schneider Electric graphic charter, pages are divided in 5 columns).

why fix the width of tables?

The idea is that, on large screens, tables (and groups of tables in the same page) may look better if we fix their width.

Main arguments for this solution:

  • several "similar" tables in the same wiki page will have the same width
  • tables with some long text in headers / cells tend to be very wide: mediawiki/browsers tend to enlarge related cells, rather than wrapping texts in a shorter cell

Other possible solution (not tested):

  • add a special class + template to force text-wrap in cells with long text (requires modification of content = manually add this info, where needed)

The following examples show the result, for the same table, for the different values of this parameter.

cols = 2 (rarely used)

Abb. A1 – table width = 2cols

Three-phase four-wire or three-wire systems Nominal voltage (V)

Single-phase three-wire systems Nominal voltage (V) + additional text so it works for cols=5

50 Hz 60 Hz 60 Hz
- 120/208 120/240
230 240 -

cols = 3

Abb. A1 – table width = 3cols

Three-phase four-wire or three-wire systems Nominal voltage (V)

Single-phase three-wire systems Nominal voltage (V) + additional text so it works for cols=5

50 Hz 60 Hz 60 Hz
- 120/208 120/240
230 240 -

cols = 4

Abb. A1 – table width = 4cols

Three-phase four-wire or three-wire systems Nominal voltage (V)

Single-phase three-wire systems Nominal voltage (V) + additional text so it works for cols=5

50 Hz 60 Hz 60 Hz
- 120/208 120/240
230 240 -

cols = 5

Abb. A1 – table width = 5cols

Three-phase four-wire or three-wire systems Nominal voltage (V)

Single-phase three-wire systems Nominal voltage (V) + additional text so it works really well for cols=5

50 Hz 60 Hz 60 Hz
- 120/208 120/240
230 240 -

no fixed width

Abb. A1 – table without predefined width

Three-phase four-wire or three-wire systems Nominal voltage (V)

Single-phase three-wire systems Nominal voltage (V) + additional text so it works really well for cols=5

50 Hz 60 Hz 60 Hz
- 120/208 120/240
230 240 -


Table WITHOUT table number/title (NOT RECOMMENDED)

header header
this is a table without figure number/title another cell

Table "legends" (explain significance of colored cells)

to be documented!!

List of Templates and mediawiki messages used for 2020 new tables syntax

  • tb-start, which uses template title, and introduces the table (positioned just before the table)
  • tn, used both in the table content, for table note "calls", and also used inside tb-notes template
  • tb-notes, to add table notes, after a table, if needed
  • tb-HC1 - highlight cells type 1
  • tb-HC2 - highlight cells type 2
  • and for the figure/table acronym "Fig.", uses txt-fig-acronym. At the moment, Tables use the same acronym template as for other figures (drawings). Possible future evolution, if relevant = modify the tb-start template, to use another (new) template for the Table acronym

Also, for the table notes formating, a number of mediawiki msgs have been modified or created (imported):


2016 vs new 2020 table syntax comparison

Syntax "2016" NEW syntax to use
{{TableStart|Tab1001|2col}}
   /* no {| opening tag !
|-
! table syntax
! is missing opening {|
! and closing |} tags
! otherwise as usual
|-
| a cell
| you can also add table notes{{TabRef|Tab1001|a}}
| {{tb-HC1}} | You can also highlight cells - type 1
| {{tb-HC2}} | You can also highlight cells - type 2
|-
   /* no |} closing tag !
{{TableEnd|Tab1001|A1|This is my table title
|A|text of ref note A
||purely textual note 1 with {{=}} in note text}}

{{tb-start | id=Tab1001 | num=A1 | title=This is my table title | cols=2}}
{| class="wikitable"
|-
! table syntax
! is just
! as usual
! 
|-
| a cell
| you can also add table notes{{tn|A}}
| {{tb-HC1}} | You can also highlight cells - type 1
| {{tb-HC2}} | You can also highlight cells - type 2
|-
|}
{{tb-notes
|A=text of ref note A
|txn1=purely textual note 1}}

Main evolutions

  • table syntax is now as usual = includes standard opening / closing tags = now compatible with visual editor: the table can be modified visually
  • table main parameters are now defined in tb-start template (num, title ...)
  • table note refs: are now active (cite ref), no more require table ID, and their ID is now uppercase ('A' ... 'Z')
  • all template parameters are named ==> no more need to "escape" the "=" characters using "="
  • table notes syntax modified, to name the parameters. In particular, purely textual notes have to be numbered: txn1=, txn2= ... And ref noted also require uppercase IDs; |A=, |B= ...

previous templates used in 2016 syntax

TableStart, TableEnd, TabRef, Table HC1, Table HC2