ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Using context.setupexternalfigures
@ 2018-10-09 23:15 Gilles Waeber
  0 siblings, 0 replies; 3+ messages in thread
From: Gilles Waeber @ 2018-10-09 23:15 UTC (permalink / raw)
  To: ntg-context

09 October 2018 10:53 Hans Hagen  wrote:
 >  On 10/8/2018 11:36 PM, [moi@gilleswaeber.ch](mailto:moi@gilleswaeber.ch) wrote: 
 >  > 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) 
 
 It seems the problem was that directory must not be an array. This one worked for me:
 context.setupexternalfigures { directory = 'images,' .. resolvers.expandpath('IMG_PATH') }
 
 Thanks,
 Gilles


___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Using context.setupexternalfigures
  2018-10-08 21:36 moi
@ 2018-10-09  8:53 ` Hans Hagen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2018-10-09  8:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users, moi

On 10/8/2018 11:36 PM, moi@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
___________________________________________________________________________________

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

* Using context.setupexternalfigures
@ 2018-10-08 21:36 moi
  2018-10-09  8:53 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: moi @ 2018-10-08 21:36 UTC (permalink / raw)
  To: ntg-context; +Cc: moi

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?

Best regards,
Gilles

___________________________________________________________________________________
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
___________________________________________________________________________________

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

end of thread, other threads:[~2018-10-09 23:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-09 23:15 Using context.setupexternalfigures Gilles Waeber
  -- strict thread matches above, loose matches on Subject: below --
2018-10-08 21:36 moi
2018-10-09  8:53 ` 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).