Re: [NTG-context] \autoinsertedspace fails

2023-01-05 Thread Hans Hagen via ntg-context

On 1/6/2023 3:05 AM, Rik Kabel via ntg-context wrote:


On 2023-01-05 04:35, Hans Hagen via ntg-context wrote:

On 1/5/2023 4:21 AM, Rik Kabel via ntg-context wrote:


     [ snipped by rik]


Here is a more lmtx-ish variant:

\starttexdefinition tolerant protected BD #=#*#=
   \removeunwantedspaces
   \space % insert a space
   (
   \ifparameter#2\or
   #1|–|#2
   \orelse\ifparameter#1\or
   #1–
   \else
   {\red I NEED A DATE OR DATES!}
   \fi
   )
   \autoinsertedspace
\stoptexdefinition

Hans


Thank you for that. This works for me with \optionalspace, but fails in 
some cases with \autoinsertedspace.


I have now re-read lowlevel-macros.pdf and have a better understanding 
of what I read when first I approached it; I still have a way to go.


/Tolerant/ removes the need for /dodoubleempty/ and friends and the 
two-step /macro/ and /doMacro/ dance. There was a small advantage to the 
two-step, however. I had two separate macros, BD and BDNP (no parens), 
as shown.


The old code in full was:

% Birth and death dates ---%
% Ferdinand de Saussure\BD{1857}{1913}
% Noam Chomsky \BD{1928}
%
% Perhaps this could be tied to an acronym-like database so that the
%   dates are printed only once per person.
% \removeunwantedspaces allows this to directly follow, or follow
%   after whitespace, the associated name: Name\BD{1}{2} or
%   Name \BD{1}{2}.
% Using the compound indication (|–|) allows hyphenation after the
%   endash. Omitting it and using a bare endash inhibits hyphenation
%   ‘twixt the endash and the paren.
% By default, add parens around the dates. If none are needed due to
%   the context, use \BDNP.
%
\newif\ifBDParen
\starttexdefinition unexpanded BD
   \BDParentrue
   \dodoublegroupempty
   \doBD
\stoptexdefinition
\starttexdefinition unexpanded BDNP
   \BDParenfalse
   \dodoublegroupempty
   \doBD
\stoptexdefinition
\starttexdefinition doBD #1#2
    \removeunwantedspaces\
    \ifBDParen(\fi
    \ifsecondargument
    #1|–|#2
    \else\iffirstargument
    #1–
    \else
    {\red I NEED A DATE OR DATES!}
    \fi\fi
    \ifBDParen)\fi
    \autoinsertedspace
\stoptexdefinition

Both call the same doBD, but they set a flag (newif) to control 
insertion or not of the parens. While there is no performance benefit 
compared to having two fully separate macros, there is a maintenance 
benefit in having only one place, doBD, to make changes should they be 
required.


Can you suggest a way to do this under the new one-step scheme, or am I 
over-thinking this?


just remove the #* in the example i sent,

\starttexdefinition tolerant protected BD #=#=

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \autoinsertedspace fails

2023-01-05 Thread Rik Kabel via ntg-context


On 2023-01-05 04:35, Hans Hagen via ntg-context wrote:

On 1/5/2023 4:21 AM, Rik Kabel via ntg-context wrote:


    [ snipped by rik]


Here is a more lmtx-ish variant:

\starttexdefinition tolerant protected BD #=#*#=
   \removeunwantedspaces
   \space % insert a space
   (
   \ifparameter#2\or
   #1|–|#2
   \orelse\ifparameter#1\or
   #1–
   \else
   {\red I NEED A DATE OR DATES!}
   \fi
   )
   \autoinsertedspace
\stoptexdefinition

Hans


Thank you for that. This works for me with \optionalspace, but fails in 
some cases with \autoinsertedspace.


I have now re-read lowlevel-macros.pdf and have a better understanding 
of what I read when first I approached it; I still have a way to go.


/Tolerant/ removes the need for /dodoubleempty/ and friends and the 
two-step /macro/ and /doMacro/ dance. There was a small advantage to the 
two-step, however. I had two separate macros, BD and BDNP (no parens), 
as shown.


The old code in full was:

   % Birth and death dates ---%
   % Ferdinand de Saussure\BD{1857}{1913}
   % Noam Chomsky \BD{1928}
   %
   % Perhaps this could be tied to an acronym-like database so that the
   %   dates are printed only once per person.
   % \removeunwantedspaces allows this to directly follow, or follow
   %   after whitespace, the associated name: Name\BD{1}{2} or
   %   Name \BD{1}{2}.
   % Using the compound indication (|–|) allows hyphenation after the
   %   endash. Omitting it and using a bare endash inhibits hyphenation
   %   ‘twixt the endash and the paren.
   % By default, add parens around the dates. If none are needed due to
   %   the context, use \BDNP.
   %
   \newif\ifBDParen
   \starttexdefinition unexpanded BD
  \BDParentrue
  \dodoublegroupempty
  \doBD
   \stoptexdefinition
   \starttexdefinition unexpanded BDNP
  \BDParenfalse
  \dodoublegroupempty
  \doBD
   \stoptexdefinition
   \starttexdefinition doBD #1#2
   \removeunwantedspaces\
   \ifBDParen(\fi
   \ifsecondargument
   #1|–|#2
   \else\iffirstargument
   #1–
   \else
   {\red I NEED A DATE OR DATES!}
   \fi\fi
   \ifBDParen)\fi
   \autoinsertedspace
   \stoptexdefinition

Both call the same doBD, but they set a flag (newif) to control 
insertion or not of the parens. While there is no performance benefit 
compared to having two fully separate macros, there is a maintenance 
benefit in having only one place, doBD, to make changes should they be 
required.


Can you suggest a way to do this under the new one-step scheme, or am I 
over-thinking this?


Finally, is there any reason to go back to previously written and 
properly functioning macros and convert them to the LMTX-only syntax? It 
does imply committing to LMTX-only (or


--
Rik

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \autoinsertedspace fails

2023-01-05 Thread Hans Hagen via ntg-context

On 1/5/2023 4:21 AM, Rik Kabel via ntg-context wrote:


On 2023-01-04 18:45, Hans Hagen wrote:

On 1/4/2023 11:10 PM, Rik Kabel via ntg-context wrote:

No change with the latest (2023.01.04).

Is this a problem with what I am doing, or a bug?

well, it's new and not thtat tested ... we need to specify it

This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par

there can be more variants, like do we want to remove preceding spaces?

we already have:

This\optionalspace, fails unexpectedly with autoinsertedspace.\par
This\optionalspace, \emph{fails unexpectedly} with autoinsertedspace.\par
This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par



\optionalspace works correctly (that is, as I want it to) for all of my 
use cases under both MkIV and LMTX. Is there any reason that this should 
not be used in user documents?


I do wonder what characters are considered "punctuation" for the purpose 
of suppressing the next space. The standard six sentence termination 
characters (?!.:;,) are honored, and so are many others (quotation 
marks, including guillemot, square and curly braces, and parens). But 
sentence opening characters (¿¡) are as well. Vertical bars (|¦) and 
basic mathematical characters (+-=*) are not treated as punctuation. 
Where (in the source or manuals) are these to be found?


As far as removing leading spaces, I do not see that it is necessary, 
but it may help create more readable sources.


Thank you for the fix.

Here is a more lmtx-ish variant:

\starttexdefinition tolerant protected BD #=#*#=
   \removeunwantedspaces
   \space % insert a space
   (
   \ifparameter#2\or
   #1|–|#2
   \orelse\ifparameter#1\or
   #1–
   \else
   {\red I NEED A DATE OR DATES!}
   \fi
   )
   \autoinsertedspace
\stoptexdefinition

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \autoinsertedspace fails

2023-01-04 Thread Hans Hagen via ntg-context

On 1/5/2023 4:21 AM, Rik Kabel via ntg-context wrote:


On 2023-01-04 18:45, Hans Hagen wrote:

On 1/4/2023 11:10 PM, Rik Kabel via ntg-context wrote:

No change with the latest (2023.01.04).

Is this a problem with what I am doing, or a bug?

well, it's new and not thtat tested ... we need to specify it

This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par

there can be more variants, like do we want to remove preceding spaces?

we already have:

This\optionalspace, fails unexpectedly with autoinsertedspace.\par
This\optionalspace, \emph{fails unexpectedly} with autoinsertedspace.\par
This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par



\optionalspace works correctly (that is, as I want it to) for all of my 
use cases under both MkIV and LMTX. Is there any reason that this should 
not be used in user documents?


depends ... it checks punctuation

I do wonder what characters are considered "punctuation" for the purpose 
of suppressing the next space. The standard six sentence termination 
characters (?!.:;,) are honored, and so are many others (quotation 
marks, including guillemot, square and curly braces, and parens). But 
sentence opening characters (¿¡) are as well. Vertical bars (|¦) and 
basic mathematical characters (+-=*) are not treated as punctuation. 
Where (in the source or manuals) are these to be found?


we use unicode properties (collected in char-def.lua)

As far as removing leading spaces, I do not see that it is necessary, 
but it may help create more readable sources.


Thank you for the fix.


-
  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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \autoinsertedspace fails

2023-01-04 Thread Rik Kabel via ntg-context


On 2023-01-04 18:45, Hans Hagen wrote:

On 1/4/2023 11:10 PM, Rik Kabel via ntg-context wrote:

No change with the latest (2023.01.04).

Is this a problem with what I am doing, or a bug?

well, it's new and not thtat tested ... we need to specify it

This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par

there can be more variants, like do we want to remove preceding spaces?

we already have:

This\optionalspace, fails unexpectedly with autoinsertedspace.\par
This\optionalspace, \emph{fails unexpectedly} with autoinsertedspace.\par
This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par



\optionalspace works correctly (that is, as I want it to) for all of my 
use cases under both MkIV and LMTX. Is there any reason that this should 
not be used in user documents?


I do wonder what characters are considered "punctuation" for the purpose 
of suppressing the next space. The standard six sentence termination 
characters (?!.:;,) are honored, and so are many others (quotation 
marks, including guillemot, square and curly braces, and parens). But 
sentence opening characters (¿¡) are as well. Vertical bars (|¦) and 
basic mathematical characters (+-=*) are not treated as punctuation. 
Where (in the source or manuals) are these to be found?


As far as removing leading spaces, I do not see that it is necessary, 
but it may help create more readable sources.


Thank you for the fix.

--
Rik

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \autoinsertedspace fails

2023-01-04 Thread Hans Hagen via ntg-context

On 1/4/2023 11:10 PM, Rik Kabel via ntg-context wrote:

No change with the latest (2023.01.04).

Is this a problem with what I am doing, or a bug?

well, it's new and not thtat tested ... we need to specify it

This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par

there can be more variants, like do we want to remove preceding spaces?

we already have:

This\optionalspace, fails unexpectedly with autoinsertedspace.\par
This\optionalspace, \emph{fails unexpectedly} with autoinsertedspace.\par
This\optionalspace fails unexpectedly with autoinsertedspace.\par
This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par

-
  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 not modules then modules = { } end modules ['spac-chr'] = {
version   = 1.001,
optimize  = true,
comment   = "companion to spac-chr.mkiv",
author= "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license   = "see context related readme files"
}

local byte, lower = string.byte, string.lower

-- beware: attribute copying is bugged ... there will be a proper luatex helper
-- for this

-- to be redone: characters will become tagged spaces instead as then we keep 
track of
-- spaceskip etc

-- todo: only setattr when export / use properties

local next = next

local trace_characters = false  trackers.register("typesetters.characters", 
function(v) trace_characters = v end)
local trace_nbsp   = false  trackers.register("typesetters.nbsp",   
function(v) trace_nbsp   = v end)

local report_characters = logs.reporter("typesetting","characters")

local nodes, node = nodes, node

local nuts   = nodes.nuts

local getid  = nuts.getid
local getsubtype = nuts.getsubtype
local setsubtype = nuts.setsubtype
local getboth= nuts.getboth
local getnext= nuts.getnext
local getprev= nuts.getprev
local getattr= nuts.getattr
local setattr= nuts.setattr
local getlanguage= nuts.getlanguage
local setchar= nuts.setchar
local setattrlist= nuts.setattrlist
local getfont= nuts.getfont
local isglyph= nuts.isglyph

local setcolor   = nodes.tracers.colors.set

local insertnodebefore   = nuts.insertbefore
local insertnodeafter= nuts.insertafter
local remove_node= nuts.remove
local nextchar   = nuts.traversers.char
local nextglyph  = nuts.traversers.glyph

local copy_node  = nuts.copy

local nodepool   = nuts.pool
local new_penalty= nodepool.penalty
local new_glue   = nodepool.glue
local new_kern   = nodepool.kern
local new_rule   = nodepool.rule

local nodecodes  = nodes.nodecodes
local gluecodes  = nodes.gluecodes

local glyph_code = nodecodes.glyph
local glue_code  = nodecodes.glue
local spaceskip_code = gluecodes.spaceskip

local chardata   = characters.data
local ispunctuation  = characters.is_punctuation
local canhavespace   = characters.can_have_space

local typesetters= typesetters

local unicodeblocks  = characters.blocks

local characters = typesetters.characters or { } -- can be predefined
typesetters.characters   = characters

local fonthashes = fonts.hashes
local fontparameters = fonthashes.parameters
local fontcharacters = fonthashes.characters
local fontquads  = fonthashes.quads

local setmetatableindex  = table.setmetatableindex

local a_character= attributes.private("characters")
local a_alignstate   = attributes.private("alignstate")

local c_zero   = byte('0')
local c_period = byte('.')

local function inject_quad_space(unicode,head,current,fraction)
if fraction ~= 0 then
fraction = fraction * fontquads[getfont(current)]
end
local glue = new_glue(fraction)
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode)
return insertnodeafter(head,current,glue)
end

local function inject_char_space(unicode,head,current,parent)
local font = getfont(current)
local char = fontcharacters[font][parent]
local glue = new_glue(char and char.width or fontparameters[font].space)
setattrlist(glue,current)
setattrlist(current) -- why reset all
setattr(glue,a_character,unicode)
return insertnodeafter(head,current,glue)
end

local function 
inject_nobreak_space(unicode,head,current,space,spacestretch,spaceshrink)
local glue= new_glue(space,spacestretch,spaceshrink)
local 

Re: [NTG-context] \autoinsertedspace fails

2023-01-04 Thread Rik Kabel via ntg-context

No change with the latest (2023.01.04).

Is this a problem with what I am doing, or a bug?

--
Rik

On 2022-12-29 19:12, Rik Kabel via ntg-context wrote:


Happy New Year all!

Following up on the problem with \autoinsertnextspace 
(https://mailman.ntg.nl/pipermail/ntg-context/2022/107111.html) and 
the new \autoinsertedspace that came from that report, I see that 
there is still a problem, or perhaps a problem again after it was 
previously repaired.


The following code, run under the latest (and recent previous) 
version, produces an incorrect result, with no space inserted where 
expected in many cases. As the first examples after \starttext show, 
the problem appears to be with \autoinsertedspace, but perhaps I am 
using it incorrectly in the macro as well.


\starttexdefinition unexpanded BD
  \dodoublegroupempty
  \doBD
\stoptexdefinition

\starttexdefinition doBD #1#2
   \removeunwantedspaces\ % insert a space
   (
   \ifsecondargument
   #1|–|#2
   \else\iffirstargument
   #1–
   \else
   {\red I NEED A DATE OR DATES!}
   \fi\fi
   )
   \autoinsertedspace
\stoptexdefinition

\tt

\starttext
This\autoinsertedspace fails unexpectedly with autoinsertedspace.\par
This\autoinsertedspace \emph{fails unexpectedly} with
autoinsertedspace.\par
This\autoinsertnextspace works with autoinsertnextspace.\par
This\autoinsertnextspace \emph{fails} as expected with
autoinsertnextspace.\par
Saussure\BD{1857}{1913} works.\par
Saussure \BD{1857}{1913} \emph{works}.\par
Saussure \BD{1857}{1913}. Works.\par
Chomsky\BD{1928} fails with LMTX, works with MkIV.\par
Chomsky \BD{1928} \emph{fails with LMTX, works with MkIV}.\par
Chomsky \BD{1928}. Works.\par
\BD blah\par
\contextversion\ \texenginename
\stoptext


--
Rik



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

maillist :ntg-context@ntg.nl  /https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  :https://www.pragma-ade.nl  /http://context.aanhet.net
archive  :https://bitbucket.org/phg/context-mirror/commits/
wiki :https://contextgarden.net
__
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] \autoinsertedspace fails

2022-12-29 Thread Rik Kabel via ntg-context

Happy New Year all!

Following up on the problem with \autoinsertnextspace 
(https://mailman.ntg.nl/pipermail/ntg-context/2022/107111.html) and the 
new \autoinsertedspace that came from that report, I see that there is 
still a problem, or perhaps a problem again after it was previously 
repaired.


The following code, run under the latest (and recent previous) version, 
produces an incorrect result, with no space inserted where expected in 
many cases. As the first examples after \starttext show, the problem 
appears to be with \autoinsertedspace, but perhaps I am using it 
incorrectly in the macro as well.


   \starttexdefinition unexpanded BD
  \dodoublegroupempty
  \doBD
   \stoptexdefinition

   \starttexdefinition doBD #1#2
   \removeunwantedspaces\ % insert a space
   (
   \ifsecondargument
   #1|–|#2
   \else\iffirstargument
   #1–
   \else
   {\red I NEED A DATE OR DATES!}
   \fi\fi
   )
   \autoinsertedspace
   \stoptexdefinition

   \tt

   \starttext
   This\autoinsertedspace fails unexpectedly with autoinsertedspace.\par
   This\autoinsertedspace \emph{fails unexpectedly} with
   autoinsertedspace.\par
   This\autoinsertnextspace works with autoinsertnextspace.\par
   This\autoinsertnextspace \emph{fails} as expected with
   autoinsertnextspace.\par
   Saussure\BD{1857}{1913} works.\par
   Saussure \BD{1857}{1913} \emph{works}.\par
   Saussure \BD{1857}{1913}. Works.\par
   Chomsky\BD{1928} fails with LMTX, works with MkIV.\par
   Chomsky \BD{1928} \emph{fails with LMTX, works with MkIV}.\par
   Chomsky \BD{1928}. Works.\par
   \BD blah\par
   \contextversion\ \texenginename
   \stoptext


--
Rik

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] \autoinsertedspace fails following \nbsp under LMTX

2022-11-17 Thread Hans Hagen via ntg-context

On 11/17/2022 6:43 AM, Rik Kabel via ntg-context wrote:

ConTeXt  ver: 2022.11.14 22:58 LMTX on W11 x64

I have been testing the recently added \autoinsertedspace, and I found 
an odd failure.

fixed n next upload


-
  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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


[NTG-context] \autoinsertedspace fails following \nbsp under LMTX

2022-11-16 Thread Rik Kabel via ntg-context

ConTeXt  ver: 2022.11.14 22:58 LMTX on W11 x64

I have been testing the recently added \autoinsertedspace, and I found 
an odd failure.


The following compiles with \nbsp commented as shown, but once that line 
is active, the compilation fails:


   lua error:
    callback error:
   ...MTX/tex/texmf-context/tex/context/base/mkxl/font-hsh.lmt:151:
   table index is nil

It fails differently in MkIV (but it is nice to see that the new command 
has been backported):


   luatex warning  > node filter: error:
   ...MTX/tex/texmf-context/tex/context/base/mkiv/node-nut.lua:380:
   Attempt to node.direct.remove() a non-existing node

   %<--

   \starttexdefinition unexpanded New
  \dodoublegroupempty
  \doNew
   \stoptexdefinition
   \starttexdefinition doNew #1#2
   \removeunwantedspaces
   \ (#1|–|#2)
   \autoinsertedspace
   \stoptexdefinition

   \starttext

  ABC 0\New{123}{456} 789

  ABC
   % \nbsp
  0\New{123}{456} 789

   \stoptext

Am I doing something wrong here? \nbsp is needed to prevent improper 
line breaks.


--
Rik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___