Currently we have %f for the entire buffer to be written out to a file and that temporary file made available to scripts. Could we also have the selection available as a temporary file as well rather than just as a block of text?

I've written a tool to evaluate scripts in the form '$[' language ':' script ']$' but would like to be able to limit evaluation to the selected script rather than evaluate the entire buffer, which is the default when running a custom tool.


For example, if I have a page containing

Bruce'sOwnZimExtension
======================
Created Wednesday 13 May 2015

$[php:
<?php
function spreadCamel($txt)
{
$temp = substr($txt,0,1);
for ($i = 1; $i < strlen($txt); $i++) {
$c = substr($txt, $i, 1);
if (ctype_upper($c) || ctype_digit($c)) {
$temp = $temp . " ";
}
$temp = $temp . $c;
}
return $temp;
}
echo spreadCamel("MyDogHasFleasAbout1Million");
]$

$[php:
<?php
echo 9 * 9 * 9 * 9;
]$

$[jscript:
WScript.Echo("foo");
]$

$[8th:
"hello world" s:rev .
bye
]$

If I execute my custom tool which uses %f then I end up with

Bruce'sOwnZimExtension

Created Wednesday 13 May 2015

$[php:
<?php
function spreadCamel($txt)
{
$temp = substr($txt,0,1);
for ($i = 1; $i < strlen($txt); $i++) {
$c = substr($txt, $i, 1);
if (ctype_upper($c) || ctype_digit($c)) {
$temp = $temp . " ";
}
$temp = $temp . $c;
}
return $temp;
}
echo spreadCamel("MyDogHasFleasAbout1Million");
]$
->
My Dog Has Fleas About 1 Million<-

$[php:
<?php
echo 9 * 9 * 9 * 9;
]$
->
6561<-

$[jscript:
WScript.Echo("foo");
]$
->foo
<-

$[8th:
"hello world" s:rev .
bye
]$
->dlrow olleh<-

That is, all the scripts get evaluated. I'd like to be able to evaluate only the script selected.

Regards,
Bruce
--
Using Opera's mail client: http://www.opera.com/mail/
_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to