Re: [NTG-context] Fwd: Re: roadmap

2018-05-16 Thread Hans Hagen

On 5/16/2018 7:59 PM, Pablo Rodriguez wrote:

On 05/16/2018 05:37 PM, Hans Hagen wrote:

[...]
actually it was something that came up when talking with Hermann Zapf
years ago: he suggested to just vertically scale the text area (i
actully implemented that an hour later) ... his opinion was that only a
very small percentage of readers will notice (at that time we did
experiments with hz, the expansion in pdftex: in fact nobody noticed
that too, real interesting was that texies commented on all kind of
things related to how tex is supposed to work: a clear demonstration
that the average user knows what the virtues of tex are but not really
sees it)

[...]
How can I use the vertical scale feature to prevent widows and orphans?
not now ... it was a mkii experiment more than a decade ago


Would it be possible to have it in MkIV?

Many thanks for your help,
probably but not today (and i need to think about it first as it might 
have side effects


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
___

Re: [NTG-context] roadmap

2018-05-16 Thread Fabrice L
Dear all,

> - Check what additional features users want (miss) and decide to what
extent and with what priority we will put effort in this.

As asked, I add a wish to the list...

One feature which I depend a lot on is to be able to do animations: I
actually use the Raw Steps module, by David Munger (dated from 2006), which
still worked, but in MKII only. This is essential for me for my teaching
and talks. During teaching, I have designed courses notes in ConText using
a lot modes of context: the notes are different for the teacher, are
available in two formats for the students (paper and for completion on
tablets), and there is a last version for use in the class by me. In class,
this is essential for me that the material is presented by steps, otherwise
students have a tendency to not listen, or to not try to solve a problem is
the solution is already on the screen. I can not use the animation
tools available in ConTexT using javascript, since I use to show notes in
class an iPad, and I use the stylus to fill blanks present in the notes
(which work great by the way !). The facility to use modes in the courses
notes like this have convinced several of my colleagues to use ConTeXt for
their teaching needs.

Following threads on this list on animations, my understanding is that Hans
is not a great supporter of the method of animations in the Raw Steps
module, for technical reasons.

I have switch to MKIV for others documents, but I'm still on MKII for this
reason for my courses notes, which are 90% one my needs in TeX.
Fabrice.

2018-05-14 11:17 GMT-04:00 Hans Hagen :

> Hi,
>
> The ConTeXt meeting is - as usual - the right place and moment to discuss
> the roadmap. We never had real binding roadmaps, more informal ones.
> Anyway, here are some thoughts on the two main components: MkIV and LuaTeX.
>
> ConTeXt MkIV:
>
> - Check if some mechanism can (by now) be simplified due to LuaTeX
> extension introduced the last few years that can be considered stable by
> now. This has a low impact as we already use Lua a lot.
>
> - Figure out what mechanism in ConTeXt are bottlenecks in performance if
> there are such bottlenecks at all. We need user input on this.
>
> - Get rid of inconsistencies in the user interface e.g. by introducing new
> commands with settings.
>
> - Check what additional features users want (miss) and decide to what
> extent and with what priority we will put effort in this. We've reached a
> point where interference prevents more complex extensions.
>
> - Try to improve tricky mechanisms, like columns and tables. Improvements
> are of course always on the agenda.
>
> - We can add more trickery for fonts and scripts. There are some pending
> extensions.
>
> - Maybe we should provide a few more general styles.
>
> - Are there reasonable challenges left.
>
> LuaTeX 1.09:
>
> - This version is pretty close to what is the final version (seen from the
> functional point of view). We're still debating where to move after this.
> LuaTeX 2.0? A stripped down (lean and mean) version specific for ConTeXt?
> Keep in mind that we cannot fundamentally change something, even if we want
> to, because other macro packages use it and don't expect it to change much.
>
> - There will probably be some more options in controlling math (given
> issues with fonts). We have to accept that not everything has a generic
> programmable solution (which is why we have Lua on board).
>
> - There might be a few more callbacks but probably nothing fundamental is
> planned.
>
> - We keep cleaning up the code base (less code is better, less
> dependencies too, some documentation is missing or not yet adapted to the
> new code). For instance the pdf inclusion code will soon be redone (and
> then tested in the ConTeXt distribution as usual).
>
> - When possible we will try to improve performance but there is not much
> to gain to be expected there.
>
> - We will also keep up with Lua (currently 5.3, some day 5.4). It is
> unclear to what extent LuaJit follows. When it stays behind we need to
> decide if support in ConTeXt will stay (to some extent we can have dual
> code paths as we have now).
>
> - We expect the ffi interface to external libraries to become more stable
> over time. ConTeXt will not introduce dependencies (what can be done in Lua
> will happen in Lua) but on the other hand we might put some libraries in
> the distribution e.g. for database support.
>
> - We might add some extensions to MetaPost in MPLib.
>
> In addition we could formulate ideas with respect to the distribution,
> garden, documentation and so on.
>
> You can react on this list but if you come to the meeting, you can
> participate in discussions.
>
> So far for now,
>
> Hans
>
> -
>   Hans Hagen | PRAGMA ADE
>   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>tel: 038 477 53 69 | www.pragma-ade.nl | 

Re: [NTG-context] Fwd: Re: roadmap

2018-05-16 Thread Pablo Rodriguez
On 05/16/2018 05:37 PM, Hans Hagen wrote:
>>> [...]
>>> actually it was something that came up when talking with Hermann Zapf
>>> years ago: he suggested to just vertically scale the text area (i
>>> actully implemented that an hour later) ... his opinion was that only a
>>> very small percentage of readers will notice (at that time we did
>>> experiments with hz, the expansion in pdftex: in fact nobody noticed
>>> that too, real interesting was that texies commented on all kind of
>>> things related to how tex is supposed to work: a clear demonstration
>>> that the average user knows what the virtues of tex are but not really
>>> sees it)
>> [...]
>> How can I use the vertical scale feature to prevent widows and orphans?
>> not now ... it was a mkii experiment more than a decade ago

Would it be possible to have it in MkIV?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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
___

[NTG-context] Fwd: Re: roadmap

2018-05-16 Thread Hans Hagen




 Forwarded Message 
Subject: Re: [NTG-context] roadmap
Date: Wed, 16 May 2018 17:37:30 +0200
From: Hans Hagen 
To: Pablo Rodriguez 

On 5/16/2018 5:18 PM, Pablo Rodriguez wrote:

On 05/15/2018 11:26 PM, Hans Hagen wrote:

On 5/15/2018 9:17 PM, Pablo Rodriguez wrote:

[...]
Hans,

I wonder whether it would be possible to implement a feature that you
mentioned in the past.

In order to avoid widow and orphan lines, you mentioned that it would be
possible to automatically adapt the interline space for the page, so
that it may have one more line to avoid orphans (when interline space is
decreased) or it may move a line to the next page to avoid widows
(increasing the interline space in the present page).

Would it be possible to add this feature to ConTeXt?


actually it was something that came up when talking with Hermann Zapf
years ago: he suggested to just vertically scale the text area (i
actully implemented that an hour later) ... his opinion was that only a
very small percentage of readers will notice (at that time we did
experiments with hz, the expansion in pdftex: in fact nobody noticed
that too, real interesting was that texies commented on all kind of
things related to how tex is supposed to work: a clear demonstration
that the average user knows what the virtues of tex are but not really
sees it)


I must confess that I can recognize hanging characters, but quality
expansion is impossible to see (at least, for me).

I would even say that if expansion can be seen by a human reader, the
results will be crappy.

How can I use the vertical scale feature to prevent widows and orphans?

not now ... it was a mkii experiment more than a decade ago

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
___

Re: [NTG-context] roadmap

2018-05-16 Thread Pablo Rodriguez
On 05/15/2018 11:26 PM, Hans Hagen wrote:
> On 5/15/2018 9:17 PM, Pablo Rodriguez wrote:
>> [...]
>> Hans,
>>
>> I wonder whether it would be possible to implement a feature that you
>> mentioned in the past.
>>
>> In order to avoid widow and orphan lines, you mentioned that it would be
>> possible to automatically adapt the interline space for the page, so
>> that it may have one more line to avoid orphans (when interline space is
>> decreased) or it may move a line to the next page to avoid widows
>> (increasing the interline space in the present page).
>>
>> Would it be possible to add this feature to ConTeXt?
> 
> actually it was something that came up when talking with Hermann Zapf 
> years ago: he suggested to just vertically scale the text area (i 
> actully implemented that an hour later) ... his opinion was that only a 
> very small percentage of readers will notice (at that time we did 
> experiments with hz, the expansion in pdftex: in fact nobody noticed 
> that too, real interesting was that texies commented on all kind of 
> things related to how tex is supposed to work: a clear demonstration 
> that the average user knows what the virtues of tex are but not really 
> sees it)

I must confess that I can recognize hanging characters, but quality
expansion is impossible to see (at least, for me).

I would even say that if expansion can be seen by a human reader, the
results will be crappy.

How can I use the vertical scale feature to prevent widows and orphans?

Many thanks for your help,

Pablo

>> I have another feature request for notes, but I would like to know
>> whether the feature to avoid widow and orphan lines can be implemented
>> in ConTeXt.
> you can always ask ... giving it priority is another matter
> 
> 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
> ___
> 


-- 
http://www.ousia.tk
___
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
___

Re: [NTG-context] Files on a server

2018-05-16 Thread Taco Hoekwater


> On 16 May 2018, at 15:41, Hans Hagen  wrote:
> 
> On 5/16/2018 2:58 PM, Hans van der Meer wrote:
>> Beste Taco,
>> Ik probeer jouw oplossing maar er gebeurt nog iets raars. Ik krijg inderdaad 
>> 200 resp. 404 terug bij bestaande niet-bestaande Uri’s. Maar ik krijg wel 
>> een error die aan het eind van de run gegenereerd wordt. Heb jij enig idee 
>> waar ik dat zou moeten zoeken? Als ik de call naar \verbose uitschakel komt 
>> er geen foutmelding. Blijft er na de socket call iets achter wat nog 
>> opgeruimd had moeten worden?
> 
> 
> how about adding local …

yeah.

Taco
___
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
___

Re: [NTG-context] Files on a server

2018-05-16 Thread Hans Hagen

On 5/16/2018 2:58 PM, Hans van der Meer wrote:

Beste Taco,

Ik probeer jouw oplossing maar er gebeurt nog iets raars. Ik krijg 
inderdaad 200 resp. 404 terug bij bestaande niet-bestaande Uri’s. Maar 
ik krijg wel een error die aan het eind van de run gegenereerd wordt. 
Heb jij enig idee waar ik dat zou moeten zoeken? Als ik de call naar 
\verbose uitschakel komt er geen foutmelding. Blijft er na de socket 
call iets achter wat nog opgeruimd had moeten worden?



how about adding local ...

\startluacode
local content, status, authinfo = socket.http.request {
method = "HEAD",
url= 
"http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf;,

}

print (status)

\stopluacode


Hier een deel van de context-log en de code fragmenten in kwestie. 
 is de root node van het bewerkte bestand.


HVDM-PEV-TEST   > return code: 200
HVDM-PEV        > number of events processed: 1
HVDM-PEV        > = end of takepersons =
backend         > xmp > using file 
'/Users/hansm/TeX/context-45/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'

pages           > flushing realpage 1, userpage 1, subpage 1
close source    > level 2, order 13, name 
'/Users/hansm/Documents/Genealogie/familie-event.tex'
close source    > level 1, order 13, name 
'/Users/hansm/TeX/context-45/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'


lua error       > lua error on line 0 in file :

...-45/tex/texmf-context/tex/context/base/mkiv/core-uti.lua:92: attempt 
to index a number value (global 'status')





?
Process aborted

Code in tex:
\def\URIReturnCode#1{\ctxlua{tex.print(hvdm.urireturncode("#1"))}}
\verbose{HVDM-PEV-TEST}{return code: \URIReturnCode{\theurl}}
Code in lua:
hvdm.urireturncode = function (theuri)
content, status, authinfo = socket.http.request{
method = "HEAD",
url = theuri,
}
return tostring(status)
end

Groet Hans



On 16 May 2018, at 14:23, Taco Hoekwater > wrote:



Or use luasocket, which is included in the luatex binary:

\startluacode
content, status, authinfo = socket.http.request{
   method = "HEAD",
   url = 
"http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf” 


}

print (status)

\stopluacode

prints ‘404’ in this case.

Taco

On 16 May 2018, at 13:45, Henri Menke > wrote:


On 05/16/2018 11:23 PM, Hans van der Meer wrote:

I would be satisfied when a returned 404 error code will be handled
within a reasonable (configurable) time delay. As for redirection, there
I would not mind if it is not included.
Restrictions like that are not a problem for me, because this is for
building a pdf that accesses many internet located files. The check on
existence is therefore especially meant for spotting missing or misnamed
files.


You can use libcurl via ffi: https://curl.haxx.se/libcurl/

\startluacode
local ffi = require("ffi")

ffi.cdef[[
typedef struct Curl_easy CURL;
typedef int CURLcode;
typedef int CURLoption;
typedef int CURLINFO;
typedef size_t(*callback)(void *buffer, size_t size, size_t nmemb, void
*userp);

CURLcode curl_global_init(long flags);
CURL *curl_easy_init(void);
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURLcode curl_easy_perform(CURL *curl);
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
void curl_easy_cleanup(CURL *curl);
void curl_global_cleanup(void);
]]

-- magic numbers
local CURL_GLOBAL_DEFAULT = 3
local CURLOPT_URL = 10002
local CURLOPT_NOBODY = 44
local CURLOPT_HEADER = 42
local CURLOPT_WRITEFUNCTION = 20011
local CURLINFO_RESPONSE_CODE = 0x20 + 2

local lcurl = ffi.load("curl")

local function discard(buffer, size, nmemb, userp)
  return size * nmemb
end

function check_status(url)
  lcurl.curl_global_init(CURL_GLOBAL_DEFAULT)

  local curl = lcurl.curl_easy_init()

  lcurl.curl_easy_setopt(curl, CURLOPT_URL, url)
  lcurl.curl_easy_setopt(curl, CURLOPT_NOBODY, ffi.cast("long",1))
  lcurl.curl_easy_setopt(curl, CURLOPT_HEADER, ffi.cast("long",1))
  lcurl.curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
ffi.cast("callback",discard));

  local res = lcurl.curl_easy_perform(curl)
  local c_http_code = ffi.new("long[1]")
  lcurl.curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, c_http_code);

  lcurl.curl_easy_cleanup(curl)
  lcurl.curl_global_cleanup()

  return tonumber(c_http_code[0])
end
\stopluacode

\starttext

\ctxlua{context(check_status("http://example.com/;))}

\ctxlua{context(check_status("https://example.com/;))}

\ctxlua{context(check_status("https://example.com/xyz;))}

\stoptext



Hans van der Meer

On 16 May 2018, at 12:41, Henri Menke 

> wrote:

On 05/16/2018 09:31 PM, Hans van der Meer wrote:

I tried to determine the existence of a file on the internet. See the
following macro call:

   % Test if file exists.
   

Re: [NTG-context] Files on a server

2018-05-16 Thread Hans van der Meer
Beste Taco,

Ik probeer jouw oplossing maar er gebeurt nog iets raars. Ik krijg inderdaad 
200 resp. 404 terug bij bestaande niet-bestaande Uri’s. Maar ik krijg wel een 
error die aan het eind van de run gegenereerd wordt. Heb jij enig idee waar ik 
dat zou moeten zoeken? Als ik de call naar \verbose uitschakel komt er geen 
foutmelding. Blijft er na de socket call iets achter wat nog opgeruimd had 
moeten worden?

Hier een deel van de context-log en de code fragmenten in kwestie. 
 is de root node van het bewerkte bestand.

HVDM-PEV-TEST   > return code: 200
HVDM-PEV> number of events processed: 1
HVDM-PEV> = end of takepersons =
backend > xmp > using file 
'/Users/hansm/TeX/context-45/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pages   > flushing realpage 1, userpage 1, subpage 1
close source> level 2, order 13, name 
'/Users/hansm/Documents/Genealogie/familie-event.tex'
close source> level 1, order 13, name 
'/Users/hansm/TeX/context-45/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'

lua error   > lua error on line 0 in file :

...-45/tex/texmf-context/tex/context/base/mkiv/core-uti.lua:92: attempt to 
index a number value (global 'status')




? 
Process aborted

Code in tex:
\def\URIReturnCode#1{\ctxlua{tex.print(hvdm.urireturncode("#1"))}} 
\verbose{HVDM-PEV-TEST}{return code: \URIReturnCode{\theurl}}
Code in lua:
hvdm.urireturncode = function (theuri)
content, status, authinfo = socket.http.request{
method = "HEAD",
url = theuri,
}
return tostring(status)
end

Groet Hans



> On 16 May 2018, at 14:23, Taco Hoekwater  wrote:
> 
> 
> Or use luasocket, which is included in the luatex binary:
> 
> \startluacode
> content, status, authinfo = socket.http.request{
>method = "HEAD",
>url = 
> "http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf” 
> }
> 
> print (status)
> 
> \stopluacode
> 
> prints ‘404’ in this case.
> 
> Taco
> 
>> On 16 May 2018, at 13:45, Henri Menke  wrote:
>> 
>> On 05/16/2018 11:23 PM, Hans van der Meer wrote:
>>> I would be satisfied when a returned 404 error code will be handled
>>> within a reasonable (configurable) time delay. As for redirection, there
>>> I would not mind if it is not included.
>>> Restrictions like that are not a problem for me, because this is for
>>> building a pdf that accesses many internet located files. The check on
>>> existence is therefore especially meant for spotting missing or misnamed
>>> files.
>> 
>> You can use libcurl via ffi: https://curl.haxx.se/libcurl/
>> 
>> \startluacode
>> local ffi = require("ffi")
>> 
>> ffi.cdef[[
>> typedef struct Curl_easy CURL;
>> typedef int CURLcode;
>> typedef int CURLoption;
>> typedef int CURLINFO;
>> typedef size_t(*callback)(void *buffer, size_t size, size_t nmemb, void
>> *userp);
>> 
>> CURLcode curl_global_init(long flags);
>> CURL *curl_easy_init(void);
>> CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
>> CURLcode curl_easy_perform(CURL *curl);
>> CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
>> void curl_easy_cleanup(CURL *curl);
>> void curl_global_cleanup(void);
>> ]]
>> 
>> -- magic numbers
>> local CURL_GLOBAL_DEFAULT = 3
>> local CURLOPT_URL = 10002
>> local CURLOPT_NOBODY = 44
>> local CURLOPT_HEADER = 42
>> local CURLOPT_WRITEFUNCTION = 20011
>> local CURLINFO_RESPONSE_CODE = 0x20 + 2
>> 
>> local lcurl = ffi.load("curl")
>> 
>> local function discard(buffer, size, nmemb, userp)
>>   return size * nmemb
>> end
>> 
>> function check_status(url)
>>   lcurl.curl_global_init(CURL_GLOBAL_DEFAULT)
>> 
>>   local curl = lcurl.curl_easy_init()
>> 
>>   lcurl.curl_easy_setopt(curl, CURLOPT_URL, url)
>>   lcurl.curl_easy_setopt(curl, CURLOPT_NOBODY, ffi.cast("long",1))
>>   lcurl.curl_easy_setopt(curl, CURLOPT_HEADER, ffi.cast("long",1))
>>   lcurl.curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
>> ffi.cast("callback",discard));
>> 
>>   local res = lcurl.curl_easy_perform(curl)
>>   local c_http_code = ffi.new("long[1]")
>>   lcurl.curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, c_http_code);
>> 
>>   lcurl.curl_easy_cleanup(curl)
>>   lcurl.curl_global_cleanup()
>> 
>>   return tonumber(c_http_code[0])
>> end
>> \stopluacode
>> 
>> \starttext
>> 
>> \ctxlua{context(check_status("http://example.com/;))}
>> 
>> \ctxlua{context(check_status("https://example.com/;))}
>> 
>> \ctxlua{context(check_status("https://example.com/xyz;))}
>> 
>> \stoptext
>> 
>>> 
>>> Hans van der Meer
>>> 
 On 16 May 2018, at 12:41, Henri Menke > wrote:
 
 On 05/16/2018 09:31 PM, Hans van der Meer wrote:
> I tried to determine the existence of a file on the internet. See the
> following macro call:
> 
>% Test if file 

Re: [NTG-context] Files on a server

2018-05-16 Thread Taco Hoekwater

Or use luasocket, which is included in the luatex binary:

\startluacode
content, status, authinfo = socket.http.request{
method = "HEAD",
url = 
"http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf” 
}

print (status)

\stopluacode

prints ‘404’ in this case.

Taco

> On 16 May 2018, at 13:45, Henri Menke  wrote:
> 
> On 05/16/2018 11:23 PM, Hans van der Meer wrote:
>> I would be satisfied when a returned 404 error code will be handled
>> within a reasonable (configurable) time delay. As for redirection, there
>> I would not mind if it is not included.
>> Restrictions like that are not a problem for me, because this is for
>> building a pdf that accesses many internet located files. The check on
>> existence is therefore especially meant for spotting missing or misnamed
>> files.
> 
> You can use libcurl via ffi: https://curl.haxx.se/libcurl/
> 
> \startluacode
> local ffi = require("ffi")
> 
> ffi.cdef[[
> typedef struct Curl_easy CURL;
> typedef int CURLcode;
> typedef int CURLoption;
> typedef int CURLINFO;
> typedef size_t(*callback)(void *buffer, size_t size, size_t nmemb, void
> *userp);
> 
> CURLcode curl_global_init(long flags);
> CURL *curl_easy_init(void);
> CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
> CURLcode curl_easy_perform(CURL *curl);
> CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
> void curl_easy_cleanup(CURL *curl);
> void curl_global_cleanup(void);
> ]]
> 
> -- magic numbers
> local CURL_GLOBAL_DEFAULT = 3
> local CURLOPT_URL = 10002
> local CURLOPT_NOBODY = 44
> local CURLOPT_HEADER = 42
> local CURLOPT_WRITEFUNCTION = 20011
> local CURLINFO_RESPONSE_CODE = 0x20 + 2
> 
> local lcurl = ffi.load("curl")
> 
> local function discard(buffer, size, nmemb, userp)
>return size * nmemb
> end
> 
> function check_status(url)
>lcurl.curl_global_init(CURL_GLOBAL_DEFAULT)
> 
>local curl = lcurl.curl_easy_init()
> 
>lcurl.curl_easy_setopt(curl, CURLOPT_URL, url)
>lcurl.curl_easy_setopt(curl, CURLOPT_NOBODY, ffi.cast("long",1))
>lcurl.curl_easy_setopt(curl, CURLOPT_HEADER, ffi.cast("long",1))
>lcurl.curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
> ffi.cast("callback",discard));
> 
>local res = lcurl.curl_easy_perform(curl)
>local c_http_code = ffi.new("long[1]")
>lcurl.curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, c_http_code);
> 
>lcurl.curl_easy_cleanup(curl)
>lcurl.curl_global_cleanup()
> 
>return tonumber(c_http_code[0])
> end
> \stopluacode
> 
> \starttext
> 
> \ctxlua{context(check_status("http://example.com/;))}
> 
> \ctxlua{context(check_status("https://example.com/;))}
> 
> \ctxlua{context(check_status("https://example.com/xyz;))}
> 
> \stoptext
> 
>> 
>> Hans van der Meer
>> 
>>> On 16 May 2018, at 12:41, Henri Menke >> > wrote:
>>> 
>>> On 05/16/2018 09:31 PM, Hans van der Meer wrote:
 I tried to determine the existence of a file on the internet. See the
 following macro call:
 
 % Test if file exists.
 \edef\theurl{\linkprotocol://\urlbase\xmlatt{#1}{link}\thesuffix}
 \doiffileelse
 {\theurl}
 {\verbose{HVDM-PEV-TEST}{file exists: \theurl}}
 {\verbose{HVDM-PEV-TEST}{file does not exist: \theurl}}
 
 It seems that \doiffileelse always results in true except for local
 files where nonexistence is correctly handled.
 
 For example the following url definitely does not exist but nevertheless
 \doiffileelse reports its existence:
 HVDM-PEV-TEST   > file exists:
 http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf
 
 Is it possible that the \doiffile macros are extended for files on the
 internet or a correponding set \doifurl is developed?
>>> 
>>> I'm not speaking for the devs here, but I don't think that this is going
>>> to be included.  It would require that all webpages send proper 404
>>> codes and timeout after reasonable delay.  Also how would you handle
>>> redirects?  Should the ConTeXt run be stalled because checking for a
>>> files existence on the web is caught in a redirect loop?
>>> 
 
 Hans van der Meer
 
 
 
 ___
 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
 ___
 
>>> 
>>> ___
>>> If your question is of interest to others 

Re: [NTG-context] Files on a server

2018-05-16 Thread Henri Menke
On 05/16/2018 11:23 PM, Hans van der Meer wrote:
> I would be satisfied when a returned 404 error code will be handled
> within a reasonable (configurable) time delay. As for redirection, there
> I would not mind if it is not included.
> Restrictions like that are not a problem for me, because this is for
> building a pdf that accesses many internet located files. The check on
> existence is therefore especially meant for spotting missing or misnamed
> files.

You can use libcurl via ffi: https://curl.haxx.se/libcurl/

\startluacode
local ffi = require("ffi")

ffi.cdef[[
typedef struct Curl_easy CURL;
typedef int CURLcode;
typedef int CURLoption;
typedef int CURLINFO;
typedef size_t(*callback)(void *buffer, size_t size, size_t nmemb, void
*userp);

CURLcode curl_global_init(long flags);
CURL *curl_easy_init(void);
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURLcode curl_easy_perform(CURL *curl);
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
void curl_easy_cleanup(CURL *curl);
void curl_global_cleanup(void);
]]

-- magic numbers
local CURL_GLOBAL_DEFAULT = 3
local CURLOPT_URL = 10002
local CURLOPT_NOBODY = 44
local CURLOPT_HEADER = 42
local CURLOPT_WRITEFUNCTION = 20011
local CURLINFO_RESPONSE_CODE = 0x20 + 2

local lcurl = ffi.load("curl")

local function discard(buffer, size, nmemb, userp)
return size * nmemb
end

function check_status(url)
lcurl.curl_global_init(CURL_GLOBAL_DEFAULT)

local curl = lcurl.curl_easy_init()

lcurl.curl_easy_setopt(curl, CURLOPT_URL, url)
lcurl.curl_easy_setopt(curl, CURLOPT_NOBODY, ffi.cast("long",1))
lcurl.curl_easy_setopt(curl, CURLOPT_HEADER, ffi.cast("long",1))
lcurl.curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
ffi.cast("callback",discard));

local res = lcurl.curl_easy_perform(curl)
local c_http_code = ffi.new("long[1]")
lcurl.curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, c_http_code);

lcurl.curl_easy_cleanup(curl)
lcurl.curl_global_cleanup()

return tonumber(c_http_code[0])
end
\stopluacode

\starttext

\ctxlua{context(check_status("http://example.com/;))}

\ctxlua{context(check_status("https://example.com/;))}

\ctxlua{context(check_status("https://example.com/xyz;))}

\stoptext

> 
> Hans van der Meer
> 
>> On 16 May 2018, at 12:41, Henri Menke > > wrote:
>>
>> On 05/16/2018 09:31 PM, Hans van der Meer wrote:
>>> I tried to determine the existence of a file on the internet. See the
>>> following macro call:
>>>
>>>         % Test if file exists.
>>>         \edef\theurl{\linkprotocol://\urlbase\xmlatt{#1}{link}\thesuffix}
>>>         \doiffileelse
>>>         {\theurl}
>>>         {\verbose{HVDM-PEV-TEST}{file exists: \theurl}}
>>>         {\verbose{HVDM-PEV-TEST}{file does not exist: \theurl}}
>>>
>>> It seems that \doiffileelse always results in true except for local
>>> files where nonexistence is correctly handled.
>>>
>>> For example the following url definitely does not exist but nevertheless
>>> \doiffileelse reports its existence:
>>> HVDM-PEV-TEST   > file exists:
>>> http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf
>>>
>>> Is it possible that the \doiffile macros are extended for files on the
>>> internet or a correponding set \doifurl is developed?
>>
>> I'm not speaking for the devs here, but I don't think that this is going
>> to be included.  It would require that all webpages send proper 404
>> codes and timeout after reasonable delay.  Also how would you handle
>> redirects?  Should the ConTeXt run be stalled because checking for a
>> files existence on the web is caught in a redirect loop?
>>
>>>
>>> Hans van der Meer
>>>
>>>
>>>
>>> ___
>>> 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
>>> ___
>>>
>>
>> ___
>> 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 
>> ___
> 
> 
> 
> 

Re: [NTG-context] Files on a server

2018-05-16 Thread Hans van der Meer
I would be satisfied when a returned 404 error code will be handled within a 
reasonable (configurable) time delay. As for redirection, there I would not 
mind if it is not included.
Restrictions like that are not a problem for me, because this is for building a 
pdf that accesses many internet located files. The check on existence is 
therefore especially meant for spotting missing or misnamed files.

Hans van der Meer

> On 16 May 2018, at 12:41, Henri Menke  wrote:
> 
> On 05/16/2018 09:31 PM, Hans van der Meer wrote:
>> I tried to determine the existence of a file on the internet. See the
>> following macro call:
>> 
>> % Test if file exists.
>> \edef\theurl{\linkprotocol://\urlbase\xmlatt{#1}{link}\thesuffix}
>> \doiffileelse
>> {\theurl}
>> {\verbose{HVDM-PEV-TEST}{file exists: \theurl}}
>> {\verbose{HVDM-PEV-TEST}{file does not exist: \theurl}}
>> 
>> It seems that \doiffileelse always results in true except for local
>> files where nonexistence is correctly handled.
>> 
>> For example the following url definitely does not exist but nevertheless
>> \doiffileelse reports its existence:
>> HVDM-PEV-TEST   > file exists:
>> http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf
>> 
>> Is it possible that the \doiffile macros are extended for files on the
>> internet or a correponding set \doifurl is developed?
> 
> I'm not speaking for the devs here, but I don't think that this is going
> to be included.  It would require that all webpages send proper 404
> codes and timeout after reasonable delay.  Also how would you handle
> redirects?  Should the ConTeXt run be stalled because checking for a
> files existence on the web is caught in a redirect loop?
> 
>> 
>> Hans van der Meer
>> 
>> 
>> 
>> ___
>> 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
>> ___
>> 
> 
> ___
> 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 
> ___

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

Re: [NTG-context] Files on a server

2018-05-16 Thread Henri Menke
On 05/16/2018 09:31 PM, Hans van der Meer wrote:
> I tried to determine the existence of a file on the internet. See the
> following macro call:
> 
>         % Test if file exists.
>         \edef\theurl{\linkprotocol://\urlbase\xmlatt{#1}{link}\thesuffix}
>         \doiffileelse
>         {\theurl}
>         {\verbose{HVDM-PEV-TEST}{file exists: \theurl}}
>         {\verbose{HVDM-PEV-TEST}{file does not exist: \theurl}}
> 
> It seems that \doiffileelse always results in true except for local
> files where nonexistence is correctly handled.
> 
> For example the following url definitely does not exist but nevertheless
> \doiffileelse reports its existence:
> HVDM-PEV-TEST   > file exists:
> http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf
> 
> Is it possible that the \doiffile macros are extended for files on the
> internet or a correponding set \doifurl is developed?

I'm not speaking for the devs here, but I don't think that this is going
to be included.  It would require that all webpages send proper 404
codes and timeout after reasonable delay.  Also how would you handle
redirects?  Should the ConTeXt run be stalled because checking for a
files existence on the web is caught in a redirect loop?

> 
> Hans van der Meer
> 
> 
> 
> ___
> 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
> ___
> 

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

[NTG-context] Files on a server

2018-05-16 Thread Hans van der Meer
I tried to determine the existence of a file on the internet. See the following 
macro call:

% Test if file exists.
\edef\theurl{\linkprotocol://\urlbase\xmlatt{#1}{link}\thesuffix}
\doiffileelse
{\theurl}
{\verbose{HVDM-PEV-TEST}{file exists: \theurl}}
{\verbose{HVDM-PEV-TEST}{file does not exist: \theurl}}

It seems that \doiffileelse always results in true except for local files where 
nonexistence is correctly handled.

For example the following url definitely does not exist but nevertheless 
\doiffileelse reports its existence:
HVDM-PEV-TEST   > file exists: 
http://hansvandermeer.myqnapcloud.com/archive/denhaag/hga-dtb-1869-6040.pdf

Is it possible that the \doiffile macros are extended for files on the internet 
or a correponding set \doifurl is developed?

Hans van der Meer

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

Re: [NTG-context] roadmap

2018-05-16 Thread Hans Hagen

On 5/16/2018 7:38 AM, Henri Menke wrote:

I just thought of another thing.

Could you expose _all_ the subtypes of _all_ the different node types 
similar to node.id? (currently this is only enabled for whatsits)  As of 
now I always have to go to texnodes.w, find the array and count to find 
out which number a subtype has.  It would be much easier if we could


luatex 1.10 will have that (as it take s bit of effort to enter al the 
data which i'm doing as part of some other cleanups)


anyway, you can do:

local n = node.new("noad") n.subtype = node.subtypes("noad").bin print(n)

local n = node.new("noad") n.subtype = node.subtypes("noad").rel print(n)

there was never a need to look into a 'w' file, also because sometimes 
subtypes get added we provided this list



     node.new("noad", "bin")

instead of

     node.new("noad", 4)

and I would also like to see

     node.subtype("noad", "bin") -- return 4


node.subtypes("noad").bin
returns a number

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
___

Re: [NTG-context] roadmap

2018-05-16 Thread Joseph Canedo
If I am not mistaken, you can write :

node.new(‘noad’, nodes.noadcodes.bin)

De : Henri Menke
Envoyé le :mercredi 16 mai 2018 07:39
À : ntg-context@ntg.nl >> mailing list for ConTeXt users
Objet :Re: [NTG-context] roadmap

I just thought of another thing.

Could you expose _all_ the subtypes of _all_ the different node types 
similar to node.id? (currently this is only enabled for whatsits)  As of 
now I always have to go to texnodes.w, find the array and count to find 
out which number a subtype has.  It would be much easier if we could

 node.new("noad", "bin")

instead of

 node.new("noad", 4)

and I would also like to see

 node.subtype("noad", "bin") -- return 4

On 15/05/18 11:34, Hans Hagen wrote:
> On 5/15/2018 12:52 AM, Henri Menke wrote:
> 
>> Math typesetting is really crappy in ConTeXt, but I get that this is 
>> beyond your priorities.  I plan to develop a module which resembles 
>> the features and syntax of the amsmath LaTeX package for my PhD 
>> thesis.  I'm not sure how well this will integrate with the existing 
>> mechanisms.
> 
> hm. i have no clue what you refer to ... afaik most is configureable
> 
>> - columnsets, the new ones have considerably fewer features than the 
>> old ones.
> 
> like ... but adding some is no problem (only predictable stuff) .. no 
> column handler suits all (we now also have page columns btw)
> 
>> - rowwise setups in xtables and maybe columnwise, but that is 
>> computationally expensive.
> 
> indeed so that's why we have categories instead
> 
>>> - We can add more trickery for fonts and scripts. There are some 
>>> pending extensions.
>>>
>>> - Maybe we should provide a few more general styles.
>>
>> What does that mean?  Things like the TUGboat style?
> 
> no, e.g. some basic educational stuff
> 
>> More callbacks.  I'm missing callbacks into error handling (i.e. 
>> intercept errors) not just into error reporting like show_error_hook.
> 
> if you want to intercept errors then that has to happen at the macro 
> level, because once tex starts expanding the error can be anywhere
> 
> (so, in a macro package one can set at the tex level flags that one can 
> act upon in the error callback)
> 
> (the eror messages themselves might become a layer but that's for later)
> 
>> Throw out all non-Lua-related primitives and ntg-context@ntg.nlreplace 
>> them with Lua functions.  People can then define those primitives 
>> themselves, e.g.
> 
> way too slow ... in that case i'd drop tex completely (i.e. do all in lua)
> 
> also, you can right now (re)define primitives if you like (depending on 
> the definition of primitive)
> 
>> \suppressoutererror
>>
>> becomes
>>
>> \protected\def\suppressoutererror{%
>>  \directlua{errors.suppressoutererror()}}
>>
>> This makes it much easier to access that stuff from Lua.  Also 
>> interface all the \pdfvariable and \pdfextension stuff to Lua.
> 
> all pdf stuff is already doable in lua (context doesn't even use \pdf* 
> for quite a while)
> 
>> This should have maybe been done before 1.0 but I guess with 2.0 you 
>> can introduce “breaking” features.
> 
> well, a 2.0 (if ever) will probably only be useable for context ...
> 
>> LuaJIT will always be 5.1 compatible.  That is one of the declared 
>> goals of the project.  However there exist compatibility layers for 
>> Lua which implement recent features for older interpreters.
>> https://github.com/keplerproject/lua-compat-5.3
> 
> in that case in the end it will be dropped ...
> 
>> I would rather not see LuaJIT support being dropped.  The VM by itself 
>> (without JIT) is already a lot faster than regular Lua and I feel that 
>> the ConTeXt runs benefit from that quite a lot.  I use contextjit as 
>> my daily driver.
> 
> hm, at most 20% which is also what i get when i buy a new laptop
> 
> keep in mind that luajit has some limitations (stack and such)
> 
> (and the last few years i managed to squeeze out a lot from lua, and 
> with lua 5.3 the gaps became narrower)
>   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
___

___
If your question is of interest to others as well, please add an entry