Open main menu

Extension:PropertyTable2

MediaWiki extensions manual
OOjs UI icon advanced.svg
PropertyTable2
Release status: stable
Implementation Tag, Parser function
Description Outputs a table with keys and values.
Author(s) Fernando Correia, Giuseppe Briotti
Latest version 1.2.0-GB (2007-12-27)
MediaWiki 1.8, 1.9, 1.10, 1.13, 1.15
License No license specified
Download PropertyTable2.php (<1.16), PropertyTable2.php (1.17)
Translate the PropertyTable2 extension if it is available at translatewiki.net
Check usage and version matrix.

Contents

IntroductionEdit

 
Sample of property table created by the PropertyTable2 extension.

PropertyTable2 is an extension to MediaWiki that outputs a table of keys and values (titles and descriptions, or fields and contents). This extension is based on the original work of Fernando Correia PropertyTable and extends the behaviour introducing the concept of key-value pairs group.

Its purpose is to make it easier to create simple tables with a predefined style.

The version number 1.2.0 is related to the corresponding version of the original PropertyTable.

At the moment, this extension doesn't work with MW 1.16.0 and above. Working on updating the code, in the meanwhile I provided a small snippet that works on MW 1.17 and should work on 1.16 too.

FeaturesEdit

  • Simple syntax.
  • Customizable style.
  • Optional auto numbering.
  • Grouping of key-value pairs.

InstallationEdit

  1. Download PropertyTable2.php and save it in the extensions directory of your wiki.
  2. Insert these lines in the LocalSettings.php file:
// Activate PropertyTable extension
include_once('extensions/PropertyTable2.php');


ConfigurationEdit

Customizing the visual styleEdit

It works like PropertyTable extension, thus:

There are two ways to customize the appearance of the generated table: HTML and CSS.

  • HTML: To change the HTML attributes, add these lines to LocalSettings.php, below the reference to PropertyTable2.php, and edit them according to your needs:
// HTML attributes of the table tag
$wgPropertyTable2Attributes = 'class="property_table" border="0" cellpadding="2" cellspacing="4"';
// HTML attributes of key cells
$wgPropertyTable2KeyAttributes = 'class="property_key_cell" valign="top" bgcolor="#E8F3FF" style="font-weight: bold"';
// HTML attributes of value cells
$wgPropertyTable2ValueAttributes = 'class="property_value_cell" valign="top" bgcolor="#F3F3F3"';
  • CSS: One simple way to change CSS properties in recent releases of MediaWiki is by editing the MediaWiki:Common.css page on your wiki. The default CSS classes are property_table, property_key_cell and property_value_cell.

TranslatingEdit

The tag used by the extension can be translated. The default English tag is <properties>.

To add another translation, change the section Internationalized messages in the PropertyTable.php source code file.

Please post your translation on the discussion page so other people can use it!

UsageEdit

Basic usageEdit

  • Within the extension tag (<properties> by default), add a line of text for each line you want on the table.
  • Separate the key from the value using an "=" sign.
  • You can use wiki markup in the keys and in the values.

For instance,

== Meeting information ==
<properties>
Id=01/2007
Title=First monthly meeting
Place=[http://en.wikipedia.org/wiki/Chicago Chicago]
Date=Jan 10, 2007
Time='''9am''' to '''11am'''
</properties>

Produces:

 

Grouping key-value pairsEdit

You can group key-value pairs under same title using the reserved key name @title. The following tag:

<properties>
@title=Qualità
Abilità=12
Coraggio=7
Classe=15
@title=Dati Fisici
Resistenza=10
Velocità=0,25
En. Vitale=40
Costituzione=30
@title=Combattimento
Attacco=12
Parata=0
@title=Armamento
Impatto=1D6+3
Protezione=0
</properties>

Produces:

 


Automatic numberingEdit

You can also produce formatted tables with automatic numbering, using the "#" character. For example:

<properties>
#=first<br>line
#=second line
#=third line
</properties>

Produces:

 

Automatic sequence with lettersEdit

Alternative, you can use the "@" character to have automatic increments using letters. For example:

<properties>
@=alfa
@=beta
@=gamma
@=delta
</properties>

Produces:

 

Using in templatesEdit

If you want to create property tables inside templates using parameters, you'll need to use the parser function form of the PropertyTable extension.

For instance, create a Template:Test page like this:

{{#properties:
Document Id={{{1}}}
Document Type={{{2}}}
Document Status={{{3}}}
Last Review={{{4}}}
Review Period={{{5}}} Days
}}

Then use it in another page, like this:

{{Test|A1234-X|98|Pending|2007-06-27|60}}

The result will be:

 

To DoEdit

  • a simple key-value pairs, say @CSSClass=myclass, to allow a style for each single table in a wiki

AlternativesEdit

FeedbackEdit

Use the discussion page for feedback, questions, feature requests and bug reports.

Sites using this extensionEdit