Talk:Figlet Extension

ok we stilll need to do playing for the excapecommands and such... maybe we can just run some tr RegXs for doggy chars... there must be a way formaking it safe =) ill checkout the perl version =)

+the passthrough command works in my tests ie, using



returns the multi line figlet on my shell

may be its to do with this $output. thing... could we "$figlet = s/\n/&lt;br \/>/g" ie replace the newline char with a html br

+still need to add the font tags =)

--DrOwl 00:32, 23 May 2005 (CEST)

hummm found [escapeshellcmd]  and [exec]

oki i see =) simple really just need to chek it out with php instead of perl =)

i guessit willbe similer becouse its just somenice regex =)

--DrOwl 00:49, 23 May 2005 (CEST)

Installed it now and testing. Returns the figlet now, but BEFORE all other html. Trying to fix...

getting this help: mutante: try using popen("figlet $input","r");

stay tuned... mutante 13:12, 21 May 2005 (CEST)

13:06 hmm,while trying to write a mediawiki extension i always get the output i return BEFORE all other html in                the wiki pages instead of inline...what could i be doing wrong 13:08 $output=system ("figlet $input");  mutante: No. mysql_escape_string is for SQL commands, not for shell commands 13:13 JeLuF: oh,yea,is there something like "bash_escape_string" ? 13:14 i guess i need to be afraid of ;'s 13:14 < JeLuF> or $( or ` or or or 13:14 escapeshellcmd 13:15 < JeLuF> mutante: http://de2.php.net/manual-lookup.php?pattern=escape 13:15 does this sound good: $input =~ /[Aa-Zz]|[1-0]; 13:15 < TimStarling> use wfEscapeShellArg, it works on windows, kind of 13:15 thanks for all the help

output info
some intresting info here http://meta.wikimedia.org/wiki/MediaWiki_extensions_FAQ#How_do_I_render_wikitext_in_my_extension.3F

How do I render wikitext in my extension?
Use the already defined $wgOut OutputPage object to parse it.

function myHook($input) { global $wgOut; return $wgOut->parse('some wiki text'); }

The parse method by default adds &lt;p&gt; tags around the generated HTML. This may not be what you want if you want to include the HTML inline with other content that you are generating programmatically. To disable this feature, just provide an additional argument with a value of false. For example:

$wgOut->parse('some wiki text'); # Returns ' some wiki text '

$wgOut->parse('some wiki text',false); # Returns 'some wiki text'

You can also use the Parser object instead of accessing the global:

function myHook($input, $argv, &$parser) {    $output = $parser->parse(" $input ", $parser->mTitle,                              $parser->mOptions, true, false); $text = $output->getText; [...] }

On MediaWiki 1.6.3, neither forms strip UNIQ's (which replace nowiki, pre, math, and other tags). Is it possible to render completely wikitext to HTML in an extension? --Shellreef 00:07, 1 June 2006 (UTC)

Alternative approach to extending Wikitext
The above options indeed replace all but the last extension tag with those wacky UNIQ3421234asD-w-QWE texts. Playing around a bit, I went to the source: Parser.php. This is strictly speaking not an extension-fix — it's another way to accomplish the same task. Open Parser.php, and right at the beginning of function parse include:

include "./extensions/custom_tags.php";

Then, create that custom_tags.php file and fill in whatever replace-rules you need:

$text = preg_replace ("#\[t](.+?)\[/t]#is", "\\1 ", $text); $text = preg_replace ("#\[pas](.+?)\[/pas]#is", "\\1 ", $text);

And so on and so forth. I'm creating our tags in BBCode style, but you can do any replacements you want in this way. Tested with 1.6.6. (People, mention the software version number on which your hacks work!) —Madhava 22:38, 8 June 2006 (UTC)


 * Actually, it's better to stick the include towards the end of the function, just before:

wfRunHooks( 'ParserAfterTidy', array( &$this, &$text ) );


 * I noticed some quirks with paragraph creation etc. if they were in the beginning - content with divs didn't receive tags. --Madhava 18:09, 12 June 2006 (UTC)