Introduction to technical

Wikimedia world, MediaWiki and

bots

Toni Hermoso Pulido

@toniher

Amical Wikimedia

Wiki

Wikipedia

Wikimedia

MediaWiki

Wiki CMS

Built mostly in:

  • PHP
  • JavaScript

Working with Docker

Docker images used

We build the one above following README instructions, modifying Bash scripts and Dockerfile if desired

We can build this one as well. Alternately we can reuse it from:

https://hub.docker.com/r/toniher/debian-python-mediawiki/

However you need to mount example scripts provided in the repo above

Wikitext

  • Original content type
  • Nowadays also other content types accepted

Namespaces

  • Main

  • Talk

  • User

  • Category

  • Template

Templates

MediaWiki functions

Templates

Ordered parameters

{{MyTemplate | Hello | World }}

{{{1|Hi}}}, {{{2|Moon}}} !

Template:MyTemplate

Templates

Named parameters

{{MyNamedTemplate | greeting=Hello | recipient=World }}

Template:MyNamedTemplate

{{{greeting|Hi}}}, {{{recipient|Moon}}} !

Parser functions

{{#parser: param1 | param2 | ... }}

Parser functions

Examples

  • expr (simple maths)
  • if, switch (conditionals)
  • time (time format)

Parser functions

Custom ones

(via extensions)

Modules

Extending parser functions to everyone (now with Lua)

Example, for citation:

Special Pages

Managing MediaWiki

Special:SpecialPages

Bots

The hidden ones

MediaWiki API

Accessing MediaWiki programatically

MediaWiki API clients / libraries

  • Perl (MediaWiki::API, MediaWiki::Bot)

  • Python (Mwclient, Pywikibot)

  • JavaScript (nodemw)

  • etc.

Mwclient

A MediaWiki API Python client library

RESTBase

A sophisticated Wikipedia REST API

Semantic MediaWiki

A wiki-based annotation database

Semantic MediaWiki

Property :: Value

Germany

[[Has capital::Berlin]] is its capital. It has a population of [[Has population::81292400|more than 8 milions]].

Property:Has capital

Property:Has population

[[Has type::Page]].

[[Has type::Number]].

Semantic MediaWiki

Querying

Special:Ask