mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-25 00:26:44 +00:00
30a75fb0f1
Add the ability for modules to be documented using a /doc subpage, which is automatically transcluded onto the module page. To get the transcluding to work right, I wound up having to change from the deprecated-in-1.21 ArticleViewCustom hook to ContentHandler, as there didn't seem to be any other way to get the ParserOutput into the links tables. Which means Scribunto now needs MediaWiki 1.21 rather than 1.20. Change-Id: Id487097c2a505c11f92a3404f5d3ee98beb2570c
39 lines
916 B
PHP
39 lines
916 B
PHP
<?php
|
|
/**
|
|
* Scribunto Content Handler
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @ingroup Scribunto
|
|
*
|
|
* @author Brad Jorsch <bjorsch@wikimedia.org>
|
|
*/
|
|
|
|
class ScribuntoContentHandler extends TextContentHandler {
|
|
|
|
public function __construct( $modelId = 'Scribunto', $formats = array( 'CONTENT_FORMAT_TEXT' ) ) {
|
|
parent::__construct( $modelId, $formats );
|
|
}
|
|
|
|
/**
|
|
* Unserializes a ScribuntoContent object.
|
|
*
|
|
* @param $text string Serialized form of the content
|
|
* @param $format null|string The format used for serialization
|
|
* @return Content the ScribuntoContent object wrapping $text
|
|
*/
|
|
public function unserializeContent( $text, $format = null ) {
|
|
$this->checkFormat( $format );
|
|
return new ScribuntoContent( $text );
|
|
}
|
|
|
|
/**
|
|
* Creates an empty ScribuntoContent object.
|
|
*
|
|
* @return Content
|
|
*/
|
|
public function makeEmptyContent() {
|
|
return new ScribuntoContent( '' );
|
|
}
|
|
}
|