User:Mutante/MoonEdit

From Meta, a Wikimedia project coordination wiki
 
A proposal to move this page to MediaWiki.org was rejected.

Situation[edit]

You are using the MoonEdit program (Tom Dobrowolski's multi-platform collaborative text editor) to colloboratively edit texts with other users and would like to save them into the Wiki for future reference. You used the 'svsavetxt command in your MoonEdit client to make the server save the session as plain text in the current working directory.

<ting></ting> Tag[edit]

In the Wiki you can now use <ting>filename</ting> inside a wiki page, and the content of the file will be included into the wiki page. Note that often the MoonEdit files dont have a file extension.They should be plain text and not in the .me format.

Its called 'Ting' because that term is being used on the TingWiki, more on [1]. TingWiki lives inside S23-Wiki where i installed this extension.

Tings have been the councils of the old vikings.

Ting (MoonEdit) Extension[edit]

<?php
# "Ting" (MoonEdit) Mediawiki extension v0.1
# includes plain text files saved by a [[MoonEdit]] server
# by mutante 12.03.2005

$wgExtensionFunctions[] = "wfTingExtension";

function wfTingExtension() {
global $wgParser;
$wgParser->setHook( "ting", "renderTing" );
}

function renderTing( $input ) {

$input = mysql_escape_string($input);


$file = "/var/www/moonedit/$input";
if (file_exists($file)) { $content = file($file); }

foreach($content as $key => $value) {
   $output.="$value<br>";
  }

return $output;

}

?>