* run a ruby script and use the standard output ???
@ 2006-09-27 21:08 Renaud AUBIN
2006-09-28 7:45 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Renaud AUBIN @ 2006-09-27 21:08 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 657 bytes --]
Hi all,
Is it possible to run a ruby script from a context document during its
processing (I already know how to do that using \write18 but there is
maybe a better way...) then get the output of the script to display or
use it into the document. It's a little bit hard to describe so I have a
simple example:
\starttext
\def\vartest{3.124325234543523452435}
\write18{ruby ./myscript.rb \vartest
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}
\stoptext
with myscript.rb:
temp = ARGV[0]
puts "\nXXXXXXXXXXXXX " + (Math::sqrt(temp.to_f)).to_s + " XXXXXXXXXXXXX\n"
I would store the result of puts into a variable usable within ConTeXt...
Renaud
[-- Attachment #1.2: Type: text/html, Size: 1018 bytes --]
[-- Attachment #2: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-27 21:08 run a ruby script and use the standard output ??? Renaud AUBIN
@ 2006-09-28 7:45 ` Hans Hagen
2006-09-28 9:18 ` Taco Hoekwater
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-09-28 7:45 UTC (permalink / raw)
Renaud AUBIN wrote:
> Hi all,
>
> Is it possible to run a ruby script from a context document during its
> processing (I already know how to do that using \write18 but there is
> maybe a better way...) then get the output of the script to display or
> use it into the document. It's a little bit hard to describe so I have
> a simple example:
>
> \starttext
> \def\vartest{3.124325234543523452435}
> \write18{ruby ./myscript.rb \vartest
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}
> \stoptext
>
> with myscript.rb:
>
> temp = ARGV[0]
> puts "\nXXXXXXXXXXXXX " + (Math::sqrt(temp.to_f)).to_s + "
> XXXXXXXXXXXXX\n"
>
> I would store the result of puts into a variable usable within ConTeXt...
>
piping: the latest versions of pdftex support this (i\ve forgotten the syntax, but taco who wrote the patch may remember)
you can also let ruby write a definition to a file temp.tmp which you can read in
however, luatex can do:
\edef\SomeVar{\lua{tex.print(math.sqrt(3.124325234543523452435))} or
\def\GimmeARoot#1{\lua{tex.print(math.sqrt(#1))}
actually, this is one of the examples i use in prelim demos at user group meetings -)
so, be a bit patient and it will come your way ...
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-28 7:45 ` Hans Hagen
@ 2006-09-28 9:18 ` Taco Hoekwater
2006-09-29 15:34 ` Renaud AUBIN
0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-09-28 9:18 UTC (permalink / raw)
Hans Hagen wrote:
> piping: the latest versions of pdftex support this (i\ve forgotten the syntax, but taco who wrote the patch may remember)
piping syntax:
\input "|ruby ./myscript.rb \vartest XXXXXXXXX"
the magic trick is the | symbol. With your current tex:
\writ18{ruby ./myscript.rb \vartest XXXXXXXXX > whatever.tex}
\input whatever % or something using \openin ...
Taco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-28 9:18 ` Taco Hoekwater
@ 2006-09-29 15:34 ` Renaud AUBIN
2006-09-29 15:45 ` Taco Hoekwater
0 siblings, 1 reply; 10+ messages in thread
From: Renaud AUBIN @ 2006-09-29 15:34 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 869 bytes --]
\starttext
\input "|ls"
\stoptext
leads to
(/usr/share/texmf-tetex/tex/latex/tools/.tex File ignored)
Runaway argument?
ls"
! Paragraph ended before \next was complete.
<to be read again>
\par
???
Taco Hoekwater a écrit :
>Hans Hagen wrote:
>
>
>>piping: the latest versions of pdftex support this (i\ve forgotten the syntax, but taco who wrote the patch may remember)
>>
>>
>
>piping syntax:
>
> \input "|ruby ./myscript.rb \vartest XXXXXXXXX"
>
>the magic trick is the | symbol. With your current tex:
>
> \writ18{ruby ./myscript.rb \vartest XXXXXXXXX > whatever.tex}
> \input whatever % or something using \openin ...
>
>
>Taco
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
>
>
[-- Attachment #1.2: Type: text/html, Size: 1568 bytes --]
[-- Attachment #2: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-29 15:34 ` Renaud AUBIN
@ 2006-09-29 15:45 ` Taco Hoekwater
2006-09-29 18:24 ` Renaud AUBIN
0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-09-29 15:45 UTC (permalink / raw)
Renaud AUBIN wrote:
> \starttext
>
> \input "|ls"
>
> \stoptext
>
> leads to
>
> (/usr/share/texmf-tetex/tex/latex/tools/.tex File ignored)
> Runaway argument?
> ls"
> ! Paragraph ended before \next was complete.
> <to be read again>
> \par
>
> ???
The pipe symbol has to be non-active (\catcode`\|=12 )
Taco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-29 15:45 ` Taco Hoekwater
@ 2006-09-29 18:24 ` Renaud AUBIN
2006-09-29 18:54 ` Taco Hoekwater
0 siblings, 1 reply; 10+ messages in thread
From: Renaud AUBIN @ 2006-09-29 18:24 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 220 bytes --]
Taco Hoekwater a écrit :
> The pipe symbol has to be non-active (\catcode`\|=12 )
>
>Taco
>
>
\starttext
\catcode`\|=12
\input "|ls -l"
\stoptext
! I can't find file `"|ls -l"'.
l.7 \input "|ls -l"
[-- Attachment #1.2: Type: text/html, Size: 635 bytes --]
[-- Attachment #2: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-29 18:24 ` Renaud AUBIN
@ 2006-09-29 18:54 ` Taco Hoekwater
2006-09-29 19:18 ` Renaud AUBIN
2006-09-29 19:45 ` Renaud AUBIN
0 siblings, 2 replies; 10+ messages in thread
From: Taco Hoekwater @ 2006-09-29 18:54 UTC (permalink / raw)
Renaud AUBIN wrote:
> \starttext
>
> \catcode`\|=12
> \input "|ls -l"
>
> \stoptext
>
> ! I can't find file `"|ls -l"'.
And all you need now is the latest pdftex -)
http://sarovar.org/project/showfiles.php?group_id=106&release_id=752
Taco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-29 18:54 ` Taco Hoekwater
@ 2006-09-29 19:18 ` Renaud AUBIN
2006-09-29 19:45 ` Renaud AUBIN
1 sibling, 0 replies; 10+ messages in thread
From: Renaud AUBIN @ 2006-09-29 19:18 UTC (permalink / raw)
Taco Hoekwater a écrit :
>And all you need now is the latest pdftex -)
>
> http://sarovar.org/project/showfiles.php?group_id=106&release_id=752
>
>Taco
>
>
Thanks
Yes, I finally realized that... ;) I'm now on my way to upgrade it...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-29 18:54 ` Taco Hoekwater
2006-09-29 19:18 ` Renaud AUBIN
@ 2006-09-29 19:45 ` Renaud AUBIN
2006-09-30 6:47 ` Taco Hoekwater
1 sibling, 1 reply; 10+ messages in thread
From: Renaud AUBIN @ 2006-09-29 19:45 UTC (permalink / raw)
Taco Hoekwater a écrit :
>And all you need now is the latest pdftex -)
>
> http://sarovar.org/project/showfiles.php?group_id=106&release_id=752
>
>Taco
>
>
Is it normal that pdfetex.pool is no more built ?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: run a ruby script and use the standard output ???
2006-09-29 19:45 ` Renaud AUBIN
@ 2006-09-30 6:47 ` Taco Hoekwater
0 siblings, 0 replies; 10+ messages in thread
From: Taco Hoekwater @ 2006-09-30 6:47 UTC (permalink / raw)
Renaud AUBIN wrote:
> Taco Hoekwater a écrit :
>
>
>>And all you need now is the latest pdftex -)
>>
>> http://sarovar.org/project/showfiles.php?group_id=106&release_id=752
>>
>>Taco
>>
>
> Is it normal that pdfetex.pool is no more built ?
Yes. There is now only one executable, pdftex. It contains all code
that was previously in pdfetex and the `bare' pdftex is gone.
Taco
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-09-30 6:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-27 21:08 run a ruby script and use the standard output ??? Renaud AUBIN
2006-09-28 7:45 ` Hans Hagen
2006-09-28 9:18 ` Taco Hoekwater
2006-09-29 15:34 ` Renaud AUBIN
2006-09-29 15:45 ` Taco Hoekwater
2006-09-29 18:24 ` Renaud AUBIN
2006-09-29 18:54 ` Taco Hoekwater
2006-09-29 19:18 ` Renaud AUBIN
2006-09-29 19:45 ` Renaud AUBIN
2006-09-30 6:47 ` Taco Hoekwater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).