ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Using \commalistsentence in combination with \processcommacommand... I'm going mad?
@ 2025-09-17  4:18 Andres Conrado Montoya
  2025-09-17  7:28 ` [NTG-context] " Hans Hagen via ntg-context
  0 siblings, 1 reply; 2+ messages in thread
From: Andres Conrado Montoya @ 2025-09-17  4:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi list. This is probably the wrong thing to do. However, it's what I have
been trying:

% MWE %%%%%%%%%%%%%%%%%%%%%%
% Registro de autores
\definenamespace[autores][
  type=module,
  name=autor,
  command=yes,
  parent=autores,
]

\define[1]\AutorNombreApellido{\edef\currentautor{#1}{%
  \doifsomething{\autorparameter{nombres}}{\autorparameter{nombres}\space}%
  \doifsomething{\autorparameter{apellidos}}{\autorparameter{apellidos},}%
}}

\define[1]\ListaAutores{{\AutorNombreApellido{#1}}\space}
\define\autoresListaH{\processcommacommand[\documentvariable{autores}]\ListaAutores}

\defineautor[autores][rol={autor}]
\defineautor[andi][autores][nombres={Andrés Conrado}, apellidos={Montoya
Acosta}]
\defineautor[soni][autores][nombres={Sonia Amparo}, apellidos={Rodríguez
Rodríguez}]
\defineautor[sofi][autores][nombres={Sofía}, apellidos={Parra Albarracín}]

\startdocument[autores={andi,soni,sofi}]

\commalistsentence[\documentvariable{autores}][{;\space},{\space\letterampersand\space}]

\blank[big]

\commalistsentence[\autoresListaH][{;\space},{\space\letterampersand\space}]

\stopdocument

%%%%%%%%%%%%%%%%%%%%%%%%%

As you may see, I'm trying to process a list of authors, based on the
examples in https://wiki.contextgarden.net/Command/startdocument and
https://wiki.contextgarden.net/Command/commalistsentence. But this is
getting convoluted and I'm convinced there must be an obvious simpler
solution I can't seem to find.

- The output comes out `Andrés Conrado Montoya Acosta, Sonia Amparo
Rodríguez Rodríguez, Sofía Parra Albarracín,`
- I want `Andrés Conrado Montoya Acosta; Sonia Amparo Rodríguez Rodríguez &
Sofía Parra Albarracín` as the first line in the output: `andi; soni & sofi`

I think I am doing something wrong, because probably it's possible to set
up the \processcommacommand to act in the same way as the
\commandlistsentence? (I'm guessing this is what I want) But I can't seem
to find how.

Also consulted:
-
https://wiki.contextgarden.net/ConTeXt_and_Lua_programming/Tutorials/System_Macros/Action_Processing

-
https://wiki.contextgarden.net/ConTeXt_and_Lua_programming/Tutorials/System_Macros/Comma_Separated_Lists

Something there should help but I'm not really sure what. Any clue would be
greatly appreciated. Thank you very much.

-- 
Andrés Conrado Montoya
andresconrado@gmail.com
http://sesentaycuatro.com
----------------------------------------
Los fines no justifican los medios, porque la medida verdadera de nuestro
carácter está dada por los medios que estamos dispuestos a utilizar, no por
los fines que proclamamos.

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

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

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2025-09-17  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-17  4:18 [NTG-context] Using \commalistsentence in combination with \processcommacommand... I'm going mad? Andres Conrado Montoya
2025-09-17  7:28 ` [NTG-context] " Hans Hagen via ntg-context

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