Jump to content

Extension:EasyTimeline

From mediawiki.org
MediaWiki extensions manual
EasyTimeline
Release status: stable
Implementation Tag
Description Adds ‎<timeline> tag for creating timelines
Author(s) Erik Zachte
MediaWiki >= 1.42
Database changes No
License GNU General Public License 2.0 only
Download
CHANGELOG
Example See below
  • $wgTimelineRsvgCommand
  • $wgTimelineFontFile
  • $wgTimelineFileBackend
  • $wgTimelineFonts
  • $wgTimelineFontDirectory
  • $wgTimelinePloticusCommand
  • $wgTimelinePerlCommand
Public wikis using 7,989 (Ranked 20th)
Translate the EasyTimeline extension
Issues Open tasks · Report a bug
Other languages:

The EasyTimeline extension produces an embedded image from wikitext. The image can be a one-dimensional diagram (horizontally or vertically) or a two-dimensional one.

See the help page on installing EasyTimeline on your wiki. See also this page on EasyTimeline or play with it at test.wikipedia.org.

See the help page on using the syntax provided by this extension.

There is a long-term effort to get the Chart extension to replace this extension.

Charts examples

[edit]

Several examples of what is possible. For more extensive examples, see

Special:MyLanguage/GorbachevSpecial'colon'MyLanguage/ChernenkoSpecial:MyLanguage/AndropovSpecial:MyLanguage/BrezhnevSpecial:MyLanguage/KhrushchevSpecial:MyLanguage/StalinSpecial:MyLanguage/Lenin
  
Special'colon'MyLanguage/SiderianSpecial'colon'MyLanguage/RhyacianSpecial'colon'MyLanguage/OrosirianSpecial'colon'MyLanguage/StatherianSpecial'colon'MyLanguage/CalymmianSpecial'colon'MyLanguage/EctasianSpecial'colon'MyLanguage/StenianSpecial'colon'MyLanguage/TonianSpecial'colon'MyLanguage/CryogenianSpecial'colon'MyLanguage/EdiacaranSpecial'colon'MyLanguage/EoarcheanSpecial'colon'MyLanguage/PaleoarcheanSpecial'colon'MyLanguage/MesoarcheanSpecial'colon'MyLanguage/NeoarcheanSpecial'colon'MyLanguage/PaleoproterozoicSpecial'colon'MyLanguage/MesoproterozoicSpecial'colon'MyLanguage/NeoproterozoicSpecial'colon'MyLanguage/PaleozoicSpecial'colon'MyLanguage/MesozoicSpecial'colon'MyLanguage/CenozoicSpecial'colon'MyLanguage/HadeanSpecial'colon'MyLanguage/ArcheanSpecial'colon'MyLanguage/ProterozoicSpecial'colon'MyLanguage/Phanerozoic
CambrianSpecial'colon'MyLanguage/OrdovicianSpecial'colon'MyLanguage/SilurianSpecial'colon'MyLanguage/DevonianSpecial'colon'MyLanguage/CarboniferousSpecial'colon'MyLanguage/PermianSpecial'colon'MyLanguage/TriassicSpecial'colon'MyLanguage/JurassicSpecial'colon'MyLanguage/CretaceousSpecial'colon'MyLanguage/PaleogeneSpecial'colon'MyLanguage/NeogeneSpecial'colon'MyLanguage/QuaternarySpecial'colon'MyLanguage/PaleozoicSpecial'colon'MyLanguage/MesozoicSpecial'colon'MyLanguage/CenozoicSpecial'colon'MyLanguage/Phanerozoic
Cenozoic
Special'colon'MyLanguage/PaleoceneSpecial'colon'MyLanguage/EoceneSpecial'colon'MyLanguage/OligoceneSpecial'colon'MyLanguage/MioceneSpecial'colon'MyLanguage/PlioceneSpecial'colon'MyLanguage/PleistoceneSpecial'colon'MyLanguage/HoloceneSpecial'colon'MyLanguage/PaleogeneSpecial'colon'MyLanguage/NeogeneSpecial'colon'MyLanguage/QuaternarySpecial'colon'MyLanguage/Cenozoic
www.mediawiki.org/..en.wikipedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..stats.wikimedia.org/..


Code example

[edit]
See also: Extension:EasyTimeline/syntax
Special:MyLanguage/GorbachevSpecial'colon'MyLanguage/ChernenkoSpecial:MyLanguage/AndropovSpecial:MyLanguage/BrezhnevSpecial:MyLanguage/Khrushchev

Special:MyLanguage/Lenin

Just to show you that the script syntax is reasonably intuitive, here is the script for the image above: Soviet Leaders.

<timeline>
# All measures are in pixels

ImageSize  = width:160 height:550
PlotArea   = left:50 right:0 bottom:10 top:10
AlignBars  = justify

DateFormat = yyyy
Period     = from:1917 till:1991
TimeAxis   = orientation:vertical
ScaleMajor = unit:year increment:5 start:1920

# there is no automatic collision detection,
# so shift texts up or down manually to avoid overlap

Define $dx = 25 # shift text to right side of bar

PlotData=
  bar:Leaders color:red width:25 mark:(line,white) align:left fontsize:S

  from:start till:1924 shift:($dx,15)   text:Vladimir~Ilyich~[[Special:MyLanguage/Lenin|Lenin]]
  from:1924  till:1953 shift:($dx,5)    text:[[Special:MyLanguage/Stalin|Josef~Stalin]]
  from:1953  till:1964 shift:($dx,5)    text:Nikita~[[Special:MyLanguage/Khrushchev|Khrushchev]]
  from:1964  till:1982 shift:($dx,5)    text:Leonid~[[Special:MyLanguage/Brezhnev|Brezhnev]]
  from:1982  till:1984 shift:($dx,-12)  text:Yuri~[[Special:MyLanguage/Andropov|Andropov]]
  from:1984  till:1985 shift:($dx,4)    text:Konstantin~[[Special:MyLanguage/Chernenko|Chernenko]] fontsize:XS
  from:1985  till:end  shift:($dx,10)   text:Mikhail~[[Special:MyLanguage/Gorbachev|Gorbachev]]
</timeline>

Double and single brackets can be used like on Wikipedia, and language prefixes are possible, e.g., [[de:foo|more about foo]]. Single brackets for external links are also supported.

Unicode

[edit]

EasyTimeline does not yet support Unicode.

Aug 2004: Minimal UTF-8 support has been added, meaning EasyTimeline now recognizes UTF-8 encoded characters. However, support for directionality and complex scripts is very lacking. The default font may not have glyphs for all characters. An alternate font can be specified via $wgTimelineFontFile

SVG to PNG

To show texts correctly for RTL languages (like Arabic, Persian, Hebrew,...) you can use ‎<timeline method="svg2png">timeline code here‎</timeline> instead of ‎<timeline>timeline code here‎</timeline>. it shows the timeline as png, but the links will be disabled.

Tips

[edit]

For first-time users, EasyTimeline may not seem that easy at all. As with all script languages, it takes some getting used to. Also, the syntax description may be a bit bewildering due to its sheer size. Fortunately, many elements of the script language are optional.

The 'Easy' in EasyTimeline conveys the message that once a timeline exists, it is not so hard to understand, enhance, or correct. Also, translating it for use on another Wikipedia is pretty straightforward.

Tips:

  • See some chart examples to find something you could pick and edit for your purposes
  • Put each timeline on a separate Template page: this makes it easier to edit, faster to preview, and possible to include it in several pages

Using the current date

[edit]

To use the current date make sure the table opens with {{#tag:timeline| and closes with }}. Then the current date can be inserted using magic words. For example {{#time: d/m/Y }} or {{CURRENTDAY2}}/{{CURRENTMONTH2}}/{{CURRENTYEAR}} will both yield the date in format dd/mm/yyyy.

See also

[edit]

Installation

[edit]
Requirements

This extension requires the following software to be installed on the server:

Installation

See the installation instructions.