Re: [Zim-wiki] Using bash scripts as custom tools

2013-11-05 Thread Mariano Draghi
2013/11/5 Sylvain Viart 

> Is this doc (Zim's manual) also available on-line?
> so we can also put easy link to it. :-)
>

Yes, you can find all the documentation online,here:
http://zim-wiki.org/manual/Start.html

Regards,


--
Mariano
___
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


Re: [Zim-wiki] Using bash scripts as custom tools

2013-11-05 Thread Sylvain Viart

Le 05/11/2013 12:53, Jaap Karssenberg a écrit :
Have a look at the "custom tool" feature in zim. You can provide 
special codes to get certain arguments to the command.


Oh great! Thanks pointing me that's feature, I already love it…

snippet from the doc…


When defining a command, you can use the following parameters to 
supply the external program with some context information from within zim:


*%f*for page source as a temporary file
*%d*for the attachment <./Attachments.html> directory of the 
current page

*%s*for the real page source file (if any)
*%n*for the notebook location (file or folder)
*%D*for the document root (if any)
*%t* for the selected text or word under cursor



So those variable are evaluated by Zim, not by bash.
As you proposed in your first answer. It makes sens now.

Is this doc (Zim's manual) also available on-line?
so we can also put easy link to it. :-)


Btw. I believe Josh already got it to work as a bash script.


Yep, I experienced some mail address confusion and my reply was never 
posted in fact. :-\


Regards,
Sylvain.

___
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


Re: [Zim-wiki] Using bash scripts as custom tools

2013-11-05 Thread Jaap Karssenberg
Sylvain,

Have a look at the "custom tool" feature in zim. You can provide special
codes to get certain arguments to the command.

Btw. I believe Josh already got it to work as a bash script.

Regards,

Jaap



On Tue, Nov 5, 2013 at 11:13 AM, Sylvain Viart wrote:

> Hi,
>
> Le 30/10/2013 08:52, Jaap Karssenberg a écrit :
>
>  bash -c 'for i in %d/*.JPG; do echo "{{./$i?width=700}}" >> %s; done
>>
>
> Could you put, some lines of what output you expect?
>
> %d and %s and, even %letter, is not a bash feature…
>
> What does this %% means to you?
>
> A small script (read: save the commands into a text file) will do the
> trick easily, hopefully. :-)
>
> Of course you can use any other programming language to accomplish the
> job, are you under GNU/linux or windows?
>
> As a teaser, here's the command which list all the jpg of the current dir:
>
> for f in `ls | grep -i JPG`; do echo "{{./$f?width=700}}"; done
>
> it ouputs:
>
> {{./planche-photo.jpg?width=700}}
>
> Note that:
>
> ls | grep -i JPG
>
>
> is a sub command which actually lists the jpg file with case insensitive,
> under GNU/Linux it's matter.
>
> Regards,
> Sylvain.
>
> ___
> 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
>
___
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


Re: [Zim-wiki] Using bash scripts as custom tools

2013-11-05 Thread Sylvain Viart

Hi,

Le 30/10/2013 08:52, Jaap Karssenberg a écrit :

bash -c 'for i in %d/*.JPG; do echo "{{./$i?width=700}}" >> %s; done


Could you put, some lines of what output you expect?

%d and %s and, even %letter, is not a bash feature…

What does this %% means to you?

A small script (read: save the commands into a text file) will do the 
trick easily, hopefully. :-)


Of course you can use any other programming language to accomplish the 
job, are you under GNU/linux or windows?


As a teaser, here's the command which list all the jpg of the current dir:

for f in `ls | grep -i JPG`; do echo "{{./$f?width=700}}"; done

it ouputs:

{{./planche-photo.jpg?width=700}}

Note that:

ls | grep -i JPG


is a sub command which actually lists the jpg file with case 
insensitive, under GNU/Linux it's matter.


Regards,
Sylvain.

___
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


Re: [Zim-wiki] Using bash scripts as custom tools

2013-10-30 Thread Jaap Karssenberg
On Wed, Oct 30, 2013 at 8:09 AM, Joshua Mendelsohn wrote:

> Hi,
>
> I've been trying to use bash for quick and dirty custom tools but have not
> had any luck. I can't understand why this is not working, unless the
> quoting is messing up the expansion of %s and %d. Here is the command I
> write in custom tools:
>
> bash -c 'for i in %d/*.JPG; do echo "{{./$i?width=700}}" >> %s; done'
>
> It is intended to place all the images in the attachment folder into the
> main document. Alas, no luck. I run the custom tool from zim, it updates
> the index, but the page is unchanged. Replacing %s by %f does not work. Is
> there any way to use bash scripts as custom tools in zim?
>

Probably the substitution of "%d" and "%f" doesn't work here because they
are only replaced when they appear as single arguments. (You can check what
is actually executed by running "zim -D".)

My guess is that the easiest way to get it to work is to save the script to
a file, using positional arguments in the command ($1 and $2 instead of %d
and %s). Then call the script from the custom command as "bash myscript.sh
%d %s".

Hope this helps,

Jaap
___
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


[Zim-wiki] Using bash scripts as custom tools

2013-10-30 Thread Joshua Mendelsohn
Hi,

I've been trying to use bash for quick and dirty custom tools but have not
had any luck. I can't understand why this is not working, unless the
quoting is messing up the expansion of %s and %d. Here is the command I
write in custom tools:

bash -c 'for i in %d/*.JPG; do echo "{{./$i?width=700}}" >> %s; done'

It is intended to place all the images in the attachment folder into the
main document. Alas, no luck. I run the custom tool from zim, it updates
the index, but the page is unchanged. Replacing %s by %f does not work. Is
there any way to use bash scripts as custom tools in zim?

Cheers,
Josh
___
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