Moinmoin notes

From Helpful
Jump to: navigation, search
This hasn't been updated for a while, so could be outdated (particularly if it's about something that evolves constantly, such as software).

Moinmoin is a python, file-backed, CGI-style wiki.

Class ref


Overview / pluggable parts

Action

Each client request results in an action, which works page-wide (or even wiki-wide). The usual action is a simple page view, i.e. parsing as wikitext and producing HTML. Others include:

  • highlighting, diff with another version, spellcheck, viewing raw markup, and also
  • editing, attaching, deleting,
  • bookmarking, creating recent-changes RSS, listing all pages, and more.

See also [1].

Parser and formatter

The parser parses the wiki markup and calls functions on the formatter object.

Parser

A parser would not necessarily be too interesting, except that it supports embedded sections that declare they want to be parsed by a specific parser which you write, which can therefore work on any markup/syntax. They look like:

{{{#!ParserName arguments=7 are=2 anything=goes on the same line
   data starts on the next line
}}}

This implies use of a parser in plugins/parser/Parsername.py. Arguments can be fetched via kw,get('format_args'). If you expect only var=val pairs, you can parse them with wikiutil.parseAttributes(self.request,kw.get('format_args'))


Parsers parse things like ReST (rst, see [2], [3]) which is a somewhat simpler alternative to moinmoin wiki markup, and can also be used to syntax-highlight C++, java, python, or put IRC logs in a table, or format CSV or variable-value pairs data, often as a table, or show docbook as HTML. Slightly scarier uses are interfaces to show source stored somewhere on the filesystem, an interface to gnuplot, and wrappers that pipe things to commands or even copy files to a temporary directory.


A parser can contain any code, so is it is possible to have a page do nothing more than call a parser, which e.g. prints all page names or so - you have a fairly sensible codebase at your disposal.

Formatter

A formatter is the step between logical units and write()-ing strings to a CGI response. The parser calls formatter functions like e.g. pagelink(), text(), attachment(), code(), big(), image(), smiley(), table(), etc.

The default formatter produces HTML. Alternatives include docbook, wordml, latex, and others, but tend to be a little experimental.


See also [4].

Macro

Macros are system functionality that can be entered to add things to the page, such as a full-text search box using [[FullSearch]]. (In mediawiki these would be called templates)

Macros are similar to parsers in a way, looks simpler to code, and a bunch less flexible.

See also [5].

Themes

Themes seem to be based very feavily on stylesheets, usually CSS, and a few images. You can also use code (for, uh, something), but it is suggested you avoid this.