Home of
mail@internetcommons.ca
- comments
- suggestions

join the forum

Module

See the technical documentation, or download.

posted January 6, 2011; updated June 18, 2011

Components

The SimpleWiki module consists of the following components:

source code
  • muster/simplewiki.php
  • muster/simplewiki/parser.php
  • muster/simplewiki/emitter.php
  • muster/simplewiki/docnode.php
css files
  • SimpleWiki.css
javascript
  • jquery.js (see jquery website)
  • SimpleWiki.js
images
  • arrowdown.gif
  • arrowup.gif

Integration

code

Use an autoloader like this:

function __autoload($class_name) {
    include(strtr(strtolower($class_name),'\','/') . '.php');
}

and call simplewiki like this:

$wiki = new Muster\SimpleWiki();

Normally invoke the same instance of SimpleWiki for repetitive parsing:

$html = $wiki->get_html($markup);

html

<script type="text/javascript" src="public/jquery.js"></script>
<script type="text/javascript" src="public/SimpleWiki.js"></script>
<link rel="styleSheet" href="public/SimpleWiki.css" type="text/css" />

images

Place the images in the same directory as the css file.

Extension

Extend SimpleWiki by inserting your subclass into the calling chain.

Place your class extension in a separate php source file (eg. mysimpliwiki.php).

In your source file, extend the native version of the simplewiki code, like this

class MySimpleWiki extends Muster\SimpleWiki {
...
}

To extend other classes you'll have to change the namespace scheme.

Registrations

Many lookups and callouts can be registered with SimpleWiki:

  • register_class_callbacks
  • register_property_callbacks
  • register_symlinks
  • register_symlink_handler
  • register_rawlink_handler
  • register_charfilter_handler
  • register_blockdef_handler (block tags)
  • register_vblockdef_handler (void block tags)
  • register_itagdef_handler (inline tags)
  • register_vtagdef_handler (void inline tags)
  • register_macro_callbacks
  • register_events

Callbacks, handlers, and events are all handed, and expected to return, the $node object which triggered the handler or callout, except the charfilter handler which is handed both the text and the node, and is expected to return the filtered text.

See the technical documentation for the Muster\SimpleWiki\DocNode documentation which lists properties available for each type of node. All nodes have type, parent, and children properties.

digital ocean version