Home of
info@simplewiki.org
- comments
- suggestions

join the forum

SimpleWiki Extensions

posted November 21, 2009

Overview

There are a number of ways to extend the SimpleWiki Markup Language. Indeed the SimpleWiki Module includes many native extensions.

Extension Method Applies to Description
Style Classes decorators, declarations any appropriate class (as made available through .css files) can be passed to the underlying object's class attribute
Style rules decorators, declarations any appropriate style rule can be passed to the underlying object's style attribute
Attributes decorators, declarations Any appropriate attribute can be passed to the underying object
Method Classes decorators, declarations Class names trigger calls to registered client callback functions before emitting, which can then emit interesting html, or perform operations on the parsed document object model. The SimpleWiki module currently provides several of these, notably the span decorator method class footnote
Macros client source code - PHP Macros must be provided and registered by client source code - PHP. The SimpleWiki module currently provides the quicktoc macro
Symbolic Links links, images format: [[Symlink:selector | ... ]] or {{Symlink:selector | ... }}. Client software registers symlinks, or provides a callback routine to look them up
Events client source code - PHP The SimpleWiki module currently defines two events: onemit and onafteremit

Style Classes

A number of commonly used style classes are provided with the implementation module in SimpleWiki.css (Native Style Classes).

In addition websites can (and should) provide their own. We list the classes we have for this website in This Website's Custom Style Classes.

Native Style Classes

Usage Selector Notes
General Style Classes
any element .hide hides the element
Span Style Classes
%s ...% span.underline
span.overline
span.strikeout
span.larger
span.smaller
span.mono
Block Divider
|:b ...:| div.divider uses clear:both to restart content space
div.spacer same as div.divider, but adds about a line of blank height
.fence,.dashes to combine with divider or spacer - dashed line
.dots to combine with divider or spacer - dots
.line to combine with divider or spacer - solid line
Image Frame
%i rframe% or (:div rframe:) div.rframe position the div to the right
rframe and lframe are method classes div.lframe position the div to the left
div.frame frame decoration for image or div
quicktoc
div#quicktoc-platform position:relative
div#quicktoc-header position:absolute, appearance
div#quicktoc-caption padding, cursor shape
div#quicktoc-body appearance, display
div#quicktoc-body ul bottom margin
div.quicktoc-open display - used by javascript
div.quicktoc-closed display - used by javascript
footnote
div.footnoteblock available for client use

This Website's Custom Style Classes

Here are the style classes for this website, as defined in the site's main css (cascading style sheet) file.

Element Classname Notes
General Purpose
any page-break pagebreak after element for printing
frame paints a frame around an element
posting small font, bright color, nor markin
compact removes top and bottom margins
shadow-outer appears outset
shadow-inner appears inset
hot red bold
highlight
center
Images
img image-inline vertical align center
image-bordered
image-bordered-left
image-bordered-right
image-left
image-right
Headings
any (for headings) subtitle
section-divider-high
section-divider-mid
section-divider-low
section-major
divider-minor
subtitle
Content Blocks
blockquote document-block dashed border, indented
announce-block solid border, yellow background
letter indented left and right, right border
div text-block div configuration of paragraph, to allow contained blocks
Sidebars
div sidebar
sidebar-left-narrow
sidebar-left-medium
sidebar-left-wide
sidebar-right-narrow
sidebar-right-medium
sidebar-right-wide
sidebar-narrow
sidebar-medium
sidebar-wide
sidebar-left
sidebar-right
sidebar-technical
sidebar-menucolumn
Crossbars
div crossbar
crossbar-high
crossbar-mid
crossbar-low
Image boxes
div imagebox
imagebox-left
imagebox-right
Tables -- Standard and Numeric
tr zebraodd
zebraeven
table standard
numeric
table.standard caption
table.numeric caption
table.standard td
table.numeric td
table.standard th
table.numeric th
table.standard th head-name
column-head
foot-name
column-foot
table.standard td name
table.numeric th head-name
column-head
foot-name
column-foot
table.numeric td name
data
Tables -- Pictureboard and Storyboard
table storyboard bordered cells, left-aligned text
pictureboard bordered cells, centered text
Tables -- News columns
table columns 2 columns
table columns3 3 columns
table columns4 4 columns
table.columns td
table.columns3 td
table.columns4 td
Anchor
a:link change in appearance
a:hover same
a:visited same
a:active same
a.native:link no change in appearance
a.native:hover same
a.native:visited same
a.native:active same

Style Rules

Any appropriate style rules in the format rulename:rulevalue can be added to any decorator or block declaration argument.[1]

Attributes

Any appropriate attribute in the format atributename=attributevalue can be added to any decorator or block declaration argument. Single or double quote delimiters can be added to attributevalue in order to group values containing spaces. If no quotes are used then SimpleWiki adds them during html emitting.[2]

Method Classes

Method classes are software processes that modify the underlying HTML in some way. More can be added by client software (see Module for details). Here are the method classes defined natively for SimpleWiki:

Element Classname Effect
Span
%s subscript% subscript change span element to sub element
%s superscript% superscript change span element to sup element
%s footnote% footnote create a footnote, with on-page sequentially numbered links to and from the footnote
Link
%i newwin% newwin open the following link in a new window
Image
%i lframe% lframe wrap the image in a div and float left
%i rframe% rframe wrap the image in a div and float right
Paragraph
|:p nop:| nop (no paragraph) prevents generation of enclosing paragraph html tags
|:p div:| div creates an enclosing div element instead of paragraph element
Block Declaration
(:div lframe:) lframe create frame appearance and float left
(:div rframe:) rframe create frame appearance and float right
Preformatted
|:pre html:|{{{ html contents of preformatted block treated as HTML
%c html%{{{ html contents of inline preformatted text treated as HTML

Macros

Macros have to be written and registered by client software. Simplewiki provides one macro - quicktoc - which generates a page table of contents from page headings.

Macro syntax is

<<macroname arguments | parsed-inline-markup>>

The macroname is required, but arguements and parset-inline-markup are optional (depending on the requirements of the macro).

For quicktoc, there are no arguments. parsed-inline-markup, if provided, is used as the table of contents header (otherwise the caption "Table of contents" is used).

Symbolic links are one of the ways to referece links or images (see Symbolic Links in the language definition). The format is:

Symlink:selector

Two symlinks are predefined: Local and Anchor, and both, by default are empty. Local is provided for relative directory addressing. Anchor is provided for on-page links ([[#anchorname|anchor text]]). Either can be over-ridden by the client software.

Client software can register its own symbolic links, or indeed a callback function to lookup value for any symbolic link used by authors. See Module for details.

Events

There are currently two events defined by SimpleWiki: onemit and onafteremit. These are for specialized requirements. For example SimpleWiki provides a method that can be registered with onemit to automatically generate quick tables of content for all pages (see Module for details). The footnote method class uses the onafteremit event to generate footnotes at the end of a document.


Footnotes: