Extension:Genealogy

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Genealogy

Release status:Extension status beta

ImplementationTemplate:Extension#type Parser function
DescriptionTemplate:Extension#description Adds a parser function for easier linking between genealogical articles.
Author(s)Template:Extension#username Sam Wilson (samwilsontalk)
Latest versionTemplate:Extension#version 0.4.2 (2017-08-01)
Database changesTemplate:Extension#needs-updatephp No
ComposerComposer samwilson/mediawiki-extensions-genealogy
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
Download
README.md
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
UnitTestsListManual:Hooks/UnitTestsList
EditPageBeforeEditToolbarManual:Hooks/EditPageBeforeEditToolbar

Translate the Genealogy extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The Genealogy extension adds a parser function that makes it easy to link between genealogical articles. Basically, for any biographical article which links to other family members, the reverse link on those other articles can be created automatically.

It is a work in progress, but what has been completed so far is relatively stable, and is in production on at least one website.

Installation[edit]

Note that you also need to install the GraphViz extension if you want to use the tree-drawing feature.

Install with Composer[edit]

The easiest way to install this extension is with Composer.

Add this to your composer.local.json file:

{
  "require": {
    "samwilson/mediawiki-extensions-genealogy": "^0.4"
  }
}

Then run composer update.

After that, you can enable the extension by adding the following to your LocalSettings.php file (the path to extension.json must be specified because Composer installs to a directory that isn't named the same as the extension):

wfLoadExtension( 'Genealogy', "$IP/extensions/MediawikiExtensionsGenealogy/extension.json" );

Normal installation method[edit]

  • Download and place the file(s) in a directory called Genealogy in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Genealogy' );
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

This extension creates one parser function: {{#genealogy: … }}. Its first first parameter is unnamed (i.e. doesn't have an equals sign) but all others are.

The following parameters are supported, two for defining data and four for reporting data:

  1. Define and output a link to a parent:
    {{#genealogy:parent|Page Name Here}}
  2. Define a partner (no output produced; use partners to list):
    {{#genealogy:partner|Page Name Here}}
  3. List all siblings:
    {{#genealogy:siblings}}
  4. List all partners:
    {{#genealogy:partners}}
  5. List all children:
    {{#genealogy:children}}
  6. Display a tree (a connected graph):
    {{#genealogy:tree|ancestors=List|descendants=List}}
    where each List is a newline-separated list of page titles. This requires the GraphViz extension.

Templates[edit]

Example: For an example template that makes use of these parser functions, see person_template.wikitext.

Preload: When this extension creates a link to a page that doesn't yet exist, the text of [[Template:Person/preload]] is preloaded. The location of this preload text can be customised by modifying the genealogy-person-preload system message.

Person list-item: Three types of lists of people can be generated: siblings, partners, and children. The default behaviour is a simple bulleted list, but this can be overridden by a template, Template:Person/list-item (the template name is specified by the genealogy-person-list-item system message). For example, to get a comma-separated one-line list of people, the following template code could be used:

{{{link}}}{{#ifeq:{{{index}}}|{{{count}}}|.|,}}

There are four parameters that are available for use in the list-item template:

  • link — A wikitext link.
  • title — The page title.
  • index — The index of this list-item in the full list, starting from 1.
  • count — The total number of items in the full list.

Development[edit]

This extension was built by Sam Wilson and released under version 3 of the GPL (see LICENSE.txt for details).

Please report all bugs via Phabricator: https://phabricator.wikimedia.org/


See also[edit]