From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/91584 Path: news.gmane.org!not-for-mail From: Alexander Shukaev Newsgroups: gmane.comp.tex.context Subject: Re: Smart Acronym Pluralization (`y' or `ie' before `s') Date: Sun, 24 May 2015 16:56:08 +0200 Message-ID: References: <55619733.3000702@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0123568986==" X-Trace: ger.gmane.org 1432479432 22735 80.91.229.3 (24 May 2015 14:57:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 May 2015 14:57:12 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun May 24 16:56:59 2015 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YwXKk-00007P-4R for gctc-ntg-context-518@m.gmane.org; Sun, 24 May 2015 16:56:58 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0E57210223 for ; Sun, 24 May 2015 16:56:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WKnLvmb-8QyO for ; Sun, 24 May 2015 16:56:55 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 5AD0F10233 for ; Sun, 24 May 2015 16:56:21 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6E84D101F9 for ; Sun, 24 May 2015 16:56:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 0Zi1vOJcJKE8 for ; Sun, 24 May 2015 16:56:16 +0200 (CEST) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id 01321101E8 for ; Sun, 24 May 2015 16:56:10 +0200 (CEST) Original-Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [IPv6:2a00:1450:4010:c04::230]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id t4OEu99V026160 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sun, 24 May 2015 16:56:09 +0200 Original-Received: by lbbqq2 with SMTP id qq2so38681768lbb.3 for ; Sun, 24 May 2015 07:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=sHuIcNx1lckmbR9ECb++ux9Ke74Ba7CWsKn8/duKm5o=; b=Lea/Xml2IGL95vl7MtirDlkIZ+2/g2fKUE2tQ8v3rZhbM8kL9EnrfAHRL0LjuA2ZC4 VHO4yS4Mkc45fESh2+wOXUrSWDEHMD8jvKF7KeyjZTNPZ8gO3GlHI4veR7F0UYYZzqdm uOmpugHJub2eSaCqyab6F+scHz0YXKg4HlvDsRKHux8yHQ9IefIRXtj/lxOtfrQKV4Zl TeHjkorzBjelU9H/ZYeowhgVK1jNUFKDGjtz3OeFrzpAU4kR4ys0+ZIk5qMxpofZHifn TwZDXYSj7FLjbCr+Ag9n0kVkomsss46FhCI9prJWJEGbF8bei5e9MtjyqrUxH9Wy2xav ujVQ== X-Received: by 10.152.2.38 with SMTP id 6mr14728415lar.80.1432479368944; Sun, 24 May 2015 07:56:08 -0700 (PDT) Original-Received: by 10.112.36.103 with HTTP; Sun, 24 May 2015 07:56:08 -0700 (PDT) In-Reply-To: <55619733.3000702@wxs.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2a00:1450:4010:c04::230; country=FI; region=South Karelia; city=Lappeenranta; latitude=61.0667; longitude=28.1833; http://maps.google.com/maps?q=61.0667,28.1833&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01OvOU9tw - c018ea9c1fc8 - 20150524 (trained as not-spam) Received-SPF: pass (filter4-ams.mf.surf.net: domain of haroogan@gmail.com designates 2a00:1450:4010:c04::230 as permitted sender) receiver=filter4-ams.mf.surf.net; client-ip=2a00:1450:4010:c04::230; envelope-from=; helo=mail-lb0-x230.google.com; identity=mailfrom X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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.org gmane.comp.tex.context:91584 Archived-At: --===============0123568986== Content-Type: multipart/alternative; boundary=089e013c6b92ef21a00516d5175c --089e013c6b92ef21a00516d5175c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, May 24, 2015 at 11:17 AM, Hans Hagen wrote: > On 5/24/2015 1:39 AM, Alexander Shukaev wrote: > >> Hello, >> >> Consider the following: >> >> \definesynonyms >> [ACRONYM] >> [ACRONYMS] >> [\FULL] >> [\SHORT] >> >> =E2=80=8B=E2=80=8B >> \ACRONYM{DLL}{Dynamic-Link Librar\doifnextcharelse{s}{ie}{y}} >> >> Why >> >> \FULL{DLL}s >> >> does not do what I expect it to do? I assume that it's because >> `\doifnextcharelse' expands before `\FULL'. So how to achieve the >> desired effect? Thanks. >> > > \FULL is doing a lot and it's unlikely that inside there the nest token > seen is the 's' so your test fails > > \ACRONYM{DLL}{\SelectFull{Dynamic-Link Library}{Dynamic-Link Libraries}} > > \def\VeryFullSingular#1#2{\FULL{#1}} > \def\VeryFullPlural #1#2{\FULL{#2}} > > \unexpanded\def\VeryFull > { > =E2=80=8B=E2=80=8B > \doifnextcharelse{s} > {\let\SelectFull\VeryFullPlural} > {\let\SelectFull\VeryFullSingular}} > > test \VeryFull{DLL} or \VeryFull{DLL}s it is > > if there is real need for this i can consider building something in but > the check for a following 's' is not that common I think > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com > | 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://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > > _________________________________________________________________________= __________ =E2=80=8BHello Hans, Thanks for your response. It seems to me that a simple (and backward compatible) extension would be to add =E2=80=8Bthe 3rd optional parameter t= o `ACRONYM': =E2=80=8B\ACRONYM{DLL}{Dynamic-Link Library}[Dynamic-Link Libraries][s] =E2=80=8B =E2=80=8B ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^= ^ ^ (should of course be `s' by default, but let it be configurable just in case) =E2=80=8Band put \doifnextcharelse{}{}{}=E2=80=8B =E2=80=8Binside `FULL' properly so that it can indeed find in cas= e of `\FULL{DLL}'.=E2=80=8B Regards, Alexander --089e013c6b92ef21a00516d5175c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Sun, May 24, 2015 at 11:= 17 AM, Hans Hagen <pragma@wxs.nl= > wrote:<= br>
On 5/24/2015 1:39 AM, Alexander Shuk= aev wrote:
Hello,

Consider the following:

\definesynonyms
[ACRONYM]
[ACRONYMS]
[\FULL]
[\SHORT]

=E2=80=8B=E2=80=8B
\ACRONYM{DLL}{Dynamic-Link Librar\doifnextcharelse= {s}{ie}{y}}

Why

\FULL{DLL}s

does not do what I expect it to do?=C2=A0 I assume that it's because `\doifnextcharelse' expands before `\FULL'.=C2=A0 So how to achieve= the
desired effect?=C2=A0 Thanks.

\FULL is doing a lot and it's unlikely that inside there the nest token= seen is the 's' so your test fails

\ACRONYM{DLL}{\SelectFull{Dynamic-Link Library}{Dynamic-Link Libraries}}
\def\VeryFullSingular#1#2{\FULL{#1}}
\def\VeryFullPlural=C2=A0 #1#2{\FULL{#2}}

\unexpanded\def\VeryFull
=C2=A0 {
=E2=80=8B=E2=80=8B
\doifnextcharelse{s}
=C2=A0 =C2=A0 =C2=A0{\let\SelectFull\VeryFullPlural}
=C2=A0 =C2=A0 =C2=A0{\let\SelectFull\VeryFullSingular}}

test \VeryFull{DLL} or \VeryFull{DLL}s it is

if there is real need for this i can consider building something in but the= check for a following 's' is not that common I think


-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 H= ans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ridderstraat 27 | 8061 GH = Hasselt | The Netherlands
=C2=A0 =C2=A0 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| www.p= ragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage=C2=A0 : http= ://www.pragma-ade.nl / http://tex.aanhet.net
archive=C2=A0 : http://foundry.supelec.fr/projects/contextrev/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________

=E2=80=8BHello Hans,

Thanks for your = response.=C2=A0 It seems to me that a simple (and backward compatible) exte= nsion would be to add =E2=80=8Bthe 3rd optional parameter to `ACRONYM':=

=E2=80=8B\ACR= ONYM{DLL}{Dynamic-Link Library}[Dynamic-Link Libraries][s]
=E2= =80=8B =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =E2=80=8B ^^^^^^^^^^^^^^^^= ^^^^ =C2=A0^^^^^^^^^^^^^^^^^^^^^^ =C2=A0^
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 <single> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<p= lural> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<trigge= r> (should of course be `s' by default, but let it be configurable j= ust in case)

= =E2=80=8Band put

\doifnextcharelse{<trigger>}{<plural>}{<single>}=E2= =80=8B

=E2=80=8Binside `FULL' properly so t= hat it can indeed find <trigger> in case of `\FULL{DLL}<trigger>= ;'.=E2=80=8B

Regards,
Alexander
--089e013c6b92ef21a00516d5175c-- --===============0123568986== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============0123568986==--