From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HK_RANDOM_FROM,HTML_MESSAGE, MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 11032 invoked from network); 29 Nov 2023 10:19:29 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2023 10:19:29 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 8F990483ABB for ; Wed, 29 Nov 2023 11:19:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BrPy7sOXnqcJ for ; Wed, 29 Nov 2023 11:19:28 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id C0DCA483A9C for ; Wed, 29 Nov 2023 11:19:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 0D2F9483A9C for ; Wed, 29 Nov 2023 11:19:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I3JH1zyB6TL0 for ; Wed, 29 Nov 2023 11:19:21 +0100 (CET) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 8C0BE483A9B for ; Wed, 29 Nov 2023 11:19:21 +0100 (CET) Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-5c1a75a4b6cso3919742a12.2 for ; Wed, 29 Nov 2023 02:19:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701253159; x=1701857959; darn=ntg.nl; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uO1xFqU92avIgtTlwJYp6KC8UH5fUU6sL0RZFqnT93Q=; b=hn2DMvx90uIMfsaO+9xkZRtvNDUFFZ4hIRD6ZVUQi24dEfvz33d9yTiO9+AVWrIXtq J2noB8m7tswRiBTFXAybn+9R9Dd7JPt8UKfj3PJKR9Jq9XU37qljA7mBvJbuZfDF12ZL vPTsdhtBU3b01rMiYO79Cl5Rh/XYQuJjgI3niXic0Dn1Y3vJSMTCpba8011uts9sQIO7 A6xs04PJxBYsGETyyDoOfFPQCKDaoLcVp8osZNO3Zp1cRDzurtJVsL0OvYAl+XXiU7ue GO7hCHKYgnzu5GyMWmCk4Sy2nfWwCYh2wdPVl+Z9eDT0KX8b0IySwsZNkNySnXwufTHA 9MlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701253159; x=1701857959; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uO1xFqU92avIgtTlwJYp6KC8UH5fUU6sL0RZFqnT93Q=; b=wlW+u1g+8x6LBfdYnGs94fB9w+YfO12wztWPboeCHLoOUOLJzFelUDWmpjNHR5zQnB f257Bt4WTsk+hBPPc9rGNpj11/U/CbWRBSirLH86LOHi3uzoZMiHyC/igmIml2F1DeyI jOwLVx4s9CN8g5RrzrUGF+vn9+1/7nkg6521MDfydE/jkA7mqkmIjLXx4AU0gRHHLmoa S2FK3tffdpAUbWEB+nz84nXUykmnRmEiL6XN/6C3njXur6O5Bvxg1pxx7KGj2gBIvksw 3OxSiobnfAzq7NxMDX9LOWwdp50P/UV9h1bb4Ykuob7tzS/p+yI8Kw96qjt0IOeeEjty pU6w== X-Gm-Message-State: AOJu0Ywo3mLJVcxgEvWv2E1VIgPF7UbNKRoaYqIxN5hT1TlbrO3nulJ2 MqNR+5EM7/0WG20KuUzAXuDgG3amibtnoxTxXTvHiMzyMAY= X-Google-Smtp-Source: AGHT+IFwmjq9odNixKew1FMNS8XZYIdXITLog1LOCfuBHr/Y+9P/XH4E45AHjc8k37UdSnFC3jam27/RC01dZ6JaD0c= X-Received: by 2002:a05:6a21:1a2:b0:18b:d207:d84d with SMTP id le34-20020a056a2101a200b0018bd207d84dmr21330561pzb.0.1701253159337; Wed, 29 Nov 2023 02:19:19 -0800 (PST) MIME-Version: 1.0 References: <0d617461-a804-4c77-b40c-fc9037f01739@xs4all.nl> In-Reply-To: <0d617461-a804-4c77-b40c-fc9037f01739@xs4all.nl> From: Yihan Song Date: Wed, 29 Nov 2023 18:19:07 +0800 Message-ID: To: Hans Hagen Message-ID-Hash: A7B4BNZMUYUDNMXSJTVJ4K5JBPML3UXQ X-Message-ID-Hash: A7B4BNZMUYUDNMXSJTVJ4K5JBPML3UXQ X-MailFrom: syhannnn@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: mailing list for ConTeXt users X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: Support Chinese Date Conversion List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============2123817577647401111==" --===============2123817577647401111== Content-Type: multipart/alternative; boundary="0000000000003c440e060b47de4c" --0000000000003c440e060b47de4c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Hans, That works for me, I patch the core-con.lua with your implementation, update the local cache by running `mtxrun --script cache --make`, context my document and get the same "as-is" result as before, I think that would be a valuable idea to have an extra as-is function for potential number conversions. And I just realize, for Chinese date, only year section follows the as-is pattern, for month or day, December should be represented as =E5=8D=81=E4= =BA=8C=E6=9C=88 instead of =E4=B8=80=E4=BA=8C, twenty-sixth is =E4=BA=8C=E5=8D=81=E5=85=AD=E6=97=A5 in= stead of =E4=BA=8C=E5=85=AD, we might need to consider to narrow down the name to be year could be more precise and meaningful. Cheers, Yihan On Wed, Nov 29, 2023 at 5:24=E2=80=AFPM Hans Hagen wrot= e: > On 11/29/2023 7:56 AM, Yihan Song wrote: > > Dears, > > > > I am opening a PR to > > improve the Chinese date conversion but it seems that repo is just a > > mirror site without development activities, can someone help to review > > this one? > > sending patched files is faster (i need to check and diff anyway) > > can you test with this: > > if name =3D=3D "date" then > -- We could do some number juggling instead but this is fast > enough. There is > -- no error checking here so we assume a proper year. Maybe a > better name is > -- asis (so that it can be used for more than dates). > local vector =3D vector.normal > for s in gmatch(tostring(n),".") do > r =3D r + 1 ; result[r] =3D vector[tonumber(s)] > end > return concat(result) > end > > (btw, we also need to adapt the lmt file ... once mkiv is frozen we only > add to lmtx) > > 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 > ----------------------------------------------------------------- > > --0000000000003c440e060b47de4c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Hans,

That works for me, I patch the= core-con.lua with your=C2=A0implementation, update the local cache by runn= ing `mtxrun --script cache --make`, context my document and get the same &q= uot;as-is" result as before, I think that would be a valuable=C2=A0ide= a to have an extra as-is function for potential number conversions.=C2=A0

And I just realize, for Chinese date, only year sec= tion follows the as-is pattern, for month or day, December should be repres= ented as =E5=8D=81=E4=BA=8C=E6=9C=88 instead of =E4=B8=80=E4=BA=8C, twenty-= sixth is =E4=BA=8C=E5=8D=81=E5=85=AD=E6=97=A5 instead of =E4=BA=8C=E5=85=AD= , we might need to consider to narrow down the name to be year could be mor= e precise and meaningful.

Cheers,
Yiha= n


On Wed, Nov 29, 2023 at 5:24=E2=80=AFPM Hans = Hagen <j.hagen@xs4all.nl> wr= ote:
On 11/29/20= 23 7:56 AM, Yihan Song wrote:
> Dears,
>
> I am opening a PR <https://github.com/context= garden/context/pull/1>=C2=A0to
> improve the Chinese date conversion but it seems that repo is just a <= br> > mirror site without development activities, can someone help to review=
> this one?

sending patched files is faster (i need to check and diff anyway)

can you test with this:

=C2=A0 =C2=A0 =C2=A0if name =3D=3D "date" then
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- We could do some number juggling inste= ad but this is fast
enough. There is
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- no error checking here so we assume a = proper year. Maybe a
better name is
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- asis (so that it can be used for more = than dates).
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0local vector =3D vector.normal
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for s in gmatch(tostring(n),"."= ) do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0r =3D r + 1 ; result[r] =3D= vector[tonumber(s)]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return concat(result)
=C2=A0 =C2=A0 =C2=A0end

(btw, we also need to adapt the lmt file ... once mkiv is frozen we only add to lmtx)

Hans

-----------------------------------------------------------------
=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=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------

--0000000000003c440e060b47de4c-- --===============2123817577647401111== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________ --===============2123817577647401111==--