Jump to content

Extension:ChronologyList

From mediawiki.org
Revision as of 14:36, 31 March 2020 by Pppery (talk | contribs) ({{DownloadBroken}})
MediaWiki extensions manual
ChronoList
Release status: beta
Implementation Parser extension
Description Allows to insert a chronological list of events.
Author(s) Jaroslav Černý (Jaroslav Cernytalk)
Latest version 0.2 (2013-07-02)
MediaWiki 1.16+
Database changes Yes
License GPL
Download external download

  • ‎<chrono>
  • ‎<chronolist>

The ChronologyList extension adds chronology lists of events to wiki. Individual events are added to pages with tag "chrono", tag "chronolist" inserts a new event list.

New extension - any feedback is appreciated. Written originally for private wiki.

Installation

  • Download and extract the files in a directory called "ChronologyList" in your extensions/ folder.
  • Create 3 tables, defined in file chrono.sql.
  • Enable the extension by adding this line to your LocalSettings.php:
require_once('extensions/ChronologyList/ChronologyList.php');

Configuration parameters

No parameters yet.

User rights

No user rights yet.

Usage

You can find common example of historical events list on any page for individual year, e. g. http://en.wikipedia.org/wiki/1798. Here you can see ordered list of events, sorted by date. Each event is usually mentioned on the page devoted to a specific person, city, country, etc.

General Bonaparte and his expedition eluded pursuit by the Royal Navy and on 1 July landed at Alexandria. (taken from http://en.wikipedia.org/wiki/Napoleon )

July 1 – Napoleon's troops land in Egypt. ( http://en.wikipedia.org/wiki/1798 )

With chronolist extension, you would write both these texts on one page:

General Bonaparte and his expedition eluded pursuit by the Royal Navy and on 1 July landed at Alexandria. <chrono date="1798/07/01" desc="Napoleon's troops land in Egypt." />

Content of page http://en.wikipedia.org/wiki/1798 could be very simple then:

<chronolist range="1798" />

Chrono tag can be extended with argument "keys":

<chrono date="1798/07/01" desc="Napoleon's troops land in Egypt." keys="France,Napoleon,Egypt" />

This argument allows to generate event lists for individual country or person:

<chronolist keys="France" />

<chronolist keys="Napoleon" />

Multiple keys are allowed:

<chronolist keys="wine,beer" /> (wine OR beer)

Date range is allowed, too. For multiple-year range is another argument "year" mandatory (otherwise year is not displayed):

<chronolist range="1800-1815" keys="France" year="yes" />

Content of chrono tag is validated during rendering (previewing page), failure is indicated with error message located directly in the page. When the page is saved, chrono tag content is stored into extra database tables, record ID is added as additional argument and whole tag is converted into invisible HTML comment. In case of need, you can manually remove surrounding comment <!-- --> sequences, change description, keys or date and again save page.

Change Log

Version 0.2

  • i18n file added
  • internal tag parsing added

To do

  • Thorough testing, of course.
  • Some refactoring needed.
  • Better documentation.
  • Database queries are written for MySQL only.
  • Add code for chrono item deleting (column `deleted` in `ext_chrono_items` table).
  • Better error messages for chrono tag.
  • More formatting options for chronolist tag.