ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* RFC: path relative to current file.
@ 2012-10-13  1:34 Andre Caldas
  2012-10-15 17:56 ` Hans Hagen
  2012-10-15 18:20 ` Hans Hagen
  0 siblings, 2 replies; 19+ messages in thread
From: Andre Caldas @ 2012-10-13  1:34 UTC (permalink / raw)
  To: ConTeXt users

Hello, list!

A while ago, I raised a question about how to, in a tex, specify a
file with a path relative to the currently being processed file.
http://www.ntg.nl/pipermail/ntg-context/2012/069132.html
http://www.ntg.nl/pipermail/ntg-context/2012/068902.html

Even though the issue did not get much attention, I do believe it is
the right thing to do. I wrote a module to implement a macro I called
"\pathrelativetome". My code is still a lot ugly. I don't know how to
do many things in Lua, LuaTeX and ConTeXt. It can be found here:
https://bitbucket.org/andrecaldas/math-video-classes/src/bade74046a6b/lib

It would be REALLY NICE if the functionality of "pathrelativetome" was
provided by ConTeXt.

call it using, for example:
context --usemodule=lib/relativetome src/products/assorted.tex

Ugly things remaining:
1. pathstack should be initialized with the path of the first tex
script. I.e.: src/products/, instead of
pathstack[1] = 'src/products'

2. Functions pop and push should be local. (relativetome.lua)

3. Call function "pop" automatically, just like the "push" function is
called automatically.

4. Avoid having to define "\xproject", "\xproduct", "\xcomponent" and
"\xenvironment".
http://www.ntg.nl/pipermail/ntg-context/2012/069305.html


Any suggestions/improvements are very welcome!


Cheers,
André Caldas.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-10-13  1:34 RFC: path relative to current file Andre Caldas
@ 2012-10-15 17:56 ` Hans Hagen
  2012-10-15 18:20 ` Hans Hagen
  1 sibling, 0 replies; 19+ messages in thread
From: Hans Hagen @ 2012-10-15 17:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 13-10-2012 03:34, Andre Caldas wrote:

> 3. Call function "pop" automatically, just like the "push" function is
> called automatically.

kind of tricky as the file can already be loaded and closed and 
therefore you're back at the previous level

> 4. Avoid having to define "\xproject", "\xproduct", "\xcomponent" and
> "\xenvironment".
> http://www.ntg.nl/pipermail/ntg-context/2012/069305.html

just use

\environment [somefilename]

as a space delimited variant does not work well in

\environment \somefilename

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-13  1:34 RFC: path relative to current file Andre Caldas
  2012-10-15 17:56 ` Hans Hagen
@ 2012-10-15 18:20 ` Hans Hagen
  2012-10-15 19:42   ` Andre Caldas
                     ` (2 more replies)
  1 sibling, 3 replies; 19+ messages in thread
From: Hans Hagen @ 2012-10-15 18:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 13-10-2012 03:34, Andre Caldas wrote:
> Hello, list!
>
> A while ago, I raised a question about how to, in a tex, specify a
> file with a path relative to the currently being processed file.
> http://www.ntg.nl/pipermail/ntg-context/2012/069132.html
> http://www.ntg.nl/pipermail/ntg-context/2012/068902.html
>
> Even though the issue did not get much attention, I do believe it is
> the right thing to do. I wrote a module to implement a macro I called
> "\pathrelativetome". My code is still a lot ugly. I don't know how to
> do many things in Lua, LuaTeX and ConTeXt. It can be found here:
> https://bitbucket.org/andrecaldas/math-video-classes/src/bade74046a6b/lib
>
> It would be REALLY NICE if the functionality of "pathrelativetome" was
> provided by ConTeXt.

in file-job.lua add around the function 'process':

local function toppath()
     local pathname = dirname(inputstack[#inputstack] or "")
     if pathname == "" then
         return "."
     else
         return pathname
     end
end

resolvers.toppath = topath

resolvers.prefixes.toppath = function(str)
     local fullname = cleanpath(joinpath(toppath(),str))
     return fullname
end

local function process(what,name)
     local depth = #typestack
     local process
     --
     name = resolvers.resolve(name)
     --
..... keep code ...

and somewhere at the top:

local joinpath          = file.join
local cleanpath         = resolvers.cleanpath

Then you can something:

\starttext

     \component toppath:/subpath/somefile.tex

\stoptext

All given that the top of the inputstack is still ok.

If needed I can push/pop some relative code to start/stopcomponent alike 
code, in which case we will use a different prefix (no clue what name to 
use)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-15 18:20 ` Hans Hagen
@ 2012-10-15 19:42   ` Andre Caldas
  2012-10-15 20:04     ` Hans Hagen
  2012-11-03  0:35   ` Andre Caldas
  2012-11-07 19:34   ` Andre Caldas
  2 siblings, 1 reply; 19+ messages in thread
From: Andre Caldas @ 2012-10-15 19:42 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

>> It would be REALLY NICE if the functionality of "pathrelativetome" was
>> provided by ConTeXt.
>
> in file-job.lua add around the function 'process':

You make me really happy, Hans! :-)
I will change file-job.lua on my system to test. I can do this only on
Wednesday.


> local function toppath()
> [...]
>    local pathname = dirname(inputstack[#inputstack] or "")

I didn't check it in lua. But the unix command "dirname" returns "."
if given an empty string. That is,
$ dirname ''
.

I don't know when "inputstack" could be empty... but maybe a warning
should be issued, and the return value of toppath should be declared
undefined. That is, it would be an error to call toppath if
"inputstack" is empty.


> [...]
> resolvers.toppath = topath

toppath? (double "p")


> Then you can something:
> [...]
>     \component toppath:/subpath/somefile.tex

Nice.


> All given that the top of the inputstack is still ok.

Maybe the code could have some sort of "assertion" to
1. check for "stack underflow"; and/or
2. check if the file "somefile.tex" exists in the directory being
popped from the stack.
Just for "bug catching"...


> If needed I can push/pop some relative code to start/stopcomponent alike
> code, in which case we will use a different prefix (no clue what name to
> use)

I don't think it is needed, since the toppath mechanism is rather
generic. Writing "\component toppath:/subpath/somefile.tex" is fine by
me. Unless you think that "start/stopcomponent" should be deprecated
(or, at least, discouraged) in favour of this new version.

Maybe it would be nice to have a function that returns the value of
"inputstack[#inputstack]". But I don't know if it is useful...

Thank you very very much for your time!


André Caldas.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-10-15 19:42   ` Andre Caldas
@ 2012-10-15 20:04     ` Hans Hagen
  2012-10-15 21:27       ` Aditya Mahajan
  2012-10-15 22:26       ` Andre Caldas
  0 siblings, 2 replies; 19+ messages in thread
From: Hans Hagen @ 2012-10-15 20:04 UTC (permalink / raw)
  To: Andre Caldas; +Cc: mailing list for ConTeXt users

On 15-10-2012 21:42, Andre Caldas wrote:

> I don't know when "inputstack" could be empty... but maybe a warning
> should be issued, and the return value of toppath should be declared
> undefined. That is, it would be an error to call toppath if
> "inputstack" is empty.

you should test

\component x.tex
\component y.tex

and see if when y is loaded we can still get the right path

> 1. check for "stack underflow"; and/or

such things are dealt with

> 2. check if the file "somefile.tex" exists in the directory being
> popped from the stack.
> Just for "bug catching"...

it all happens before a file is loaded so the normal reporting is applied

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-15 20:04     ` Hans Hagen
@ 2012-10-15 21:27       ` Aditya Mahajan
  2012-10-15 21:38         ` Marco Patzer
  2012-10-15 22:11         ` Hans Hagen
  2012-10-15 22:26       ` Andre Caldas
  1 sibling, 2 replies; 19+ messages in thread
From: Aditya Mahajan @ 2012-10-15 21:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>> 2. check if the file "somefile.tex" exists in the directory being
>> popped from the stack.
>> Just for "bug catching"...
>
> it all happens before a file is loaded so the normal reporting is applied

Actually, it is a bit annoying that \environment and \component
do not report an error (or at least a warning message) when the file is 
not found. \usemodule at least issues a warning, but does not change the 
exit status code, so it is easy to miss the warning message.

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-15 21:27       ` Aditya Mahajan
@ 2012-10-15 21:38         ` Marco Patzer
  2012-10-15 22:11         ` Hans Hagen
  1 sibling, 0 replies; 19+ messages in thread
From: Marco Patzer @ 2012-10-15 21:38 UTC (permalink / raw)
  To: ntg-context

2012-10-15 Aditya Mahajan:

> >> 2. check if the file "somefile.tex" exists in the directory being
> >> popped from the stack.
> >> Just for "bug catching"...
> >
> > it all happens before a file is loaded so the normal reporting is applied
> 
> Actually, it is a bit annoying that \environment and \component
> do not report an error (or at least a warning message) when the file is 
> not found.

+1


Marco

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-15 21:27       ` Aditya Mahajan
  2012-10-15 21:38         ` Marco Patzer
@ 2012-10-15 22:11         ` Hans Hagen
  1 sibling, 0 replies; 19+ messages in thread
From: Hans Hagen @ 2012-10-15 22:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 15-10-2012 23:27, Aditya Mahajan wrote:
>>> 2. check if the file "somefile.tex" exists in the directory being
>>> popped from the stack.
>>> Just for "bug catching"...
>>
>> it all happens before a file is loaded so the normal reporting is applied
>
> Actually, it is a bit annoying that \environment and \component
> do not report an error (or at least a warning message) when the file is
> not found. \usemodule at least issues a warning, but does not change the
> exit status code, so it is easy to miss the warning message.

I've added a message

system          > jobfiles > unknown tex file "what-a-mess"

no detail about the kind of file (could be done but needs way more 
helpers as all now share common one)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-15 20:04     ` Hans Hagen
  2012-10-15 21:27       ` Aditya Mahajan
@ 2012-10-15 22:26       ` Andre Caldas
  2012-10-16  7:33         ` Hans Hagen
  1 sibling, 1 reply; 19+ messages in thread
From: Andre Caldas @ 2012-10-15 22:26 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

>> 1. check for "stack underflow"; and/or
>
> such things are dealt with

By assert, I mean:
assert(inputstack[#inputstack], "Input stack should never be empty
when toppath() is called.")


>> 2. check if the file "somefile.tex" exists in the directory being
>> popped from the stack.
>> Just for "bug catching"...
>
> it all happens before a file is loaded so the normal reporting is applied

I meant an "assert()" inside toppath() and cleanpath().
But, as you said, this kind of "assertion" belongs to a "test case".


André Caldas.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-10-15 22:26       ` Andre Caldas
@ 2012-10-16  7:33         ` Hans Hagen
  2012-10-16 11:25           ` Andre Caldas
  0 siblings, 1 reply; 19+ messages in thread
From: Hans Hagen @ 2012-10-16  7:33 UTC (permalink / raw)
  To: Andre Caldas; +Cc: mailing list for ConTeXt users

On 16-10-2012 00:26, Andre Caldas wrote:
>>> 1. check for "stack underflow"; and/or
>>
>> such things are dealt with
>
> By assert, I mean:
> assert(inputstack[#inputstack], "Input stack should never be empty
> when toppath() is called.")

normally

if inputstack[#inputstack] == nil then
	assume path "."
end

is good enough ... (assert might make sense in situation where otherwise 
a crash would occur, but that never happens here)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-16  7:33         ` Hans Hagen
@ 2012-10-16 11:25           ` Andre Caldas
  0 siblings, 0 replies; 19+ messages in thread
From: Andre Caldas @ 2012-10-16 11:25 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

>>>> 1. check for "stack underflow"; and/or
>>>
>>> such things are dealt with
>>
>> By assert, I mean:
>> assert(inputstack[#inputstack], "Input stack should never be empty
>> when toppath() is called.")
>
> normally
>
> if inputstack[#inputstack] == nil then
>         assume path "."
> end
>
> is good enough ...

Is "inputstack[#inputstack] == nil" ever supposed to happen?
When reading from stdin, maybe... then, it is ok.


> (assert might make sense in situation where otherwise a
> crash would occur, but that never happens here)

If it is not supposed to happen, then it would indicate a bug, and
should be detected as early as possible. A "crash" is a special case
of that. But this is a matter of taste... :-)


Cheers,
André Caldas.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-10-15 18:20 ` Hans Hagen
  2012-10-15 19:42   ` Andre Caldas
@ 2012-11-03  0:35   ` Andre Caldas
  2012-11-03 10:13     ` Sietse Brouwer
  2012-11-07 19:34   ` Andre Caldas
  2 siblings, 1 reply; 19+ messages in thread
From: Andre Caldas @ 2012-11-03  0:35 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

Hello!

>> It would be REALLY NICE if the functionality of "pathrelativetome" was
>> provided by ConTeXt.
>
> in file-job.lua add around the function 'process':
>
> local function toppath()
> [...]
>
>     \component toppath:/subpath/somefile.tex

Works like a charm, Hans! Sorry I took so long to test...
I copied file-job.lua from the GIT repository, and changed my tex
files to use toppath:/path/to/file.

For example:
https://bitbucket.org/andrecaldas/math-video-classes/src/b743f22e4f567662ac55c1ac7dc1b6d13362e11d/src/products/assorted.tex?at=default

Really nice! Thanks!! :-)


Cheers,
André Caldas.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-11-03  0:35   ` Andre Caldas
@ 2012-11-03 10:13     ` Sietse Brouwer
  2012-11-03 12:47       ` Hans Hagen
  0 siblings, 1 reply; 19+ messages in thread
From: Sietse Brouwer @ 2012-11-03 10:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

Andreas wrote:
>>> It would be REALLY NICE if the functionality of "pathrelativetome" was
>>> provided by ConTeXt.

Hans wrote:
>> in file-job.lua add around the function 'process':
>>
>> local function toppath()
>> [...]
>>
>>     \component toppath:/subpath/somefile.tex

Andreas wrote:
> Works like a charm, Hans! Sorry I took so long to test...
> I copied file-job.lua from the GIT repository, and changed my tex
> files to use toppath:/path/to/file.

Will this be in the core, or is it just a fix for Andreas? I.e: should
we document toppath() as a core command, or as a snippet?
(Not that we have a general space on the wiki for snippets yet, but we
need one and we will have one. Somethine in the next two weeks I'll
write a "State of the Wiki" laying out what we have, what we don't
have, and what we want next.)

--Sietse
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-11-03 10:13     ` Sietse Brouwer
@ 2012-11-03 12:47       ` Hans Hagen
  0 siblings, 0 replies; 19+ messages in thread
From: Hans Hagen @ 2012-11-03 12:47 UTC (permalink / raw)
  To: Sietse Brouwer; +Cc: mailing list for ConTeXt users

On 11/3/2012 10:13 AM, Sietse Brouwer wrote:
> Andreas wrote:
>>>> It would be REALLY NICE if the functionality of "pathrelativetome" was
>>>> provided by ConTeXt.
>
> Hans wrote:
>>> in file-job.lua add around the function 'process':
>>>
>>> local function toppath()
>>> [...]
>>>
>>>      \component toppath:/subpath/somefile.tex
>
> Andreas wrote:
>> Works like a charm, Hans! Sorry I took so long to test...
>> I copied file-job.lua from the GIT repository, and changed my tex
>> files to use toppath:/path/to/file.
>
> Will this be in the core, or is it just a fix for Andreas? I.e: should
> we document toppath() as a core command, or as a snippet?
> (Not that we have a general space on the wiki for snippets yet, but we
> need one and we will have one. Somethine in the next two weeks I'll
> write a "State of the Wiki" laying out what we have, what we don't
> have, and what we want next.)

in the core .. it's a prefix

just look in data-pre.lua for some more of them

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-10-15 18:20 ` Hans Hagen
  2012-10-15 19:42   ` Andre Caldas
  2012-11-03  0:35   ` Andre Caldas
@ 2012-11-07 19:34   ` Andre Caldas
  2012-11-07 20:35     ` Hans Hagen
  2 siblings, 1 reply; 19+ messages in thread
From: Andre Caldas @ 2012-11-07 19:34 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

Hello!

> local function toppath()
> [...]
> resolvers.toppath = topath

There is a bug here. It should be
resolvers.toppath = toppath
(double "p" in the right side)


André Caldas.
-- 
- Por que altera a ordem natural da conversação!
- Por que não?
- Eu não gosto, não.
- Você gosta quando copiam a mensagem original ao final do e-mail?
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-11-07 19:34   ` Andre Caldas
@ 2012-11-07 20:35     ` Hans Hagen
  2012-11-08 12:14       ` Andre Caldas
  0 siblings, 1 reply; 19+ messages in thread
From: Hans Hagen @ 2012-11-07 20:35 UTC (permalink / raw)
  To: Andre Caldas; +Cc: mailing list for ConTeXt users

On 11/7/2012 8:34 PM, Andre Caldas wrote:
> Hello!
>
>> local function toppath()
>> [...]
>> resolvers.toppath = topath
>
> There is a bug here. It should be
> resolvers.toppath = toppath
> (double "p" in the right side)

In your local copy I presume, not here.

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-11-07 20:35     ` Hans Hagen
@ 2012-11-08 12:14       ` Andre Caldas
  2012-11-08 12:43         ` Hans Hagen
  0 siblings, 1 reply; 19+ messages in thread
From: Andre Caldas @ 2012-11-08 12:14 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

Hello, Hans!

I quoted this from your message:

>>> local function toppath()
>>> [...]
>>> resolvers.toppath = topath


When you commited version "eb24ffd", the following bug was introduced:

>> There is a bug here. It should be
>> resolvers.toppath = toppath
>> (double "p" in the right side)
>
> In your local copy I presume, not here.

Because of the bug (I presume), you removed the whole code.
git diff -r eb24ffd tex/context/base/file-job.lua
[...]
@@ -553,22 +553,6 @@ function resolvers.jobs.currentenvironment()
return topofstack(v_environment) en
 local done     = { }
 local tolerant = false -- too messy, mkii user with the wrong
sructure should adapt

-local function toppath()
-    local pathname = dirname(inputstack[#inputstack] or "")
-    if pathname == "" then
-        return "."
-    else
-        return pathname
-    end
-end
-
-resolvers.toppath = topath

===> HERE IS THE BUG (right above) <===

-
-resolvers.prefixes.toppath = function(str)
-    local fullname = cleanpath(joinpath(toppath(),str))
-    return fullname
-end


Are we giving up the feature? I was kind of using it already... :-(


Cheers,
André Caldas.
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: RFC: path relative to current file.
  2012-11-08 12:14       ` Andre Caldas
@ 2012-11-08 12:43         ` Hans Hagen
  2012-11-08 16:30           ` Andre Caldas
  0 siblings, 1 reply; 19+ messages in thread
From: Hans Hagen @ 2012-11-08 12:43 UTC (permalink / raw)
  To: Andre Caldas; +Cc: mailing list for ConTeXt users

On 11/8/2012 1:14 PM, Andre Caldas wrote:
> Hello, Hans!
>
> I quoted this from your message:
>
>>>> local function toppath()
>>>> [...]
>>>> resolvers.toppath = topath
>
>
> When you commited version "eb24ffd", the following bug was introduced:
>
>>> There is a bug here. It should be
>>> resolvers.toppath = toppath
>>> (double "p" in the right side)
>>
>> In your local copy I presume, not here.
>
> Because of the bug (I presume), you removed the whole code.
> git diff -r eb24ffd tex/context/base/file-job.lua
> [...]
> @@ -553,22 +553,6 @@ function resolvers.jobs.currentenvironment()
> return topofstack(v_environment) en
>   local done     = { }
>   local tolerant = false -- too messy, mkii user with the wrong
> sructure should adapt
>
> -local function toppath()
> -    local pathname = dirname(inputstack[#inputstack] or "")
> -    if pathname == "" then
> -        return "."
> -    else
> -        return pathname
> -    end
> -end
> -
> -resolvers.toppath = topath
>
> ===> HERE IS THE BUG (right above) <===
>
> -
> -resolvers.prefixes.toppath = function(str)
> -    local fullname = cleanpath(joinpath(toppath(),str))
> -    return fullname
> -end
>
>
> Are we giving up the feature? I was kind of using it already... :-(

you have a messed up system  ... the code is in data-pre.lua

Gabs


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: RFC: path relative to current file.
  2012-11-08 12:43         ` Hans Hagen
@ 2012-11-08 16:30           ` Andre Caldas
  0 siblings, 0 replies; 19+ messages in thread
From: Andre Caldas @ 2012-11-08 16:30 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

>> Are we giving up the feature? I was kind of using it already... :-(
>
> you have a messed up system  ... the code is in data-pre.lua

Indeed! :-)
Sorry for the mess!

Now, I have a bug at data-pre.lua. The variable inputstack is not
defined there. Here is a fix:

diff --git a/tex/context/base/data-pre.lua b/tex/context/base/data-pre.lua
index 40b430b..3ef8c59 100644
--- a/tex/context/base/data-pre.lua
+++ b/tex/context/base/data-pre.lua
@@ -91,6 +91,7 @@ prefixes.home = function(str)
 end

 local function toppath()
+    local inputstack = resolvers.inputstack
     local pathname = dirname(inputstack[#inputstack] or "")
     if pathname == "" then
         return "."
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2012-11-08 16:30 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13  1:34 RFC: path relative to current file Andre Caldas
2012-10-15 17:56 ` Hans Hagen
2012-10-15 18:20 ` Hans Hagen
2012-10-15 19:42   ` Andre Caldas
2012-10-15 20:04     ` Hans Hagen
2012-10-15 21:27       ` Aditya Mahajan
2012-10-15 21:38         ` Marco Patzer
2012-10-15 22:11         ` Hans Hagen
2012-10-15 22:26       ` Andre Caldas
2012-10-16  7:33         ` Hans Hagen
2012-10-16 11:25           ` Andre Caldas
2012-11-03  0:35   ` Andre Caldas
2012-11-03 10:13     ` Sietse Brouwer
2012-11-03 12:47       ` Hans Hagen
2012-11-07 19:34   ` Andre Caldas
2012-11-07 20:35     ` Hans Hagen
2012-11-08 12:14       ` Andre Caldas
2012-11-08 12:43         ` Hans Hagen
2012-11-08 16:30           ` Andre Caldas

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).