Extension:TEI
TEI Release status: experimental |
|
---|---|
Implementation | ContentHandler |
Description | Implementation of a ContentHandler for TEI XML |
Author(s) | Thomas Pellissier Tanon (Tpttalk) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | 1.33+ |
Composer | mediawiki/tei |
License | GNU General Public License 2.0 or later |
Download | README |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Translate the TEI extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The TEI extension makes MediaWiki compatible with TEI XML P5, allowing to use TEI instead of Wikitext in some or all wiki pages.
It is currently a work in progress. It aims at providing an implementation of a subset of TEI, probably inspired by TEI simplePrint with an XML editor and a WYSIWYG editor.
Currently only a small set of TEI tags are supported, excluding the TEI header. A simple XML editor is provided with validation and autocomplete based on a configurable ODD bundled with the extension. A (buggy) beginning of VisualEditor customization is also available. A demo wiki is updated daily with the latest version of the extension. A bug tracker dashboard is available.
Installation
- <translate> [[<tvar name=2>Special:ExtensionDistributor/TEI</tvar>|Download]] and move the extracted <tvar name=name>
TEI
</tvar> folder to your <tvar name=ext>extensions/
</tvar> directory.</translate>
<translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/TEI - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'TEI' );
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
This extension depends on the following extensions:
- CodeMirror
- in order to provide syntax highlight to the XML editor
- VisualEditor
- to provide a VisualEditor for TEI. Parsoid installation is not required to allow usage on servers without node.js.
- Math
- for math rendering.
By default the tei
ContentModel is not enabled anywhere. You could, e.g. create a new namespace called "TEI" and enable TEI by default in it by adding to your LocalSettings.php
:
define( 'NS_TEI', 100 );
define( 'NS_TEI_TALK', 101 );
$wgExtraNamespaces[NS_TEI] = 'TEI';
$wgExtraNamespaces[NS_TEI_TALK] = 'TEI_Talk';
$wgNamespaceContentModels[NS_TEI] = 'tei';
An other option is to use Special:ChangeContentModel
to change the content model of some pages from "wikitext" to "TEI".
How to customize the TEI ODD
A TEI ODD is used to define the validation of TEI content. It might also be used in the future to customize the HTML rendering.
The ODD used by default is stored in the data/mw_customization.odd
file of the extension git repository.
After having modified it you should update the internal JSON definition file used directly by running php maintenance/GenerateTeiJsonDefinition.php
from the main directory of the TEI extension.
How this extension works
- It defines a new content format in the
TeiContentModel
andTeiContent
classes. - The class
Model\TeiRegistry
is used to provide access to the current ODD. It is read from thedata/mw_tei_json_definition.json
JSON file that is generated from an ODD (see previous section). - The class
Model\Validator
validates a DOM tree against aModel\TeiRegistry
. It is written directly in PHP to get better error messages, building automata to validate node children and tags values. - The classes
Model\TeiToHtmlConversion
andModel\HtmlToTeiConversion
handle the rountrip conversions between TEI and HTML. - There is a small set of unit tests in the
tests
folder, especially for the HTML from/to TEI conversion. The roundrip conversion tests are intests/phpunit/Converter/roundtrip.txt
file.
See also
- Pages with script errors
- Pages with broken file links
- Experimental extensions
- Extensions without an image
- ContentHandler extensions
- Extensions with master compatibility policy
- Extensions with manual MediaWiki version
- Extensions supporting Composer
- GPL licensed extensions
- Extensions in Wikimedia version control
- BeforePageDisplay extensions
- All extensions
- WYSIWYG extensions