ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Asymptote or Metapost and ConTeXt parameters.
Date: Fri, 23 Dec 2016 11:22:01 -0800 (PST)	[thread overview]
Message-ID: <alpine.OSX.2.02.1612231115540.63924@nqv-znpobbx> (raw)
In-Reply-To: <D12263DC-BE95-4B19-8405-43B2988F72AD@gyza.cz>

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
___________________________________________________________________________________

  reply	other threads:[~2016-12-23 19:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19  7:41 Jaroslav Hajtmar
2016-12-19  9:10 ` Fabrice Couvreur
2016-12-19  9:43   ` Hans Hagen
2016-12-19 16:19 ` Aditya Mahajan
2016-12-20 10:34   ` Jaroslav Hajtmar
2016-12-22  4:49     ` Aditya Mahajan
2016-12-23  8:02       ` Jaroslav Hajtmar
2016-12-23 19:22         ` Aditya Mahajan [this message]
2016-12-23 20:28           ` Hans Hagen
2016-12-24  2:55           ` Jaroslav Hajtmar
2016-12-24  3:05             ` Aditya Mahajan
2016-12-20 22:14   ` Alan Braslau
2016-12-21  7:49     ` Aditya Mahajan
2017-03-19 18:01     ` Passing data back and forth between metapost and lua Aditya Mahajan
2017-03-19 18:29       ` Aditya Mahajan
2017-03-19 19:02         ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.02.1612231115540.63924@nqv-znpobbx \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).