On 10/8/2018 11:36 PM, m...@gilleswaeber.ch wrote:
Hi,
I'm trying to setup the path for images using environment variables but
calling context.setupexternalfigures does not work for me. I am using the
latest version 2018.10.08 17:44 on Windows.

\directlua{
% This one works fine
%context("\\setupexternalfigures[directory={images, " ..
os.getenv('IMG_PATH'):gsub('\\', '/') .. "}]")
% Those do not (state: unknown)
context.setupexternalfigures({directory = {{'images',
os.getenv('IMG_PATH'):gsub('\\', '/')}}})
context.setupexternalfigures {directory = {{'images',
os.getenv('IMG_PATH'):gsub('\\', '/')}}}
context.setupexternalfigures({'images', os.getenv('TEX_PATH'):gsub('\\',
'/')})
}
\starttext
\externalfigure[cow]
\stoptext

Called with $env:IMG_PATH =
'D:\Applications\Context\tex\texmf-context\tex\context\sample\common';
context test.tex

Additionally, using a path with non-ascii symbols in environment variables
does not seem to work at all but this is not a big issue for me.

How should I call context.setupexternalfigures?
\directlua{
    context.setupexternalfigures {
% directory = { 'images', (string.gsub(os.getenv('IMG_PATH'),'\\', '/')) } % directory = { 'images', resolvers.cleanpath(os.getenv('IMG_PATH')) }
        directory = { 'images', resolvers.expandpath('IMG_PATH') }
    }
}

(or pass the path on the command line, say --imagepath=... and get it with document.arguments.imagepath)

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to