Re: [NTG-context] structureuservariable as list

2023-02-25 Thread Alex Leray via ntg-context

Dear both,

thanks for your answers.

`doloopovermatch` didn't work for me but this below is achieving what I 
wanted.


Have a good day,

Alex

%%%

\def\dosomething#1{(#1)}

\def\dosomethingtwo#1{* #1\crlf}

\starttext
\startchapter[title={Foo Bar}][
authors={Alice,Bob,Charline},
translators={foo,bar,baz}
]

{\em authors} \\
\commalistsentence[\structureuservariable{authors}][{ \crlf },{ \crlf }]

{\em translators} \\
\processcommacommand[\structureuservariable{translators}]\dosomethingtwo

\doloopoverlist {\structureuservariable{translators}} {
 (#1) \\
}

\stopchapter
\stoptext

%%%

Le 25/02/23 à 11:08, Hans Hagen via ntg-context a écrit :

On 2/24/2023 11:37 PM, Rik Kabel via ntg-context wrote:



Hi,

is it possible to pass a list in a variable? I'd like to pass a list 
of authors:



\startchapter[title={Foo Bar}][authors={Alice, Bob}]

% PSEUDOCODE
% for author in \structureuservariable{authors}
% do print(author + '\crlf')
% done

\stopchapter


Search the wiki. Look for "Comma Separated Lists." There is a variant 
with an author list as an example.


You may need additional brace levels around the list entries.

I'm not sure this is on the wiki ...

\starttext

\startchapter[title={Foo Bar}][authors={Alice, Bob},AUTHORS={Bob,Alice}]

     \doloopovermatch {[^, ]+} {\structureuservariable{authors}}  {
     (#1)\crlf
     }
     \doloopovermatch {[^,]+} {\structureuservariable{authors}}  {
     (#1)\crlf
     }
     \doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}}  {
     (#1)\crlf
     }
     \doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}}  {
     \doloopovermatch {.} {#1}  {
     (##1)
     }
     \crlf
     }

\stopchapter

but feel free to add it.

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
___


--
Alexandre Leray
+32 487 947 030

Avez-vous pensé à (vous) offrir Médor ?
https://medor.coop/ideescadeau
___
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] structureuservariable as list

2023-02-25 Thread Hans Hagen via ntg-context

On 2/24/2023 11:37 PM, Rik Kabel via ntg-context wrote:



Hi,

is it possible to pass a list in a variable? I'd like to pass a list 
of authors:



\startchapter[title={Foo Bar}][authors={Alice, Bob}]

% PSEUDOCODE
% for author in \structureuservariable{authors}
% do print(author + '\crlf')
% done

\stopchapter


Search the wiki. Look for "Comma Separated Lists." There is a variant 
with an author list as an example.


You may need additional brace levels around the list entries.

I'm not sure this is on the wiki ...

\starttext

\startchapter[title={Foo Bar}][authors={Alice, Bob},AUTHORS={Bob,Alice}]

\doloopovermatch {[^, ]+} {\structureuservariable{authors}}  {
(#1)\crlf
}
\doloopovermatch {[^,]+} {\structureuservariable{authors}}  {
(#1)\crlf
}
\doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}}  {
(#1)\crlf
}
\doloopovermatch {[^,]+} {\structureuservariable{AUTHORS}}  {
\doloopovermatch {.} {#1}  {
(##1)
}
\crlf
}

\stopchapter

but feel free to add it.

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] structureuservariable as list

2023-02-24 Thread Rik Kabel via ntg-context



Hi,

is it possible to pass a list in a variable? I'd like to pass a list 
of authors:



\startchapter[title={Foo Bar}][authors={Alice, Bob}]

% PSEUDOCODE
% for author in \structureuservariable{authors}
% do print(author + '\crlf')
% done

\stopchapter


Search the wiki. Look for "Comma Separated Lists." There is a variant 
with an author list as an example.


You may need additional brace levels around the list entries.

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


[NTG-context] structureuservariable as list

2023-02-24 Thread Alex Leray via ntg-context

Hi,

is it possible to pass a list in a variable? I'd like to pass a list of 
authors:



\startchapter[title={Foo Bar}][authors={Alice, Bob}]

% PSEUDOCODE
% for author in \structureuservariable{authors}
% do print(author + '\crlf')
% done

\stopchapter

Thanks
___
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] structureuservariable

2018-03-31 Thread Henning Hraban Ramm
Am 2018-03-31 um 23:10 schrieb Hans Hagen :

> On 3/31/2018 10:57 PM, Henning Hraban Ramm wrote:
>> Please consider:
>> \starttext
>> \startchapter[title=Test][author=Tufte]
>> \input tufte\par
>> Author: \structureuservariable{author}
>> \startsection[title=Section]
>> \input knuth\par
>> Author: \structureuservariable{author} (empty!)
>> \stopsection
>> \stopchapter
>> \stoptext
>> i.e. the variable that I define in chapter is reset in the next section.
>> But I need it for the whole chapter (i.e. for a head text).
>> Is there some setting to avoid that reset?
> no but there is \namedstructurevariable{..}{..}

i.e. \namedstructurevariable{chapter}{author}

Great, that helps!
Thank you for the quick answer!

Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

2018-03-31 Thread Hans Hagen

On 3/31/2018 10:57 PM, Henning Hraban Ramm wrote:

Please consider:

\starttext

\startchapter[title=Test][author=Tufte]

\input tufte\par
Author: \structureuservariable{author}

\startsection[title=Section]

\input knuth\par
Author: \structureuservariable{author} (empty!)

\stopsection

\stopchapter

\stoptext

i.e. the variable that I define in chapter is reset in the next section.
But I need it for the whole chapter (i.e. for a head text).
Is there some setting to avoid that reset?

no but there is \namedstructurevariable{..}{..}

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

[NTG-context] structureuservariable

2018-03-31 Thread Henning Hraban Ramm
Please consider:

\starttext

\startchapter[title=Test][author=Tufte]

\input tufte\par
Author: \structureuservariable{author}

\startsection[title=Section]

\input knuth\par
Author: \structureuservariable{author} (empty!)

\stopsection

\stopchapter

\stoptext

i.e. the variable that I define in chapter is reset in the next section.
But I need it for the whole chapter (i.e. for a head text).
Is there some setting to avoid that reset?


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

___
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] structureuservariable in ToC

2018-01-24 Thread Henning Hraban Ramm
Am 2018-01-24 um 19:18 schrieb Wolfgang Schuster :

>> Henning Hraban Ramm 24. Januar 2018 um 08:51
>> 
>> Thank you, now I have:
>> 
>> \define[1]\ChapterTocEntry{%
>> \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf
>>  }%
>> #1%
>> \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
>> 
>> But author/subtitle still don’t show up in the ToC.
> Use the \doiftext check or replace \structurelistuservariable (which is never 
> empty because
> it is tagged) with \rawstructurelistuservariable (which isn’t tagged and 
> contains only the content
> of the variable).

Thank you so much! You saved my day/night/toc ;)


Grüßlinge, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

___
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] structureuservariable in ToC

2018-01-24 Thread Wolfgang Schuster

Henning Hraban Ramm 
24. Januar 2018 um 08:51

Thank you, now I have:

\define[1]\ChapterTocEntry{%
\doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf 
}%

#1%
\doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}

But author/subtitle still don’t show up in the ToC.
Use the \doiftext check or replace \structurelistuservariable (which is 
never empty because
it is tagged) with \rawstructurelistuservariable (which isn’t tagged and 
contains only the content

of the variable).


\define[3]\SectionListCommand
  {\doiftextelse{\structurelistuservariable{test}}{YES}{NO}%
   \endgraf}

% \define[3]\SectionListCommand
%   {\doifsomethingelse{\rawstructurelistuservariable{test}}{YES}{NO}%
%\endgraf}

\setuplist[section][alternative=command,command=\SectionListCommand]

\starttext

\placelist[section]

\startsection[title=X][test=A] \stopsection

\startsection[title=Y] \stopsection

\startsection[title=Z][test=B] \stopsection

\stoptext


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] structureuservariable in ToC

2018-01-24 Thread Henning Hraban Ramm
Am 2018-01-24 um 16:42 schrieb Wolfgang Schuster :

>> Henning Hraban Ramm 24. Januar 2018 um 08:51
>> 
>> Thank you, now I have:
>> 
>> \define[1]\ChapterTocEntry{%
>> \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf
>>  }%
>> #1%
>> \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
>> 
>> But author/subtitle still don’t show up in the ToC.
> 
> You’re still using the wrong command to print the variables.
> 
> \setuplist --> \structurelistuservariable
> \setuphead --> \structureuservariable

Aaargh, I’m blind, sorry, I changed only half of the occurrencies.

Everything’s ok now, _if_ author and subtitle are defined.

But \structurelistuservariable{something} seems to be never empty in the sense 
of \ifempty - I get those \crlf also for chapters without i.e. where I didn’t 
define those or set them to {}.


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD


marginsubtitle.tex
Description: Binary data
___
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] structureuservariable in ToC

2018-01-24 Thread Wolfgang Schuster



Henning Hraban Ramm 
24. Januar 2018 um 08:51

Thank you, now I have:

\define[1]\ChapterTocEntry{%
\doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf 
}%

#1%
\doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}

But author/subtitle still don’t show up in the ToC.


You’re still using the wrong command to print the variables.

\setuplist --> \structurelistuservariable
\setuphead --> \structureuservariable

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] structureuservariable in ToC

2018-01-23 Thread Henning Hraban Ramm
Am 2018-01-23 um 21:24 schrieb Wolfgang Schuster :

>> Henning Hraban Ramm 14. Januar 2018 um 21:44
>> Now, my second issue with user variables:
>> 
>> """
>> \define[1]\ChapterTocEntry{%
>> \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf
>>  }%
>> #1%
>> \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
> To access the variables in a list you have to use the 
> \structurelistuservariable command.

Thank you, now I have:

\define[1]\ChapterTocEntry{%
  
\doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf
 }%
  #1%
  
\doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}

But author/subtitle still don’t show up in the ToC.

Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

___
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] structureuservariable in ToC

2018-01-23 Thread Wolfgang Schuster



Henning Hraban Ramm 
14. Januar 2018 um 21:44
Now, my second issue with user variables:

"""
\define[1]\ChapterTocEntry{%
\doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf 
}%

#1%
\doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
To access the variables in a list you have to use the 
\structurelistuservariable command.


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] structureuservariable in ToC

2018-01-23 Thread Henning Hraban Ramm
Some hint on that would be nice.
Is it maybe related to the "Registers and getparameters" problem?
I tried a few things WRT expansion, but it seems like I didn’t find the right 
command in the right place.

Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

Am 2018-01-14 um 21:44 schrieb Henning Hraban Ramm :

> Now, my second issue with user variables:
> 
> """
> \define[1]\ChapterTocEntry{%
>  
> \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf
>  }%
>  #1%
>  
> \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
> 
> \setuplist[chapter][textcommand=\ChapterTocEntry]
> 
> \starttext
> \completelist[chapter][criterium=all]
> 
> \startchapter[
>  title={The Use of Typefaces}][%
>  author={Hermann Zapf},
>  subtitle={Ein zapfiges Zitat}]
> 
> \input zapf
> 
> \stopchapter
> 
> \startchapter[
>  title={Sheep and Goats}][%
>  author={Siegfried Tufte},
>  subtitle={Tofte Tufte-Zitat}]
> 
> \input tufte
> 
> \stopchapter
> 
> \stoptext
> """
> 
> I’m trying to get author and subtitle into the ToC (while in the content, 
> subtitle goes to the margin and author to the end of the chapter).
> But in this example, both are empty (but not empty enough for doifnotempty), 
> while in my actual project I always get author and subtitle from the first 
> chapter.
> I guess this is an expansion problem?
> 
> 
> Greetlings, Hraban
> ---
> http://www.fiee.net
> http://wiki.contextgarden.net
> GPG Key ID 1C9B22FD

___
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] structureuservariable in ToC

2018-01-14 Thread Henning Hraban Ramm
Now, my second issue with user variables:

"""
\define[1]\ChapterTocEntry{%
  
\doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf
 }%
  #1%
  
\doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}

\setuplist[chapter][textcommand=\ChapterTocEntry]

\starttext
\completelist[chapter][criterium=all]

\startchapter[
  title={The Use of Typefaces}][%
  author={Hermann Zapf},
  subtitle={Ein zapfiges Zitat}]

\input zapf

\stopchapter

\startchapter[
  title={Sheep and Goats}][%
  author={Siegfried Tufte},
  subtitle={Tofte Tufte-Zitat}]

\input tufte

\stopchapter

\stoptext
"""

I’m trying to get author and subtitle into the ToC (while in the content, 
subtitle goes to the margin and author to the end of the chapter).
But in this example, both are empty (but not empty enough for doifnotempty), 
while in my actual project I always get author and subtitle from the first 
chapter.
I guess this is an expansion problem?


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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