ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* database module: the first letter is lost
@ 2014-06-25 17:21 Michael Green
  2014-06-25 19:44 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Green @ 2014-06-25 17:21 UTC (permalink / raw)
  To: ntg-context

This appears to be the same as the problem Peter Münster found with the letter module

\usemodule[database]

\defineseparatedlist[MyTable]
	[separator=tab,
	before=\bTABLE,after=\eTABLE,
	first=\bTR,last=\eTR,
	left=\bTD,right=\eTD]

\starttext

The first letter of “Cell” is lost.

\startseparatedlist[MyTable]
Cell 1	Cell 2
\stopseparatedlist

With an extra return, “Cell” is intact.

\startseparatedlist[MyTable]

Cell 1	Cell 2
\stopseparatedlist


\stoptext
___________________________________________________________________________________
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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 17:21 database module: the first letter is lost Michael Green
@ 2014-06-25 19:44 ` Hans Hagen
  2014-06-25 21:13   ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2014-06-25 19:44 UTC (permalink / raw)
  To: ntg-context, Wolfgang Schuster

On 6/25/2014 7:21 PM, Michael Green wrote:
> This appears to be the same as the problem Peter Münster found with the letter module
>
> \usemodule[database]
>
> \defineseparatedlist[MyTable]
> 	[separator=tab,
> 	before=\bTABLE,after=\eTABLE,
> 	first=\bTR,last=\eTR,
> 	left=\bTD,right=\eTD]
>
> \starttext
>
> The first letter of “Cell” is lost.
>
> \startseparatedlist[MyTable]
> Cell 1	Cell 2
> \stopseparatedlist
>
> With an extra return, “Cell” is intact.
>
> \startseparatedlist[MyTable]
>
> Cell 1	Cell 2
> \stopseparatedlist
>
>
> \stoptext

in buff-ini.mkiv change this:

\def\buff_start_indeed#1#2#3#4%
   {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}

probably needs some checking

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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 19:44 ` Hans Hagen
@ 2014-06-25 21:13   ` Wolfgang Schuster
  2014-06-25 23:04     ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2014-06-25 21:13 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 1150 bytes --]


Am 25.06.2014 um 21:44 schrieb Hans Hagen <pragma@wxs.nl>:

> On 6/25/2014 7:21 PM, Michael Green wrote:
>> This appears to be the same as the problem Peter Münster found with the letter module
>> 
>> \usemodule[database]
>> 
>> \defineseparatedlist[MyTable]
>> 	[separator=tab,
>> 	before=\bTABLE,after=\eTABLE,
>> 	first=\bTR,last=\eTR,
>> 	left=\bTD,right=\eTD]
>> 
>> \starttext
>> 
>> The first letter of “Cell” is lost.
>> 
>> \startseparatedlist[MyTable]
>> Cell 1	Cell 2
>> \stopseparatedlist
>> 
>> With an extra return, “Cell” is intact.
>> 
>> \startseparatedlist[MyTable]
>> 
>> Cell 1	Cell 2
>> \stopseparatedlist
>> 
>> 
>> \stoptext
> 
> in buff-ini.mkiv change this:
> 
> \def\buff_start_indeed#1#2#3#4%
>  {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
> 
> probably needs some checking

Adding \obeylines to \grabbufferdatadirect would also work

\unexpanded\def\grabbufferdatadirect % name start stop
  {\begingroup % (6)
+  \obeylines
   \buff_start_indeed\empty}

but I’m interested what’s the purpose of the fifth argument for \buff_start_indeed.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2333 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 21:13   ` Wolfgang Schuster
@ 2014-06-25 23:04     ` Hans Hagen
  2014-06-25 23:12       ` Aditya Mahajan
  2014-06-25 23:19       ` Rik Kabel
  0 siblings, 2 replies; 9+ messages in thread
From: Hans Hagen @ 2014-06-25 23:04 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users, Wolfgang Schuster

On 6/25/2014 11:13 PM, Wolfgang Schuster wrote:
>
> Am 25.06.2014 um 21:44 schrieb Hans Hagen <pragma@wxs.nl
> <mailto:pragma@wxs.nl>>:
>
>> On 6/25/2014 7:21 PM, Michael Green wrote:
>>> This appears to be the same as the problem Peter Münster found with
>>> the letter module
>>>
>>> \usemodule[database]
>>>
>>> \defineseparatedlist[MyTable]
>>> [separator=tab,
>>> before=\bTABLE,after=\eTABLE,
>>> first=\bTR,last=\eTR,
>>> left=\bTD,right=\eTD]
>>>
>>> \starttext
>>>
>>> The first letter of “Cell” is lost.
>>>
>>> \startseparatedlist[MyTable]
>>> Cell 1Cell 2
>>> \stopseparatedlist
>>>
>>> With an extra return, “Cell” is intact.
>>>
>>> \startseparatedlist[MyTable]
>>>
>>> Cell 1Cell 2
>>> \stopseparatedlist
>>>
>>>
>>> \stoptext
>>
>> in buff-ini.mkiv change this:
>>
>> \def\buff_start_indeed#1#2#3#4%
>>  {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
>>
>> probably needs some checking
>
> Adding \obeylines to \grabbufferdatadirect would also work
>
> \unexpanded\def\grabbufferdatadirect % name start stop
>    {\begingroup % (6)
> +  \obeylines
>     \buff_start_indeed\empty}
>
> but I’m interested what’s the purpose of the fifth argument for
> \buff_start_indeed.

that was wrong; the pickup macro has a fifth argument (\plusone here) 
but goes unnoticed when you add \obeylines in which case the first 
'obeyedline' ended up in #5

(i probably messed up when adding some feature but i would have to need 
to look at older code to see how/when)

does it make sense?

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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 23:04     ` Hans Hagen
@ 2014-06-25 23:12       ` Aditya Mahajan
  2014-06-25 23:19       ` Rik Kabel
  1 sibling, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2014-06-25 23:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 534 bytes --]

On Thu, 26 Jun 2014, Hans Hagen wrote:

>> but I’m interested what’s the purpose of the fifth argument for
>> \buff_start_indeed.
>
> that was wrong; the pickup macro has a fifth argument (\plusone here) but 
> goes unnoticed when you add \obeylines in which case the first 'obeyedline' 
> ended up in #5
>
> (i probably messed up when adding some feature but i would have to need to 
> look at older code to see how/when)

http://git.contextgarden.net/context/context/blame/master/tex/context/base/buff-ini.mkiv

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 23:04     ` Hans Hagen
  2014-06-25 23:12       ` Aditya Mahajan
@ 2014-06-25 23:19       ` Rik Kabel
  2014-06-25 23:26         ` Aditya Mahajan
  2014-06-25 23:34         ` Wolfgang Schuster
  1 sibling, 2 replies; 9+ messages in thread
From: Rik Kabel @ 2014-06-25 23:19 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2538 bytes --]

On 2014-06-25 19:04, Hans Hagen wrote:
> On 6/25/2014 11:13 PM, Wolfgang Schuster wrote:
>>
>> Am 25.06.2014 um 21:44 schrieb Hans Hagen <pragma@wxs.nl
>> <mailto:pragma@wxs.nl>>:
>>
>>> On 6/25/2014 7:21 PM, Michael Green wrote:
>>>> This appears to be the same as the problem Peter Münster found with
>>>> the letter module
>>>>
>>>> \usemodule[database]
>>>>
>>>> \defineseparatedlist[MyTable]
>>>> [separator=tab,
>>>> before=\bTABLE,after=\eTABLE,
>>>> first=\bTR,last=\eTR,
>>>> left=\bTD,right=\eTD]
>>>>
>>>> \starttext
>>>>
>>>> The first letter of “Cell” is lost.
>>>>
>>>> \startseparatedlist[MyTable]
>>>> Cell 1Cell 2
>>>> \stopseparatedlist
>>>>
>>>> With an extra return, “Cell” is intact.
>>>>
>>>> \startseparatedlist[MyTable]
>>>>
>>>> Cell 1Cell 2
>>>> \stopseparatedlist
>>>>
>>>>
>>>> \stoptext
>>>
>>> in buff-ini.mkiv change this:
>>>
>>> \def\buff_start_indeed#1#2#3#4%
>>>  {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
>>>
>>> probably needs some checking
>>
>> Adding \obeylines to \grabbufferdatadirect would also work
>>
>> \unexpanded\def\grabbufferdatadirect % name start stop
>>    {\begingroup % (6)
>> +  \obeylines
>>     \buff_start_indeed\empty}
>>
>> but I’m interested what’s the purpose of the fifth argument for
>> \buff_start_indeed.
>
> that was wrong; the pickup macro has a fifth argument (\plusone here) 
> but goes unnoticed when you add \obeylines in which case the first 
> 'obeyedline' ended up in #5
>
> (i probably messed up when adding some feature but i would have to 
> need to look at older code to see how/when)
>
> does it make sense?
>
> Hans

Adding \obeylines as Wolfgang indicated did not resolve the issue with 
my test case (shortened below), while removing #5 as Hans suggested does 
resolve it.

    % macros=mkvi
    \starttexdefinition unexpanded startTest
       \begingroup
       \dostartTest
    \stoptexdefinition
    \starttexdefinition dostartTest
       \grabbufferdata[Test][startTest][stopTest]
    \stoptexdefinition
    \starttexdefinition stopTest
       \getbufferdata[Test]
       \endgroup
    \stoptexdefinition
    \define\TestText
      {If you can read this the first token was not swallowed.}
    \starttext
    If another line does not follow this, there is a failure.

    \startTest\TestText\stopTest
    \stoptext

As I wrote before, I do not have a way to more extensively test the 
other effects of the change.

-- 
Rik Kabel

[-- Attachment #1.2: Type: text/html, Size: 4739 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 23:19       ` Rik Kabel
@ 2014-06-25 23:26         ` Aditya Mahajan
  2014-06-25 23:34         ` Wolfgang Schuster
  1 sibling, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2014-06-25 23:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 25 Jun 2014, Rik Kabel wrote:

> As I wrote before, I do not have a way to more extensively test the other 
> effects of the change.

Since this affects grabbuffer, it will also affect the filter module. I 
have an extensive set of tests for the filter module 
(https://github.com/adityam/filter) that can be run by

    rake test_filter_mkiv

However, the tests are not automatic (you have to visually inspect the PDF 
to see if everything is fine), require pandoc, and are rather simplistic. 
They are meant to check that nothing is broken with the filter module, not 
to check \grabbuffer. Nonetheless, it may be a good source of example.

I am afraid that I don't have the time to test this right now.

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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 23:19       ` Rik Kabel
  2014-06-25 23:26         ` Aditya Mahajan
@ 2014-06-25 23:34         ` Wolfgang Schuster
  2014-06-26  0:02           ` Rik Kabel
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2014-06-25 23:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 26.06.2014 um 01:19 schrieb Rik Kabel <context@rik.users.panix.com>:

> Adding \obeylines as Wolfgang indicated did not resolve the issue with my test case (shortened below), while removing #5 as Hans suggested does resolve it.

There is a difference between

  \startFOO
  …
  \stopFOO

and

  \startFOO … \stopFOO

because context gobbles only content in the same line as \startFOO when you add \obeylines and in the first case there is nothing which can be removed.

Wolfgang

___________________________________________________________________________________
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] 9+ messages in thread

* Re: database module: the first letter is lost
  2014-06-25 23:34         ` Wolfgang Schuster
@ 2014-06-26  0:02           ` Rik Kabel
  0 siblings, 0 replies; 9+ messages in thread
From: Rik Kabel @ 2014-06-26  0:02 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1197 bytes --]

On 2014-06-25 19:34, Wolfgang Schuster wrote:
> Am 26.06.2014 um 01:19 schrieb Rik Kabel <context@rik.users.panix.com>:
>
>> Adding \obeylines as Wolfgang indicated did not resolve the issue with my test case (shortened below), while removing #5 as Hans suggested does resolve it.
> There is a difference between
>
>    \startFOO
>    …
>    \stopFOO
>
> and
>
>    \startFOO … \stopFOO
>
> because context gobbles only content in the same line as \startFOO when you add \obeylines and in the first case there is nothing which can be removed.
>
> Wolfgang
Thank you, Wolfgang, for the explanation.

When I use

    \startTest
    \TestText
    \stopTest

or

    \startTest
    \TestText\stopTest

it does indeed work with the obeylines fix. It fails on the one-line 
version and also on

    \startTest\TestText
    \stopTest

I have no problem using the multi-line versions. I only reduced it to a 
single line in preparing the MWE. I have, however, seen such one-line 
incantations in other examples on the list and possibly in the wiki. I 
do not recall who wrote them.

I will now leave this to the developers to handle as they see best.

-- 
Rik

[-- Attachment #1.2: Type: text/html, Size: 2052 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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] 9+ messages in thread

end of thread, other threads:[~2014-06-26  0:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25 17:21 database module: the first letter is lost Michael Green
2014-06-25 19:44 ` Hans Hagen
2014-06-25 21:13   ` Wolfgang Schuster
2014-06-25 23:04     ` Hans Hagen
2014-06-25 23:12       ` Aditya Mahajan
2014-06-25 23:19       ` Rik Kabel
2014-06-25 23:26         ` Aditya Mahajan
2014-06-25 23:34         ` Wolfgang Schuster
2014-06-26  0:02           ` Rik Kabel

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