WikiDB/Data types

From TestWiki
< WikiDB
Revision as of 22:21, 4 September 2012 by HappyDog (Talk | contribs) (string: clarify)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The following data types are handled natively by the WikiDB extension. The extension also has a mechanism for adding 3rd party data types, so the type system is fully extensible. If a field is untyped, WikiDB will attempt to guess the type using a system which works even for user-defined types.

See also: Tutorial: Creating your own data type

wikistring[edit]

This is a text string that will be parsed as wikitext when displayed. This is the default type for any fields that don't conform to a more specific type.

  • Options: none
  • Validation: All values are valid
  • Formatting: none (except the automatic formatting done by MediaWiki)

string[edit]

This is a literal text string. It differs from a wikistring value in two ways: Firstly, you can specify a length restriction; and secondly, it will be escaped and rendered literally (i.e. any wiki markup in the string will have no effect on the output).

  • Options: max_length
  • Validation: All values are valid
  • Formatting: Truncated according to max_length and wrapped in <nowiki> tags.

integer[edit]

An integer number. The alias int is also allowed.

  • Options: min_value, max_value
  • Validation: Must be numeric, must be within range
  • Formatting: Non-integer values are rounded. No decimal point is displayed.

number[edit]

A real number or integer.

  • Options: min_value, max_value
  • Validation: Must be numeric, must be within range
  • Formatting: Always has a number before and after decimal point (.5 => 0.5, 5. => 5.0). Trailing zeros after the decimal point are removed (5.400 => 5.4). Integers without decimal point are unchanged (5.0 => 5.0, 5 => 5).

link[edit]

  • Options: none
  • Validation: All values are valid
  • Formatting: Wraps in wiki braces, if not already present. Adds colon to beginning if the link is to the Image: or Category: namespace, if not already present. For example "Main Page" becomes "[[Main Page]]", and "[[Category:Fish]]" becomes "[[:Category:Fish]]".

image[edit]

A link to a page in the Image: namespace.

  • Options: width, height
  • Validation: All values are valid.
  • Formatting: Outputs the image as a small thumbnail, whose size is restricted by the width and height options (if not present, they default to 75px). Images smaller than the specified size are not scaled up.