Release status: experimental
|Description||Implementation of a ContentHandler for TEI XML|
|Compatibility policy||Master maintains backward compatibility.|
|License||GNU General Public License 2.0 or later|
|Quarterly downloads||7 (Ranked 158th)|
|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.
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.
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'TEI' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
This extension depends on the following extensions:
- in order to provide syntax highlight to the XML editor
- to provide a VisualEditor for TEI. Parsoid installation is not required to allow usage on servers without node.js.
- for math rendering.
define( 'NS_TEI', 100 ); define( 'NS_TEI_TALK', 101 ); $wgExtraNamespaces[NS_TEI] = 'TEI'; $wgExtraNamespaces[NS_TEI_TALK] = 'TEI_Talk'; $wgNamespaceContentModels[NS_TEI] = '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
- The class
Model\TeiRegistryis used to provide access to the current ODD. It is read from the
data/mw_tei_json_definition.jsonJSON file that is generated from an ODD (see previous section).
- The class
Model\Validatorvalidates a DOM tree against a
Model\TeiRegistry. It is written directly in PHP to get better error messages, building automata to validate node children and tags values.
- The classes
Model\HtmlToTeiConversionhandle the rountrip conversions between TEI and HTML.
- There is a small set of unit tests in the
testsfolder, especially for the HTML from/to TEI conversion. The roundrip conversion tests are in