ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Anyone could help me with this error in filter module?
@ 2014-07-28 14:15 Xan
  2014-07-28 14:26 ` Wolfgang Schuster
  2014-07-30  8:27 ` Xan
  0 siblings, 2 replies; 5+ messages in thread
From: Xan @ 2014-07-28 14:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Any hint on that [https://github.com/adityam/filter/issues/17], please?

Thanks,
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Anyone could help me with this error in filter module?
  2014-07-28 14:15 Anyone could help me with this error in filter module? Xan
@ 2014-07-28 14:26 ` Wolfgang Schuster
  2014-07-28 18:15   ` Aditya Mahajan
  2014-07-30  8:27 ` Xan
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2014-07-28 14:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 28.07.2014 um 16:15 schrieb Xan <dxpublica@telefonica.net>:

> Hi,
> 
> Any hint on that [https://github.com/adityam/filter/issues/17], please?

Don’t use \doifmode{…}{…} etc. with buffers or environments which rely on a buffer because you disable the function to keep end of lines in the input.

What you have to do in this case is to use the \startmode or \startnotmode commands.

\usemodule[filter]

\defineexternalfilter
    [python]
    [filtercommand={python \externalfilterinputfile\space > \externalfilteroutputfile},cache=force]

\starttext

\startmode[solucions]

\starttextrule{Solucions}

\startpython
from sympy.solvers import solve
from sympy import Symbol
from sympy import Eq

x = Symbol('x')
print(solve(Eq(3*x + 2, 35), x))
\stoppython

\stoptextrule

\stopmode

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Anyone could help me with this error in filter module?
  2014-07-28 14:26 ` Wolfgang Schuster
@ 2014-07-28 18:15   ` Aditya Mahajan
  0 siblings, 0 replies; 5+ messages in thread
From: Aditya Mahajan @ 2014-07-28 18:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1511 bytes --]

On Mon, 28 Jul 2014, Wolfgang Schuster wrote:

>
> Am 28.07.2014 um 16:15 schrieb Xan <dxpublica@telefonica.net>:
>
>> Hi,
>>
>> Any hint on that [https://github.com/adityam/filter/issues/17], please?
>
> Don’t use \doifmode{…}{…} etc. with buffers or environments which rely on a buffer because you disable the function to keep end of lines in the input.
>
> What you have to do in this case is to use the \startmode or \startnotmode commands.
>
> \usemodule[filter]
>
> \defineexternalfilter
>    [python]
>    [filtercommand={python \externalfilterinputfile\space > \externalfilteroutputfile},cache=force]
>
> \starttext
>
> \startmode[solucions]
>
> \starttextrule{Solucions}
>
> \startpython
> ....
> \stoppython
>
> \stoptextrule
>
> \stopmode
>
> \stoptext

Another option is (untested):

\defineexternalfilter
   [python]
   [
     filtercommand={...},
     before={\starttextrule{Solutions}},
     after={\stoptextrule},
   ]

\startmode[solutions]
\setupexternalfilter[python][state=stop, read=no]
\stopmode

\starttext

\startpython
...
\stoppython
\stoptext

BTW, you can simplify your setup using:

\startbuffer[sympy]
from sympy.solvers import solve
from sympy import Symbol
from sympy import Eq

x = Symbol('x')
\stopbuffer

\defineexternalfilter
   [python]
   [
     filtercommand={...},
     bufferbefore={sympy},
   ]

\starttext
\startpython
print(solve(Eq(3*x + 2, 35), x))
\stoppython
\stoptext

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Anyone could help me with this error in filter module?
  2014-07-28 14:15 Anyone could help me with this error in filter module? Xan
  2014-07-28 14:26 ` Wolfgang Schuster
@ 2014-07-30  8:27 ` Xan
  2014-07-30  8:33   ` Hans Hagen
  1 sibling, 1 reply; 5+ messages in thread
From: Xan @ 2014-07-30  8:27 UTC (permalink / raw)
  Cc: mailing list for ConTeXt users

> Am 28.07.2014 um 16:15 schrieb Xan <dxpublica at telefonica.net>:
> 
> > Hi,
> > 
> > Any hint on that [https://github.com/adityam/filter/issues/17], please?
> 
> Don’t use \doifmode{…}{…} etc. with buffers or environments which rely on a buffer because you disable the function to keep end of lines in the input.
> 
> What you have to do in this case is to use the \startmode or \startnotmode commands.
> 
> Wolfgang


Thanks Wolfgang and Aditya.
This behaviour of doifmode is not documented in the wiki. Can anyone could add it

Xan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Anyone could help me with this error in filter module?
  2014-07-30  8:27 ` Xan
@ 2014-07-30  8:33   ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2014-07-30  8:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 7/30/2014 10:27 AM, Xan wrote:
>> Am 28.07.2014 um 16:15 schrieb Xan <dxpublica at telefonica.net>:
>>
>>> Hi,
>>>
>>> Any hint on that [https://github.com/adityam/filter/issues/17], please?
>>
>> Don’t use \doifmode{…}{…} etc. with buffers or environments which rely on a buffer because you disable the function to keep end of lines in the input.
>>
>> What you have to do in this case is to use the \startmode or \startnotmode commands.
>>
>> Wolfgang
>
>
> Thanks Wolfgang and Aditya.
> This behaviour of doifmode is not documented in the wiki. Can anyone could add it

it is unrelated to doifmode but a general tex property: if you pass 
arguments the catcodes are frozen

\startmode[foo]

\stopmode

can be tried as alternative as that one doesn't pick up arguments

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-30  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 14:15 Anyone could help me with this error in filter module? Xan
2014-07-28 14:26 ` Wolfgang Schuster
2014-07-28 18:15   ` Aditya Mahajan
2014-07-30  8:27 ` Xan
2014-07-30  8:33   ` Hans Hagen

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).