Zim

Request for custom tools - selection to file

Asked by Bruce M. Axtens on 2015-05-13

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 as the %t or %T selection.

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.

Question information

Language:
English Edit question
Status:
Answered
For:
Zim Edit question
Assignee:
No assignee Edit question
Last query:
2015-06-13
Last reply:
2015-06-13
Launchpad Janitor (janitor) said : #1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

You can get the selection as an parameter, you would need to write it out to a tmp file in your script.

REgards,

Jaap

Bruce M. Axtens (bruceax) said : #3

Thanks, Jaap.

The problem with that in the Windows context is that the command line isn't as smart as it is in Linux. If the selection contains a newline then the Windows CLI interprets the command as finishing at that point. Thus I can't captures a multiline selection to a temporary file.

It was for the benefit of Windows users forced to function with a sucky CLI that I originally asked for the selection to be saved to file.

Kind regards,
Bruce.

Ah, I hadn't foreseen that ....

I have an idea on the shelve that might help here: what if we allow custom
tools to behave as pipes?

In this case you would get selection on STDIN and STDOUT is used to replace
it.

Would that work for you ?

Regards,

Jaap

On Sat, Jun 13, 2015 at 4:36 PM, Bruce M. Axtens <
<email address hidden>> wrote:

> Question #266872 on Zim changed:
> https://answers.launchpad.net/zim/+question/266872
>
> Status: Expired => Open
>
> Bruce M. Axtens is still having a problem:
> Thanks, Jaap.
>
> The problem with that in the Windows context is that the command line
> isn't as smart as it is in Linux. If the selection contains a newline
> then the Windows CLI interprets the command as finishing at that point.
> Thus I can't captures a multiline selection to a temporary file.
>
> It was for the benefit of Windows users forced to function with a sucky
> CLI that I originally asked for the selection to be saved to file.
>
> Kind regards,
> Bruce.
>
> --
> You received this question notification because you are an answer
> contact for Zim.
>

Bruce M. Axtens (bruceax) said : #5

Jaap

That sounds like an idea worth pursuing. If I knew any Python I'd give it a shot myself.

Kind regards,
Bruce.

Can you help with this problem?

Provide an answer of your own, or ask Bruce M. Axtens for more information if necessary.

To post a message you must log in.