Inheritance

ProWiki | RecentChanges | Preferences

Previous: Display Templates

Okay, last step. While display templates allow you to relate the formatting of different pages, they don't really relate the pages themselves. You do that with inheritance.

ProWiki is a (very simplistic) prototype-structured object-oriented environment. A given page can declare itself to have a parent, and inherits properties from its parent. At the moment, it does this only in a very simple way: if a property isn't defined on the page itself, lookups for that property will try the parent. And the parent's parent, and so on up the chain.

(In the long run, I plan to enhance ProWiki to make multi-valued queries additive -- that is, when you get a property list, it returns all of the values on this page and all the values on all of the parents. But I don't have an immediate need for that, and hit some syntax snags trying to get the lists to combine properly in Perl, so I've put that off until later.)

Anyway, you declare a page's parent with the "IS_A" property, like this:

{{IS_A=ExampleParentPage?}}

In practice, one generally uses IS_A with structured data -- pages that just contain properties. The parent page should usually contain a DISPLAY_TEMPLATE property, so that all pages of the same type will render the same.

At the moment, that's all there is to inheritance, but more is planned. Besides the property-list enhancements mentioned above, I also expect to introduce a concept of alternate display templates -- for my LARPs, I want pages to look one way when I'm editing them in the wiki, and quite another when I'm printing off final copies to run the game. By structuring my data, defining properties and relationships and putting the rendering off to display templates, I have great flexibility to tweak and tune the whole system easily.

Again, for examples of inheritance, check out The LARP Schema.

Next: Advanced Page Queries


ProWiki | RecentChanges | Preferences
This page is read-only | View other revisions | View source of this page
Last edited May 19, 2005 5:47 pm by Jducoeur
Search:
Edit: