Hello Adytia.
It seems now, that everything at this time works as intended. Many thanks for your support. Below is a minimal example. Attached is a PDF sample result.
I tried also to experiment with the choice "object = no", as suggested by Hans, but without success. I would asking if you make any changes in filter module?
Or have I misunderstood Your opinion?
Thank you once again
Jaroslav Hajtmar
Here is minimal example:
\usemodule[filter]
\unprotect
\appendtoks
\setuevalue{set\currentexternalfilter buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter
\unexpanded\def\externalfilter@set
{\dodoubleargument\externalfiter@set_indeed}
\starttexdefinition externalfiter@set_indeed [#1][#2]#3
% #1 = filter
% #2 = options
\begingroup
\edef\currentexternalfilter{#1}
\setupexternalfilter[#1][\c!name=,#2]
\externalfilter@set_filenames
\setbuffer[\externalfilter@buffer_name]#3\endbuffer
\externalfilter@process_filter
\stoptexdefinition
\protect
\defineexternalfilter
[ASY]
[
filtercommand={asy -tex context \externalfilterinputfile\space -o \externalfilteroutputfile}, output=\externalfilterbasefile.pdf,
purge=no,
cache=yes,
readcommand=\ReadImage,
]
\define[1]\ReadImage{\externalfigure[#1]}
\define[1]\mycircle{
\setASYbuffer{
import graph;
draw(Circle((0,0),#1));
}}
\starttext
\startASY
import graph;
draw((0,0)--(100,100));
\stopASY
\mycircle{10}
\mycircle{20}
\mycircle{30}
\stoptext
Dne 23.12.16 20:22, ntg-context za uživatele Aditya Mahajan napsal(a):
On Fri, 23 Dec 2016, Jaroslav Hajtmar wrote:
> Thanks for sending Your code. It seems that it works with Asymptote.
> Unfortunately, when I am trying to multiple call a macro then I get
> fatal error, and then compile collapse. I do not know what it could be.
When called for the first time, the code generates test-ASY.pdf file and
includes it. After the second call, a new test-ASY.pdf is generated.
ConTeXt generates an error because the name of the files is the same, but
the content is not.
There should be an option for \externalfigure to disable this check, but I
couldn't find it. Here is an alternative approach, that changes the name
of the PDF.
\usemodule[filter]
\unprotect
\appendtoks
\setuevalue{set\currentexternalfilter buffer}{\externalfilter@set[\currentexternalfilter]}%
\to \everydefineexternalfilter
\unexpanded\def\externalfilter@set
{\dodoubleargument\externalfiter@set_indeed}
\starttexdefinition externalfiter@set_indeed [#1][#2]#3
% #1 = filter
% #2 = options
\begingroup
\edef\currentexternalfilter{#1}
\setupexternalfilter[#1][\c!name=,#2]
\externalfilter@set_filenames
\setbuffer[\externalfilter@buffer_name]#3\endbuffer
\externalfilter@process_filter
\stoptexdefinition
\protect
\defineexternalfilter
[MARKDOWN]
[
filtercommand={pandoc -f markdown -t context \externalfilterinputfile\space -o \externalfilteroutputfile},
cache=yes,
purge=no,
]
\define[1]\NEW
{\setMARKDOWNbuffer{This is #1}}
\traceexternalfilters
\starttext
\startMARKDOWN
This is **one**
\stopMARKDOWN
\NEW{**ONE**}
\NEW{_TWO_}
\stoptext
Note that this has the same limitation as using \type{...}. The contents of
\NEW{...} must have matched braces. If this works, I can include the code in
t-filter (mkiv only, as I no longer want to maintain the mkii branch).
Aditya
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________