Difference between revisions of "WikiDB/Data types"

From TestWiki
Jump to: navigation, search
(Updated image, removed redundant currency as it is now removed from the code base)
(+ link to tutorial)
Line 1: Line 1:
 
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.
 
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:''' [[WikiDB/Tutorial: Creating your own data type|Tutorial: Creating your own data type]]
  
 
== wikistring ==
 
== wikistring ==

Revision as of 21:57, 4 September 2012

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

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: 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.