Extension:Lexicon

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Lexicon

Release status: experimental

Implementation Parser function
Description Automatically link defined terms in articles
Author(s) SamanDesilva, WiiKno Inc. (MasonmcleadTalk)
Last version 0.1
MediaWiki 1.15
License LGPL
Download Project page
Subversion [Help]

Browse source code
View code changes

Hooks used
ParserBeforeTidy

Check usage (experimental)

Contents

[edit] What can this extension do?

This extension is based on Extension:Terminology and was further developed by WiiKno Inc. This extension terms located in a template and when the term is found in a topic, it will be highlighted, linked to term definition and mousing over it will reveal the definition in a tool tip. Extension uses Walter Zorn's "JavaScript, DHTML Tooltips" library so you can customize the appearance of the tooltips.

[edit] Usage

By default, extension uses a template (that you must define) with the name “Lexicon”. In the “Lexicon” template it is expecting a parameter “term” and a parameter “definition”. In the “term” field it is expected to have the 'term name' and in the “definition” parameter it is expected to have definition of the term. It's also possible to override these default template name and default parameter names. The template should look something like this (as a suggestion; you can format however you wish):

<noinclude>
This is the "Lexicon" template.
It should be called in the following format:
<pre>
{{Lexicon
|term=
|definition=
}}
</pre>
Edit the page to see the template text.
</noinclude><includeonly>
{| class="wikitable"
! Term
| {{{term|}}}
|-
! Definition
| {{{definition|}}}
|}
[[Category:Lexicon]]
</includeonly>

[edit] Download instructions

Please download here and extract into your extensions folder.

[edit] Installation

Currently tested on:

  • Mediawiki version 1.15.4
  • Mysql 5.0+ (older may work) (other databases are not supported at this time)
  • Before enabling the Extension in Localsetting file, apply the mysql script located on extensions/Lexicon directory, script requires mysql root privileged access.
       Example : mysql -u root -p {MediaWiki database name} < Lexicon.sql
Enter mysql root password when prompted
    • Creates a table “Lexicon_cache”
    • Create three Triggers on tables “revisions” and “templatelinks”
  • Enable extension using following line in Localsettings.php
              require_once("$IP/extensions/Lexicon/Lexicon.php");
  • (Optional) If you wish to use the Javascript-based tooltips, you need to download Walter Zorn's "JavaScript, DHTML Tooltips" library (found at: here or there). Create the directory: extensions/tooltip.
mkdir -p extensions/tooltip

And uncompress the archive "wz_tooltip.zip" into that directory. You should have the latest version of the library (version 5.13 at the time of this writing.) (At the end, you should have 3 files: extensions/tooltip/tip_centerwindow.js, extensions/tooltip/tip_followsscroll.js, and extensions/tooltip/wz_tooltip.js ) The Lexicon extension will automatically check if the directory and files exist and will apply the new tooltip style.

[edit] Configuration parameters

Optionally use following variables in LocalSettings.php file to override the Default names.

$wgTemplateName="template name";
$wgTermField="parameter name used in template to indicate the term";
$wgDefinitionField="parameter name used in template to indicate definition of term";

[edit] Startup Instructions (IMPORTANT)

On the first time running the extension, extension will build a cache of all the terms and their definitions. There after cache will be updated one term at time. If the number of terms found on the first run of extension is very large (thousands), it may take 30 seconds or more to build the cache. In this case, there will be error on MediaWiki view of Topic, as maximum allowed time to process a request is limited to 30 seconds in typical MediaWiki installtion. Therefore, maximum allowed time to process a request must be increased to build the entire cache for the first time.

Two variables limiting execution time in MediaWiki

  • php.ini file “max_execution_time =”
  • httpd.conf file “php_value max_execution_time”

Need put time in second to a value sufficant to update full term cache

Once cache is build for the first time, these values can be revert back to default values.

[edit] Rebuild Cache

To rebuild the entire cache, after the initial setup, run following sql query on Mediawiki database.

UPDATE `Lexicon_cache` SET `term` = 'reload' WHERE `id` =0;

[edit] Known Issues

  • nested templates breaks the code - The Lexicon_cache template makes duplicate entries for pages with nested templates; causes database error.
  • If a term is found in a property name while editing with Semantic Forms, the property values are not displayed correctly
  • Breaks headertabs extension

[edit] See also

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox