Module
See the technical documentation, or download.
posted January 6, 2011; updated June 18, 2011
Components
The SimpleWiki module consists of the following components:
shells
- simplewiki.php
- simplewiki_parser.php
- simplewiki_emitter.php
- simplewiki_docnode.php
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('classes/' . strtolower($class_name) . '.php');
}
and call simplewiki like this:
$wiki = new 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 {
...
}
Then overwrite the calling class shell file, simplewiki.php.
simplewiki.php as installed reads:
<?php
class SimpleWiki extends Muster_SimpleWiki {}
Change that to read:
<?php
class SimpleWiki extends MySimpleWiki {}
Your MySimpleWiki class will then in turn invoke Muster_SimpleWiki.
Follow an analagous method for the other classes.
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
- 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.