Extension:Wiki Object Model

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
Wiki Object Model

Release status: stable

Implementation API
Description Wiki Object Model (WOM) is a set of classes and API to allow easy and flexible manipulation of wiki page content at a fine granularity, by other extensions, bots, or external programs via API.
Author(s) Ning Hu (dch), Justin Zhang, Jesse Wang (Ningtalk)
Latest version 1.0
MediaWiki 1.13.5 or greater (tested up to 1.15.1)
PHP PHP 5.x or greater installed and working
License GPLv2
Download

Translate the Wiki Object Model extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Wiki Object Model (WOM) is a set of classes and API to allow easy and flexible manipulation of wiki page content at a fine granularity, by other extensions, bots, or external programs via API.

The name and idea is similar to DOM and Page Object Model (POM), but WOM provides greater control and more power. The name shows the similarity of concepts to POM and DOM.

WOM supports various objects that MediaWiki supports, such as Section, Link, Template, Parser Functions, Category, and so on. WOM allows users to identify and access objects via xpath (API) and object hierarchy, and further operate on them.

WOM is an open architecture that anyone can add more functionality into it.

Requirements[edit | edit source]

  • MediaWiki 1.13.5 or greater
  • Semantic MediaWiki 1.4.3 or greater
  • PHP 5.x or greater installed and working
  • MySQL >= 4.0.14 (version required by MediaWiki)

Installation[edit | edit source]

  • Download and extract the file(s) in a directory called WikiObjectModel in your extensions/ folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository.
  • Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/WikiObjectModel/WikiObjectModel.php";
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

WOM overview[edit | edit source]

WOM will parse through the wiki page and convert the wiki text into an object hierarchy, with support of recursion. That is to say, if a page contains sections that contains another subsection, which contains a template whose parameter is another template, WOM allows users to manipulate any object in the chain.

The parsed wiki text can be traversed like a graph, it can also be exported as an XML data via API.

WOM uses its underline Object Model (extensible) to allow many functions.

WOM's API enables external application to read/write into wiki pages with greater flexibility.


What WOM can do?[edit | edit source]

  • To locate specified Wiki object with Wiki DOM technique, especially xpath series
    • To create Wiki objects based on Wiki text
  • To edit Wiki page simply by updating Wiki objects
    • Operating on Wiki objects instead of parsing wiki text
  • To support various MediaWiki objects, e.g., templates, links, properties, etc.
    • Easy to add support of new type of Wiki objects
  • API support for third party applications to read/modify Wiki pages

What WOM CANNOT do?[edit | edit source]

  • WOM does a best-effort parsing of MediaWiki text.
    • Not all de-facto MW markup syntax is supported, so there could be parse errors when malformed wiki text is encountered
    • but most well-formed syntax is supported
  • Transclusion with parameters or variables is not supported
    • {{#ifeq: 1|1|yes|no}} can not be parsed to 'yes'
    • {{Template {{#ifeq: 1|1|A|B}} |}} will not return correct 'Template Object model': {{Template A|}}
    • Only plain transclusion (whole page transclution) is supported

Wiki Object Models[edit | edit source]

WOM Object Models

WOM Functions[edit | edit source]

WOM functions

WOM Apis[edit | edit source]

WOM Apis

Similar extensions[edit | edit source]

Extensions based on WOM[edit | edit source]

Development guide[edit | edit source]

WOM development guide