User talk:RenéV/Flow

About this board

Output wikitext with my home-made extension

2
RenéV (talkcontribs)

I need some help creating a small extension. I would like to be able to use wikitext in the output of this extension.

Due to the limited experience that I have I am unable to understand the explanation on the help pages here on MediaWiki.

Below is the code as I now have for extension.json and TesT.php. The output that the script currently gives is literally the text as it appears in the script, including the square brackets: This is [[my]] text.

Can someone please provide a simple explanation how to use wikitext?

Thanks.


extension.json:

{
	"name": "TesT",
	"version": "0.0.0",
	"author": [
		"RenéV"
	],
	"description": "TesT Extension",
	"type": "parserhook",
	"requires": {
		"MediaWiki": ">= 1.32.0"
	},
	"license-name": "GPL-2.0-or-later",

	"AutoloadClasses": {
		"TesTHooks": "TesT.php"
   },

	"Hooks": {
		"ParserFirstCallInit": [
			"TesTHooks::onParserFirstCallInit"
		]
   },

	"manifest_version": 1
}


Test.php:

<?php
use MediaWiki\MediaWikiServices;

class TesTHooks {

	public static function onParserFirstCallInit( &$parser ) {
		$parser->setHook( 'TesT', 'TesTHooks::renderTesT' );
		return true;
	   }

	public static function renderTesT( $input, $args, $mwParser ) {

		if ( htmlspecialchars( $input ) == 'test') {
			$output = "This is [[my]] text.";
		   }

		return $output;

	}

}
Krinkle (talkcontribs)
Reply to "Output wikitext with my home-made extension"
There are no older topics
Return to the user page of "RenéV/Flow".