Difference between revisions of "WikiDB/Data types"

From TestWiki
Jump to: navigation, search
(Added missing types)
(Updated image, removed redundant currency as it is now removed from the code base)
Line 42: Line 42:
 
A link to a page in the Image: namespace.
 
A link to a page in the Image: namespace.
  
* '''Options:''' none
+
* '''Options:''' width, height
 
* '''Validation:''' All values are valid.
 
* '''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 <nowiki>"Image:My pic.jpg" becomes "[[:Image:My pic.jpg]]"</nowiki>
+
* '''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.
 
+
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).
+

Revision as of 03:41, 16 January 2008

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