Jump to content

Extension:PgnJS: Difference between revisions

From mediawiki.org
Content deleted Content added
Xeyownt (talk | contribs)
No edit summary
Features and Examples: Related to the previous edit.
 
(23 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{TNT|Extension|templatemode=
{{Extension
|name = PgnJS
|name = PgnJS
|status = alpha
|status = beta
|type1 = parser function
|type1 = parser function
|hook1 = ParserFirstCallInit
|hook1 = ParserFirstCallInit
|hook2 = BeforePageDisplay
|hook2 = GetPreferences
|hook3 = UserSaveOptions
|hook4 = SaveUserOptions
|username = xeyownt
|username = xeyownt
|author = Michaël Peeters
|author = Michaël Peeters
|description = embed chess games (boards and moves) in <code><pgn></code> tags
|description = display and animate chess games (boards and moves) given in <wbr/>{{tag|pgn|open}} tags
|image = Pgnjs-screenshot.png
|image = Pgnjs-screenshot.png
|version = 0.1.2
|version = 0.5.1
|update = 2017-12-27
|update = 2021-02-07
|mediawiki = 1.17+ (>1.27.4 not tested)
|mediawiki = 1.17+
|license = Apache-2.0
|license = Apache-2.0
|download = [https://github.com/xeyownt/mwpgnjs GitHub] project
|download = {{GithubDownload|xeyownt|mwpgnjs}}
|readme =
|readme =
|changelog =
|changelog =
|parameters =
|parameters =
|rights =
|rights =
|example = see [https://github.com/xeyownt/mwpgnjs GitHub]
|example = <!-- see [https://wikitest.immie.org/wiki/PgnJS WikiTest PgnJS page]. //Page does not exist as of 2026-02-07 -->
}}
}}


'''PgnJS''' is a MediaWiki extension that embeds chess games (boards and moves) in a wiki page. Chess games are simply given in PGN format in a <code><pgn></code> tag and displayed thanks to the powerful javascript engine [https://github.com/mliebelt/PgnViewerJS '''PgnViewerJS''']. In fact most of the functionality is provided by PgnViewerJS. This extension only implements the parsing of the <code><pgn></code> tag.
The '''PgnJS''' extension displays and animates chess games (boards and moves). Chess games are simply given in PGN format in a <code><pgn></code> tag and displayed thanks to the powerful javascript engine [https://github.com/mliebelt/PgnViewerJS '''PgnViewerJS''']. In fact most of the functionality is provided by PgnViewerJS. This extension only implements the parsing of the <code><pgn></code> tag.


== Features ==
== Usage, features and download ==


* Four display modes: <code>board</code>, <code>view</code>, <code>print</code> and <code>edit</code>, and one mode to define defaults.
* Different layout possibilities (<code>left</code>, <code>top</code>...).
* Many attributes, including styling and classes.
* Support for wiki templates.
* Read default configuration from user preferences.
* Internationalization support.

== Documentation and Source Code ==
Please visit the [https://github.com/xeyownt/mwpgnjs GitHub page].
Please visit the [https://github.com/xeyownt/mwpgnjs GitHub page].


== Installation ==
== Installation ==

The simplest is to clone the git repository in folder <code>extensions</code> of your wiki and run the <code>install</code> target (for MW 1.25 or above) or <code>install-1.24</code> (for MW 1.24 or older):
The simplest is to clone the git repository in folder <code>extensions</code> of your wiki and run the <code>install</code> target (for MW 1.25 or above) or <code>install-1.24</code> (for MW 1.24 or older):


<source lang=bash>
<syntaxhighlight lang=bash>
cd /path/to/your/wiki/extensions
cd /path/to/your/wiki/extensions
git clone --recursive --depth 1 https://github.com/xeyownt/mwpgnjs PgnJS
git clone --recursive --depth 1 https://github.com/xeyownt/mwpgnjs PgnJS
Line 37: Line 46:
make install # For MW 1.25 or above
make install # For MW 1.25 or above
make install-1.24 # For MW 1.24 or older
make install-1.24 # For MW 1.24 or older
</syntaxhighlight>
</source>


Don't forget the <code>--recursive</code> option since the extension uses git submodules.
Don't forget the <code>--recursive</code> option since the extension uses git submodules.
Line 43: Line 52:
<code>make install</code> / <code>make install-1.24</code> will delete all files that are not necessary for the extension to run, and add the following line at the end of <code>LocalSettings.php</code>:
<code>make install</code> / <code>make install-1.24</code> will delete all files that are not necessary for the extension to run, and add the following line at the end of <code>LocalSettings.php</code>:


<source lang=php>
<syntaxhighlight lang=php>
// For MW 1.25 or above:
// For MW 1.25 or above:
wfLoadExtension( 'PgnJS' );
wfLoadExtension( 'PgnJS' );
// For MW 1.24 or older:
// For MW 1.24 or older:
require_once "$IP/extensions/PgnJS/PgnJS.php";
require_once "$IP/extensions/PgnJS/PgnJS.php";
</syntaxhighlight>
</source>


{{Done}}! Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
{{Done}}! Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Line 56: Line 65:


The extension has been tested on
The extension has been tested on
* MediaWiki 1.27.4
* MediaWiki 1.22.1, 1.27.4, 1.32.6, 1.33.0, 1.33.4, 1.34.4, 1.35.0, 1.35.1.

* MediaWiki 1.22.1
== See also ==
* [[Extension:ChessBrowser]]

[[category:Chess extensions]]

Latest revision as of 08:51, 7 February 2026

MediaWiki extensions manual
PgnJS
Release status: beta
Implementation Parser function
Description display and animate chess games (boards and moves) given in ‎<pgn> tags
Author(s) Michaël Peeters (xeyownttalk)
Latest version 0.5.1 (2021-02-07)
MediaWiki 1.17+
Licence Apache License 2.0
Download

The PgnJS extension displays and animates chess games (boards and moves). Chess games are simply given in PGN format in a <pgn> tag and displayed thanks to the powerful javascript engine PgnViewerJS. In fact most of the functionality is provided by PgnViewerJS. This extension only implements the parsing of the <pgn> tag.

Features

[edit | edit source]
  • Four display modes: board, view, print and edit, and one mode to define defaults.
  • Different layout possibilities (left, top...).
  • Many attributes, including styling and classes.
  • Support for wiki templates.
  • Read default configuration from user preferences.
  • Internationalization support.

Documentation and Source Code

[edit | edit source]

Please visit the GitHub page.

Installation

[edit | edit source]

The simplest is to clone the git repository in folder extensions of your wiki and run the install target (for MW 1.25 or above) or install-1.24 (for MW 1.24 or older):

cd /path/to/your/wiki/extensions
git clone --recursive --depth 1 https://github.com/xeyownt/mwpgnjs PgnJS
cd PgnJS
make install             # For MW 1.25 or above
make install-1.24        # For MW 1.24 or older

Don't forget the --recursive option since the extension uses git submodules.

make install / make install-1.24 will delete all files that are not necessary for the extension to run, and add the following line at the end of LocalSettings.php:

// For MW 1.25 or above:
wfLoadExtension( 'PgnJS' );
// For MW 1.24 or older:
require_once "$IP/extensions/PgnJS/PgnJS.php";

Yes Done! Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Compatibility

[edit | edit source]

Extension uses the ResourceLoader, so it requires at least MediaWiki 1.17.

The extension has been tested on

  • MediaWiki 1.22.1, 1.27.4, 1.32.6, 1.33.0, 1.33.4, 1.34.4, 1.35.0, 1.35.1.

See also

[edit | edit source]