Quick Look at Infogami
There are 2 kinds of types in infogami. Primitive types and Compound Types. Primitive types are for representing integers, strings etc.
Available primitive types are:
type/int type/boolean type/string - for single line text type/text - for multiline text
Compound types specify what properties a thing of that type must have.
Available compound types are:
Type for representing all types. It defines the following properties. description of type type/text - description of type is_multiple of type type/boolean - to distinguish between primitive and compound types properties of type type/property - set of properties a thing of this type can have. Can have multiple values. backreferenes of type type/backreference - set of backreferences a thing of this type can have. Back-references are explained later in this document. This property also can have multiple values.
Type for representing properties in a type. It defines the following properties. name of type type/string - name of the property type of type type/type - expected type of the value is_unique of type type/boolean - can this type have multiple values? description of type type/string - readable description of this property
Type for wiki pages. It defines the following properties.
title of type type/string - title of the page body of type type/text - body of the page
type/template Type for template pages. It defines the following properties.
title of type type/string - title of the template body of type type/text - body of the template
Other primitive and compound type can be added by creating a page in the wiki with type type/type.
Some times you might want to link 2 different types. For example, book type has author property and you want to add a books field to the author, which contains all books where author property of the book is this author. This is achieved by adding a backreference to the author type.
Infogami uses templates to render the web site. Custom templates can be provided in the wiki to customize the look and feel.
There are 2 kinds of templates. Regular templates and type-specific templates. Type-specific templates are used to render a wiki page based on its type.
regular templates must be placed at path templates/ and end with .tmpl extension.
type-specific templates must be placed at type/
There can be 4 type-specific templates for every type.
- view.tmpl - Template to specify how to view a page
- edit.tmpl - Template to specify how to edit a page
- repr.tmpl - Template to specify how objects of this type appear when viewing pages of other types which has a property of this type.
- input.tmpl - Template to specify how objects of this type appear when editing pages of other types which has a property of this type.
How repr and input templates are used is explained later in this document.
It is not compulsory to specify all these templates for every type. When a type-specific template is not specified for a type, a default template is used. The following are the default templates:
templates/default_view.tmpl templates/default_edit.tmpl templates/default_repr.tmpl templates/default_input.tmpl
There are many other interesting regular templates. Some of them are:
templates/site.tmpl - to specify the overall look and feel of the site. templates/diff.tmpl - to specify diff between 2 versions of a page is displayed. ...
Macros are like functions in any programming language. Macros look very much like templates, but they can be called from wikipages and other templates and macros.
Macros can be written in the wiki just like templates. Macros must be placed in macros/ path and type must be type/macro. As a convention, they are named in CamelCase.
The syntax to call a macro from a wiki page is: asdfghjjkl1qwertyuiop or asdfghjjkl0qwertyuiop
Calling a macro from templates and macros looks like this: $:macros.HelloWorld() and $:macros.MyMacro("arg1", "arg2")
There are some useful macros, which are very handy in writing view and edit templates.
thingrepr(value, type) This calls repr template of the specified type with value as argument.
thinginput(type, name, value) This calls input template of the specified type with value, name as arguments.
Lets take an example. Suppose there are many types, which need to display an image. Probably they will do that by defining a type type/image for representing images. Instead of worrying how to display and edit (upload) images, these types can just use thingrepr and thinginput macros and define repr and input templates for type/image. Later in future, if you want to change how to display/upload image, you don't have to go and change in multiple places.