Content added Content deleted
imported>mutante m (→Source) |
imported>mutante mNo edit summary |
||
Line 59: | Line 59: | ||
# then foo will be a string with the output of the command. |
# then foo will be a string with the output of the command. |
||
# Tested out a bit, and this should work. mutante. |
# Tested out a bit, and this should work. mutante. (not yet)... |
||
$output="<nowiki><pre></nowiki>"; |
$output="<nowiki><pre></nowiki>"; |
||
Line 72: | Line 72: | ||
</pre> |
</pre> |
||
not installed yet, see ongoing [[User_talk:DrOwl/wikiFiglet:talk]]. |
|||
Revision as of 23:12, 22 May 2005
Integrate figlet text into wiki pages using figletlink in a custom Mediawiki extension:
this is a first untestedversion with justmonkey knolage of how to make it work
Syntax
<figlet>text</figlet>
Example
<figlet>moo</figlet>
example Result
| '_ ` _ \ / _ \ / _ \ | | | | | | (_) | (_) | |_| |_| |_|\___/ \___/
(not installed on anything this is only beta i dont have figlet installed on this server)
Source
<?php # Figlet Mediawiki extension # using shell figlet # by DrOwl 21.06.2005 <- a Date in the Future ,ehe ;) #modded from # by mutante 25.03.2005 #install extension hook $wgExtensionFunctions[] = "wfFigletExtension"; #extension hook callback function function wfFigletExtension() { global $wgParser; #install parser hook for <figlet> tags $wgParser->setHook( "figlet", "renderFiglet" ); } function renderFiglet( $input ) { global $wgOutputEncoding; # $input = mysql_escape_string($input); if (!$input) $input = "mu"; #ifno input then mu $input =~ /[Aa-Zz]|[1-0]; # $input = mysql_escape_string($input); # $figlet = passthru('echo $input | /home/drowl/figlet/figlet -d /home/drowl/figlet/fonts'); # $figlet = passthru("figlet moo"); # just "figlet moo" works on the shell, so you can save the echo and pipe. # But the problem with passthru is that we always only get the first line of the returned text. # I am being told: <+jome> #mutante: php.net/exec AND # < jannek> mutante: if you fetch stdout lik ethis $foo = `system command`; # then foo will be a string with the output of the command. # Tested out a bit, and this should work. mutante. (not yet)... $output="<pre>"; $output.=system ("figlet $input"); $output.="<nowiki>
</nowiki>";
return $output;
}
?>
not installed yet, see ongoing User_talk:DrOwl/wikiFiglet:talk.