From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/113036 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Wolfgang Schuster via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions Date: Sun, 10 Oct 2021 12:40:33 +0200 Message-ID: <2342fc45-5ac0-9504-d94f-5a0ee3a3f50f@gmail.com> References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2660191879825997104==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37387"; 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.49 Cc: Wolfgang Schuster To: mailing list for ConTeXt users , Joey McCollum via ntg-context Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 10 12:41:09 2021 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 1mZWGT-0009Uu-Bl for gctc-ntg-context-518@m.gmane-mx.org; Sun, 10 Oct 2021 12:41:09 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8AF822889B6; Sun, 10 Oct 2021 12:40:40 +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 VM6Vzk9lJxqq; Sun, 10 Oct 2021 12:40:38 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B77412889B1; Sun, 10 Oct 2021 12:40:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 01C822889AD for ; Sun, 10 Oct 2021 12:40:37 +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 UJ9oxaPIz6V2 for ; Sun, 10 Oct 2021 12:40:36 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.49; helo=mail-wr1-f49.google.com; envelope-from=wolfgang.schuster.lists@gmail.com; receiver= Original-Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 D767F288986 for ; Sun, 10 Oct 2021 12:40:35 +0200 (CEST) Original-Received: by mail-wr1-f49.google.com with SMTP id i12so32821616wrb.7 for ; Sun, 10 Oct 2021 03:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=Kpj2uExqh2CH21Ga71uQzyQ36/jnmOKtZvrCIpfmsjc=; b=LVDpYS7QfBpzatR1orkmlKDUC1BhMlPkgvnNvmzQN1rGjEXb5p7Tkr/BnNa3+iRvsC R9S0tFhw82iSz6+7+qaKXNTDgCMZ0i9etS4zkS40heK5LK0AI1XDNO7DDlsGUr7iOI8n sxd/s85CBz2OEb2tzwbEWuVA+dfwltswDsP/MMO508j6TrjyEB/HcVOSmUnim5d0poEE 6Dib8nHvhgm8z4aY3VaxXUAo2mMyuJ7YCDg1ocESKNEj/spdIyZmbO0++QNdd2itEZWM CpA9lxt7DNNWQhFLh56Bu3lkKIY2YVOriH2ajFhvhvmWhUMUEGT0QTfpIU/29cSQM3O/ SruQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=Kpj2uExqh2CH21Ga71uQzyQ36/jnmOKtZvrCIpfmsjc=; b=5kF9QkASF1SFcAfvOXWw4GlIBUmD8qgxW5jkai96prjrjTVsNxm+OBze/QIElr7QYT yD0Q9XsYHx+S+uWfmGM9dCB8GKNpMOcjoyQ+0dpA7YeiiqMRgXEwZjEQAoT1Fk7as4Ms LO1kMu1WnTJZsS03a7UuYG7Mt7/Nfz3+JxgxZHmZ7+SXo1WYzMY+m/fnaiAKCTem5CCJ OK3JEURiCRzfrsxHLty1I0RsO5oXpQzQbdnmtZYWjx5zdIhDU64my3wdmExPq7/dVvwR 8eeAQ0XZIh4XlDdsfjDXxh7+laS2WjDHiPh03cgQG6cR/SeSrrQBRBK00QQp9iQjtPRl qisQ== X-Gm-Message-State: AOAM533XGrAlCPAbzgc6pYSAqqyT8Mx1xb4uoCdhkdqnY2tU2vvIMVbo hxtK+wRuNxEtx72hNSubqLaPfpjXAJY= X-Google-Smtp-Source: ABdhPJwbj56EgO5keUxUYcwg2g9mycYJ0HKVHcF/m487CdyDEhUgzERSB4po2+kgymv99hjZW2CVkg== X-Received: by 2002:adf:a184:: with SMTP id u4mr17066090wru.69.1633862435570; Sun, 10 Oct 2021 03:40:35 -0700 (PDT) Original-Received: from ?IPv6:2a02:810d:a8bf:f874:40e2:c5b2:9e6d:8013? ([2a02:810d:a8bf:f874:40e2:c5b2:9e6d:8013]) by smtp.gmail.com with ESMTPSA id z12sm4547818wrv.31.2021.10.10.03.40.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Oct 2021 03:40:35 -0700 (PDT) In-Reply-To: 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:113036 Archived-At: This is a multi-part message in MIME format. --===============2660191879825997104== Content-Type: multipart/alternative; boundary="------------D868BDF78745C901C9112CBF" Content-Language: en-US This is a multi-part message in MIME format. --------------D868BDF78745C901C9112CBF Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Joey McCollum via ntg-context schrieb am 10.10.2021 um 05:42: > The test using \removepunctuation that you provided does what it > should be doing (it produces 6 instances of "test-test" with the > intervening punctuation mark in each case removed), but it doesn't do > what I'm trying to do in the MWE above. I'm trying to take certain > punctuation marks that follow the \autopuncttest macro and place them > before it instead. Looking at the typo-chr .lua and .mkiv files, I see > that there are \pushpunctuation and \poppunctuationmethods in addition > to the \removepunctuation method. These might be useful for this > purpose, but in any case, I still have to check if the trailing > character is one of the characters in a specified set/string, and this > is where the error is arising. Add \protected (or \unexpanded) to your command definition. \startbtxrenderingdefinitions[myspec] \protected\def\autopuncttest#1#2%   {\removeunwantedspaces%    \doifinstring{#2}{,.!?;:}{#2}%    \footnote{#1}%    \doifnotinstring{#2}{,.!?;:}{#2}} \stopbtxrenderingdefinitions Wolfgang --------------D868BDF78745C901C9112CBF Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Joey McCollum via ntg-context schrieb am 10.10.2021 um 05:42:
The test using \removepunctuation that you provided does what it should be doing (it produces 6 instances of "test-test" with the intervening punctuation mark in each case removed), but it doesn't do what I'm trying to do in the MWE above. I'm trying to take certain punctuation marks that follow the \autopuncttest macro and place them before it instead. Looking at the typo-chr .lua and .mkiv files, I see that there are \pushpunctuation and \poppunctuation methods in addition to the \removepunctuation method. These might be useful for this purpose, but in any case, I still have to check if the trailing character is one of the characters in a specified set/string, and this is where the error is arising.

Add \protected (or \unexpanded) to your command definition.

\startbtxrenderingdefinitions[myspec]
\protected\def\autopuncttest#1#2%
  {\removeunwantedspaces%
   \doifinstring{#2}{,.!?;:}{#2}%
   \footnote{#1}%
   \doifnotinstring{#2}{,.!?;:}{#2}}
\stopbtxrenderingdefinitions

Wolfgang

--------------D868BDF78745C901C9112CBF-- --===============2660191879825997104== 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== --===============2660191879825997104==--