ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Does \startnotallmodes work?
@ 2022-05-10 21:39 Gerben Wierda via ntg-context
  2022-05-11  0:37 ` Rik Kabel via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Gerben Wierda via ntg-context @ 2022-05-10 21:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gerben Wierda


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

Example. Call with 

context —mode=FR

- Uncomment the first commented lines. Compilation fails because mode FR is on so that works

But I get English anyway. Uncomment the second commented part and it fails, but it should not because mode=EN is not turned on.

%\startmode[FR]
%  \BLURBONE
%  \stopmode

\startnotallmodes[FR,RU]% english is the default
\enablemode[EN]
\stopnotallmodes

\startmode[EN]
%  \BLURBTWO
\setuplanguage[en][patterns={en}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 3.1 Metamodel ESv4]
\stopmode
\startmode[FR]
\setuplanguage[fr][patterns={en,fr}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 3.1 Metamodel ESv4]
\stopmode
\startmode[RU]
\setuplanguage[ru][patterns={en,ru}]
\setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 3.1 Metamodel ESv4]
\stopmode

Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R&A IT Strategy <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>


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

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Does \startnotallmodes work?
  2022-05-10 21:39 Does \startnotallmodes work? Gerben Wierda via ntg-context
@ 2022-05-11  0:37 ` Rik Kabel via ntg-context
  2022-05-11  8:33   ` Gerben Wierda via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Rik Kabel via ntg-context @ 2022-05-11  0:37 UTC (permalink / raw)
  To: ntg-context; +Cc: Rik Kabel


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

On 2022-05-10 17:39, Gerben Wierda via ntg-context wrote:
> Example. Call with
>
> context —mode=FR
>
> - Uncomment the first commented lines. Compilation fails because mode 
> FR is on so that works
>
> But I get English anyway. Uncomment the second commented part and it 
> fails, but it should not because mode=EN is not turned on.
>
> %\startmode[FR]
> %  \BLURBONE
> %  \stopmode
>
> \startnotallmodes[FR,RU]% english is the default
> \enablemode[EN]
> \stopnotallmodes
>
> \startmode[EN]
> %  \BLURBTWO
> \setuplanguage[en][patterns={en}]
> \setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 
> 3.1 Metamodel ESv4]
> \stopmode
> \startmode[FR]
> \setuplanguage[fr][patterns={en,fr}]
> \setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 
> 3.1 Metamodel ESv4]
> \stopmode
> \startmode[RU]
> \setuplanguage[ru][patterns={en,ru}]
> \setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 
> 3.1 Metamodel ESv4]
> \stopmode
>
> Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
> R&A IT Strategy <https://ea.rna.nl/> (main site)
> Book: Chess and the Art of Enterprise Architecture 
> <https://ea.rna.nl/the-book/>
> Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>
>
Gerben,

\startnotallmodes is behaving as it should. Here, it is not the case 
that RU and FR (all the listed modes) are set, so EN is enabled, and you 
actually have both FR and EN set.

Try the following with

        context —mode=FR

and make sure you understand the result.

    \starttext
    \doifmode{EN}{EN is enabled\par}
    \doifmode{FR}{FR is enabled\par}
    \doifmode{RU}{RU is enabled\par}
    \doifmode{FR,RU}{at least one of FR and RU modes is enabled\par}
    \doifmode{EN,RU}{at least one of EN and RU modes is enabled\par}
    \doifmode{EN,FR}{at least one of EN and FR modes is enabled\par}
    \doifmode{EN,FR,RU}{at least one of EN, FR, and RU modes is enabled\par}
    \doifnotmode{EN}{EN is not enabled\par}
    \doifnotmode{FR}{FR is not enabled\par}
    \doifnotmode{RU}{RU is not enabled\par}
    \doifnotmode{EN,RU}{neither EN nor RU is enabled\par}
    \doifnotmode{EN,FR}{neither EN nor FR is enabled\par}
    \doifnotmode{RU,FR}{neither RU nor FR is enabled\par}
    \doifnotallmodes{FR,RU}{all of FR and RU modes are not enabled\par}
    \doifnotallmodes{EN,RU}{all of EN and RU modes are not enabled\par}
    \doifnotallmodes{EN,FR}{all of EN and FR modes are not enabled\par}
    \doifnotallmodes{EN,FR,RU}{all of EN, FR, and RU modes are not
    enabled\par}
    \stoptext

Then, add the following block to the beginning of the file and try again.

    \definemode[EN,FR,RU][keep]
    \doifmodeelse{EN}
       {    \disablemode[FR]
            \disablemode[RU]}
       {\doifmodeelse{FR}
        {   \disablemode[EN]
            \disablemode[RU]}
        {\doifmodeelse{RU}
          { \disablemode[EN]
            \disablemode[FR]}}
          { \enablemode[EN]}}

I find it useful to add such a block to the environment of every file 
that uses mutually-exclusive modes. This version pf the block sets a 
default value if none is on the command line.

-- 
Rik




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

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Does \startnotallmodes work?
  2022-05-11  0:37 ` Rik Kabel via ntg-context
@ 2022-05-11  8:33   ` Gerben Wierda via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Gerben Wierda via ntg-context @ 2022-05-11  8:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gerben Wierda, Rik Kabel


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

> On 11 May 2022, at 02:37, Rik Kabel via ntg-context <ntg-context@ntg.nl> wrote:
> 
> On 2022-05-10 17:39, Gerben Wierda via ntg-context wrote:
>> Example. Call with 
>> 
>> context —mode=FR
>> 
>> - Uncomment the first commented lines. Compilation fails because mode FR is on so that works
>> 
>> But I get English anyway. Uncomment the second commented part and it fails, but it should not because mode=EN is not turned on.
>> 
>> %\startmode[FR]
>> %  \BLURBONE
>> %  \stopmode
>> 
>> \startnotallmodes[FR,RU]% english is the default
>> \enablemode[EN]
>> \stopnotallmodes
>> 
>> \startmode[EN]
>> %  \BLURBTWO
>> \setuplanguage[en][patterns={en}]
>> \setupexternalfigure[directory=../LMTX-Output/without-ids/en/ArchiMate 3.1 Metamodel ESv4]
>> \stopmode
>> \startmode[FR]
>> \setuplanguage[fr][patterns={en,fr}]
>> \setupexternalfigure[directory=../LMTX-Output/without-ids/fr/ArchiMate 3.1 Metamodel ESv4]
>> \stopmode
>> \startmode[RU]
>> \setuplanguage[ru][patterns={en,ru}]
>> \setupexternalfigure[directory=../LMTX-Output/without-ids/ru/ArchiMate 3.1 Metamodel ESv4]
>> \stopmode
>> 
>> Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
>> R&A IT Strategy <https://ea.rna.nl/> (main site)
>> Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
>> Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>
>> 
> Gerben,
> 
> \startnotallmodes is behaving as it should. Here, it is not the case that RU and FR (all the listed modes) are set, so EN is enabled, and you actually have both FR and EN set.
> 
> Try the following with 
> 
> context —mode=FR
> 
> and make sure you understand the result.
> 
> \starttext
> \doifmode{EN}{EN is enabled\par}
> \doifmode{FR}{FR is enabled\par}
> \doifmode{RU}{RU is enabled\par}
> \doifmode{FR,RU}{at least one of FR and RU modes is enabled\par}
> \doifmode{EN,RU}{at least one of EN and RU modes is enabled\par}
> \doifmode{EN,FR}{at least one of EN and FR modes is enabled\par}
> \doifmode{EN,FR,RU}{at least one of EN, FR, and RU modes is enabled\par}
> \doifnotmode{EN}{EN is not enabled\par}
> \doifnotmode{FR}{FR is not enabled\par}
> \doifnotmode{RU}{RU is not enabled\par}
> \doifnotmode{EN,RU}{neither EN nor RU is enabled\par}
> \doifnotmode{EN,FR}{neither EN nor FR is enabled\par}
> \doifnotmode{RU,FR}{neither RU nor FR is enabled\par}
> \doifnotallmodes{FR,RU}{all of FR and RU modes are not enabled\par}
> \doifnotallmodes{EN,RU}{all of EN and RU modes are not enabled\par}
> \doifnotallmodes{EN,FR}{all of EN and FR modes are not enabled\par}
> \doifnotallmodes{EN,FR,RU}{all of EN, FR, and RU modes are not enabled\par}
> \stoptext
> 
> Then, add the following block to the beginning of the file and try again.
> 
> \definemode[EN,FR,RU][keep]
> \doifmodeelse{EN}
>   {    \disablemode[FR]
>        \disablemode[RU]}
>   {\doifmodeelse{FR}
>    {   \disablemode[EN]
>        \disablemode[RU]}
>    {\doifmodeelse{RU}
>      { \disablemode[EN]
>        \disablemode[FR]}}
>      { \enablemode[EN]}}
> 
> 
> I find it useful to add such a block to the environment of every file that uses mutually-exclusive modes. This version pf the block sets a default value if none is on the command line.
> 

Thanks. It seems that the last part has a {}-issue. \enablemode[EN] is always wxecuted if on the commandline only FR or RU is set 

\definemode[EN,FR,RU][keep]
\doifmodeelse{EN}
  {
    \disablemode[FR]
    \disablemode[RU]
  }
  {
    \doifmodeelse{FR}
    {
      \disablemode[EN]
      \disablemode[RU]
    }
    {
      \doifmodeelse{RU}
      {
        \disablemode[EN]
        \disablemode[FR]
      }
    }
    {
      \enablemode[EN]
    }
  }

I am now using

\doifmodeelse{EN}
  {
    \disablemode[FR]
    \disablemode[RU]
  }
  {
    \doifmodeelse{FR}
    {
      \disablemode[EN]
      \disablemode[RU]
    }
    {
      \doifmodeelse{RU}
      {
        \disablemode[EN]
        \disablemode[FR]
      }
      {
        \enablemode[EN]
      }
    }
  }

> -- 
> Rik
> 
> 
> 
> 
> 
> 
> 
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


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

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2022-05-11  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-10 21:39 Does \startnotallmodes work? Gerben Wierda via ntg-context
2022-05-11  0:37 ` Rik Kabel via ntg-context
2022-05-11  8:33   ` Gerben Wierda 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).