From a30fdb21a437d3764409f94c577763545c3e727f Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Tue, 22 Dec 2015 08:43:39 +0100 Subject: First commit. --- GitTimeline_body.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ extension.json | 34 ++++++++++++++++++++++++++++++++++ gittimeline.css | 7 +++++++ 3 files changed, 93 insertions(+) create mode 100644 GitTimeline_body.php create mode 100644 extension.json create mode 100644 gittimeline.css diff --git a/GitTimeline_body.php b/GitTimeline_body.php new file mode 100644 index 0000000..e1ea75b --- /dev/null +++ b/GitTimeline_body.php @@ -0,0 +1,52 @@ +setHook( 'GitTimeline', array( __CLASS__, 'renderGitTimeline' ) ); + return true; + + } + + static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) { + + $out->addModuleStyles( array ( + 'ext.gittimeline' + ) ); + + } + + static function renderGitTimeline( $input, array $args, Parser $parser, PPFrame $frame ) { + + global $wgRepositoriesDirectory; + global $wgCGitUrl; + + if ( ! isset( $args['repo'] ) ) + return ''; + + if ( ! isset( $args['keep'] ) ) + return ''; + + $repo = $args['repo']; + $keep = $args['keep']; + + $git_command = <<(%ar)" ) + echo -e "\t
  • r\$revision - \$message
  • " +done +EOT; + + $output = shell_exec($git_command); + + return array( "$output", 'noparse' => true, 'isHTML' => true ); + + } + +} + +?> diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..b7220d8 --- /dev/null +++ b/extension.json @@ -0,0 +1,34 @@ +{ + "name": "GitTimeline", + "author": [ + "Cyrille Bagard" + ], + "url": "https://www.mediawiki.org/wiki/Extension:Example", + "description": "This extension allows to include an external file in a safe way.", + "version": "1.0", + "license-name": "GPL-2.0+", + "type": "other", + "AutoloadClasses": { + "GitTimeline": "GitTimeline_body.php" + }, + "Hooks": { + "ParserFirstCallInit": [ + "GitTimeline::onParserInit" + ], + "BeforePageDisplay": [ + "GitTimeline::onBeforePageDisplay" + ] + }, + "ResourceModules": { + "ext.gittimeline": { + "styles": { + "gittimeline.css": { + "media": "screen" + } + } + } + }, + "ResourceFileModulePaths": { + "localBasePath": "" + } +} diff --git a/gittimeline.css b/gittimeline.css new file mode 100644 index 0000000..fb2c6fd --- /dev/null +++ b/gittimeline.css @@ -0,0 +1,7 @@ + +.gitdate { + + font-size: 90%; + color: #aaa; + +} -- cgit v0.11.2-87-g4458