[NTG-context] Problem with Filter Module in latent context beta

Hans Hagen j.hagen at xs4all.nl
Mon Apr 16 19:55:31 CEST 2018


On 4/16/2018 6:52 PM, Aditya Mahajan wrote:
> On Sun, 15 Apr 2018, Hans Hagen wrote:
> 
>> \start
>> \def\obeyedline{\blank[line]} \obeylines
> 
> Thanks! Not sure why I wasn't using that since the beginning.
> 
> I am testing with the latest beta and I get another bug with reading 
> http files. This is a simplified version of what I use in the filter 
> module:
> 
>     \unprotect
>      \def\AnyFilename#1%
>          {\ctxcommand{getreadfilename("any",".","#1")}}
> 
>      \def\ProcessFile#1%
>        {\edef\InputFile{\AnyFilename{#1}}%
>         \InputFile
>         \typefile[\InputFile]}
>      \protect
>      \starttext
>      \ProcessFile{http://cim.mcgill.ca/~adityam/index.html}
>      \stoptext
> 
> With the latest beta, I get the following error:
> 
> 
> ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: bad 
> argument #1 to 'find' (string expected, got nil)
> stack traceback:
>          [C]: in function 'string.find'
>          
> ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: in 
> upvalue 'action1'
>          [string "local action = tokens._action..."]:4: in field 
> 'getreadfilename'
>          [ctxlua]:1: in main chunk
> 
> 
> Not sure why #1 is being passed to the lua function instead of the 
> expanded value of "#1".
hm, i'll check it

#1 just means first argument in lua -)

use this:

\unprotect
\def\AnyFilename#1{\clf_getreadfilename{any}{.}{#1}}
\protect


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list