WikiDB/Data types

From TestWiki
< WikiDB
Revision as of 20:00, 1 December 2006 by HappyDog (Talk | contribs) (Added missing types)

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.

wikistring

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

This is a literal text string.

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

integer

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

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

  • 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

A link to a page in the Image: namespace.

  • Options: none
  • Validation: All values are valid.
  • Formatting: Wraps in wiki braces, if not already present. Adds colon to turn image into a link, rather than an in-line image, if not already present. For example "Image:My pic.jpg" becomes "[[:Image:My pic.jpg]]"

TODO: Should output the image as a thumnail rather than a link. Options would define the thumbnail size, with sensible defaults if omitted.

currency

A currency value. This is currently pretty broken, and only partially implemented. Do not use. This type will probably be removed from the final release (though it could be re-added via a user-defined type).