From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/115200 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Schuster via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Can I simplify this to some sort of logic so it scales better? Date: Mon, 6 Jun 2022 14:18:42 +0200 Message-ID: <7b7c4272-e7b8-a767-825d-0ca2d5e75165@gmail.com> References: <5E55F07E-0E20-4D95-ACF5-35CB4A3F6D72@rna.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7346570684523775904==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2446"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 PostboxApp/7.0.56 Cc: Wolfgang Schuster To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Jun 06 14:19:29 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyBhh-0000QV-A4 for gctc-ntg-context-518@m.gmane-mx.org; Mon, 06 Jun 2022 14:19:29 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 855D92A1B34; Mon, 6 Jun 2022 14:18:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AW8pov0ZLvTd; Mon, 6 Jun 2022 14:18:48 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 89C982A1B38; Mon, 6 Jun 2022 14:18:48 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2B2232A1B38 for ; Mon, 6 Jun 2022 14:18:47 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EcIhitDEMQN6 for ; Mon, 6 Jun 2022 14:18:45 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.42; helo=mail-ej1-f42.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Original-Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 8B0EF2A1B34 for ; Mon, 6 Jun 2022 14:18:45 +0200 (CEST) Original-Received: by mail-ej1-f42.google.com with SMTP id v1so17905259ejg.13 for ; Mon, 06 Jun 2022 05:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=5xK8D8OFfuL0zgwS2fkU36NQoGdxOEqWlqNiU3jEhY0=; b=H9yWLnt6tQ2pfqUji6ThTC6p4lAIlXwbxImT1pQ1t3xjUIXPAxqpQw49mjGSmUr6Ol f9zMCD5d9CBWniAiyA7priK8g/mJ7SgpVlDEuZZzO0WuHeQgmSHpXQe+me80iayYPtLr 0mm7HKqBVuQ1xpw2imKO2pKxsawdBWhQgjXJQZiYd3sVeAj3uHwmenqFEmVSSRJIsx1W W5QwLvxg4WSTvYId1cjIQfIsFUT1eDN+eG1M82ENrfzL3Ni/7J+TdCxgn2XUoZ4mg2OH NhoO7O9IKTazSp6DMncLZjW9TA88/YkBOJf2/foogRGrjsylV1pxXHtPz9VbPR7BWLeb +BNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=5xK8D8OFfuL0zgwS2fkU36NQoGdxOEqWlqNiU3jEhY0=; b=7WaKOaDilZlOpY8G7Bwnhytbv40ToXV0zZVXM8/NyPt9uHE6pDU/ZePk5bOcfaTAOo 9ucy/X7toYjhUmVSMcfnPCCmSKz5SFhFqI119mVtkE2Y+WbxNgDn815RHk6eSoQYdKEE S9gO4RzB9BLiyU3vHy4TJ0OWk//N5JPSZIj/DviKNkfqztx3+W363Mf4ATONH7+eqAEF bza6bHZFW6NcnVdf63voNblGvNr5NqmYDWVMaeSMJq3KOIwJMZrWm45LmWa0TPP+jkmn 0w9Yilt+vfbImxEw+tVJIpYG+h96zxUjpLKtBranK5mwBckG1+mpXI8b8bdj+a0+fIqW B3HA== X-Gm-Message-State: AOAM532ZAnXX7T9Q6oMze2NtMlzPj8GUlXSAc9MyZmpIW4AQte+UkYct K7vJoQStmcE3g+iLxTrCpugsAuHqfRY= X-Google-Smtp-Source: ABdhPJwL1DQacxcxhW6j4RpQU1SFlj+k1fE7pqpOlEVf5DA0r/pzA1gsG/Dl6htGyDuvGuBOyxav2w== X-Received: by 2002:a17:906:ae92:b0:711:2b64:c829 with SMTP id md18-20020a170906ae9200b007112b64c829mr9552317ejb.89.1654517925036; Mon, 06 Jun 2022 05:18:45 -0700 (PDT) Original-Received: from ?IPv6:2a02:810d:a8bf:f874::e9d0? ([2a02:810d:a8bf:f874::e9d0]) by smtp.gmail.com with ESMTPSA id cf4-20020a0564020b8400b0042fbc23bfcesm4449758edb.46.2022.06.06.05.18.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2022 05:18:44 -0700 (PDT) In-Reply-To: <5E55F07E-0E20-4D95-ACF5-35CB4A3F6D72@rna.nl> Content-Language: en-US X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:115200 Archived-At: This is a multi-part message in MIME format. --===============7346570684523775904== Content-Type: multipart/alternative; boundary="------------EE11C9445C6C4D2D60B6F9C5" Content-Language: en-US This is a multi-part message in MIME format. --------------EE11C9445C6C4D2D60B6F9C5 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Gerben Wierda via ntg-context schrieb am 06.06.2022 um 13:34: > I have this: > > \definemode[EN,FR,RU,PT][keep] > \doifmodeelse{EN} > { >     \disablemode[FR] >     \disablemode[RU] >   \disablemode[PT] >   } >   { > \doifmodeelse{FR} >     { >       \disablemode[EN] >       \disablemode[RU] >       \disablemode[PT] >     } >     { >       \doifmodeelse{RU} >       { >       \disablemode[EN] > \disablemode[FR] > \disablemode[PT] >       } >       { >       \doifmodeelse{PT} >         { >           \disablemode[EN] >           \disablemode[FR] >           \disablemode[RU] >         } >       { > \enablemode[EN] >         } >       } >   } >   } > > But for every language added this becomes more and more complex. I was > wondering what would be a good approach to simplify it. > > I want to make sure that one and only one of these modes is active and > that if no mode is entered on the command line the mode is EN. %\enablemode[EN] \enablemode[FR] %\enablemode[RU] %\enablemode[PT] \definemode[EN,FR,RU,PT][keep] \startmodeset     [EN]      {\disablemode[FR,RU,PT]}     [FR]      {\disablemode[EN,RU,PT]}     [RU]      {\disablemode[EN,FR,PT]}     [PT]      {\disablemode[EN,FR,RU]}     [default] {\enablemode[EN]} \stopmodeset \starttext \doifmode{EN}{english} \doifmode{FR}{french} \doifmode{RU}{russian} \doifmode{PT}{portuguese} \stoptext Wolfgang --------------EE11C9445C6C4D2D60B6F9C5 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit Gerben Wierda via ntg-context schrieb am 06.06.2022 um 13:34:
I have this:

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

But for every language added this becomes more and more complex. I was wondering what would be a good approach to simplify it. 

I want to make sure that one and only one of these modes is active and that if no mode is entered on the command line the mode is EN.

%\enablemode[EN]
\enablemode[FR]
%\enablemode[RU]
%\enablemode[PT]

\definemode[EN,FR,RU,PT][keep]

\startmodeset
    [EN]      {\disablemode[FR,RU,PT]}
    [FR]      {\disablemode[EN,RU,PT]}
    [RU]      {\disablemode[EN,FR,PT]}
    [PT]      {\disablemode[EN,FR,RU]}
    [default] {\enablemode[EN]}
\stopmodeset

\starttext
\doifmode{EN}{english}
\doifmode{FR}{french}
\doifmode{RU}{russian}
\doifmode{PT}{portuguese}
\stoptext

Wolfgang

--------------EE11C9445C6C4D2D60B6F9C5-- --===============7346570684523775904== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============7346570684523775904==--