Extension:GitHub
From MediaWiki.org
(Redirected from Extension:GetHub)
|
|
This extension stores its code inside a wiki page. Please be aware that MediaWiki developers do not review or keep track of extensions that put their code on the wiki.
|
|
gitHub Release status: beta |
|||
|---|---|---|---|
| Implementation | Tag | ||
| Description | add github gists into your articles easily | ||
| Author(s) | Adam Meyer (noverflowTalk) | ||
| Last version | .01 | ||
| MediaWiki | 1.14 (tested) | ||
| License | MIT | ||
| Download | No link | ||
|
|||
|
Check usage (experimental) |
|||
Contents |
[edit] What can this extension do?
add github gists into your articles easily using <github gist="123456"/>
[edit] Usage
<github gist="123456"/>
[edit] Download instructions
Please cut and paste the code found below and place it in $IP/extensions/github/github.php. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
[edit] Installation
To install this extension, add the following to LocalSettings.php:
require_once("$IP/extensions/github/github.php");
[edit] User rights
Nothing promised. Took me 2min to make. Do with it as you would like.
[edit] Code
<?php if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is part of an extension to the MediaWiki software and cannot be used standalone.\n" ); die( 1 ); } $wgExtensionCredits['other'][] = array( 'name'=>'gitList tag', 'author'=>'Adam Meyer', 'description'=>'add github gists into your articles easily using <github gist="123456"/>', 'version'=>'0.1' ); if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { $wgHooks['ParserFirstCallInit'][] = 'efGitHub'; } else { $wgExtensionFunctions[] = 'efGitHub'; } function efGitHub() { global $wgParser; $wgParser->setHook( 'github', 'efGitHubRender' ); return true; } function efGitHubRender( $input, $args, $parser ) { $attr = array(); // This time, make a list of attributes and their values, // and dump them, along with the user input foreach( $args as $name => $value ) { if ( $name == 'gist' ) { $num = $value; } } return '<script src="http://gist.github.com/'.$num.'.js"></script>'; }
