From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/108295 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jairo A. del Rio" Newsgroups: gmane.comp.tex.context Subject: Re: Using \applytosplitstringwordspaced and allies Date: Sat, 8 Aug 2020 09:31:17 -0500 Message-ID: References: <73587e56-8266-b177-040d-8ba97a175101@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4413906913290220608==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37388"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users , Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Sat Aug 08 16:32:08 2020 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 1k4PtH-0009ZX-61 for gctc-ntg-context-518@m.gmane-mx.org; Sat, 08 Aug 2020 16:32:07 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id C73FB1A7D0F; Sat, 8 Aug 2020 16:31:32 +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 QTOAH82cPd21; Sat, 8 Aug 2020 16:31:31 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2C4C91A7D02; Sat, 8 Aug 2020 16:31:31 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BDFE21A7D01 for ; Sat, 8 Aug 2020 16:31:30 +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 sSvXfndVXG3U for ; Sat, 8 Aug 2020 16:31:29 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.48; helo=mail-wm1-f48.google.com; envelope-from=jairoadelrio6@gmail.com; receiver= Original-Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 CE9C11A7CFC for ; Sat, 8 Aug 2020 16:31:29 +0200 (CEST) Original-Received: by mail-wm1-f48.google.com with SMTP id 3so4389256wmi.1 for ; Sat, 08 Aug 2020 07:31:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pDs5uJEFT7OQumrISy/gm3hYqzM9Po7wADyl+oFtExs=; b=nkE/S2Q9E+GHZixomO9mBk2Wn/fM4PbvPS3amVGFg0uvCbg1bfMUVSvBcaXD/5qkXg o+9xeRpQyvd3WEvNiE4hnWk3PP8C7OtkiHlIPMlehVcNbHCkjvKhzl02ehq/+AKKmVHG /MBPCK2N4kHUCeW90hhyj08KKRmHZtZ9OxB6sAbJMDvlaTkg8V+9vGVhy18f7DXSmHuG d65dvkSugGtHXOjT+D/Y9LW7uVfUbVB2Qgl0L9/F3eBnxiXjSRvafJla8ZrQvXacZpSi LifMjK4YobT+5FtjXWeRUnZQueAVa5XFeCKvmuUFJjszv3nUHk7n8S3bH2Kfe/zSpfPF kbdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pDs5uJEFT7OQumrISy/gm3hYqzM9Po7wADyl+oFtExs=; b=lXq8E/HoSeoWOVZxFGl7pHkmyw6nIGpggDS0oXh8/Y42MB75Kscf/HLtLoMpbhVPRv QsFcCHfv+W02aWtO+TfR6UJY9KJ/Rqr6JtrF18wRVqn3JXjT5V7tV7zlud3hdCAgqmGl JH/ynuKRIgvxV47Vz6UnsZ1VnfmVlM1BM5SgpwCl0HYljgsUYSkVlG8xRtm9BM6DyFUb jOe1virH/pmdDAYQqCIh59176vcZMbluwVPDAB4cgNYfrPWmkOkEV7o6v45JAW5ksAPt c6s6afGF2LZpYTRapDIqcyQpoTANKqWy9EwVVhvCx9bJ0WpIrUGaNOwkQE0UCQl0UPFL eOkg== X-Gm-Message-State: AOAM533gPAJY0esusekmu1yZLIARtc9iAuN8ON9SZ6wD4khu0tFvff+9 FT2v19hO8UyHn+ZMlgwDHbxyxjisqol21gFRZjSn2Ed+m2M= X-Google-Smtp-Source: ABdhPJzzmfphL68aXwvAwRKRMnf80KMGJY4iYKpgaaGaLj2Bmxzx4tNXrf0/1qIwt7S9YvVA5KX0Jbcd5x+i2jnzZuE= X-Received: by 2002:a1c:6002:: with SMTP id u2mr17162485wmb.170.1596897088969; Sat, 08 Aug 2020 07:31:28 -0700 (PDT) In-Reply-To: <73587e56-8266-b177-040d-8ba97a175101@xs4all.nl> 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:108295 Archived-At: --===============4413906913290220608== Content-Type: multipart/alternative; boundary="000000000000bb1fe705ac5e9353" --000000000000bb1fe705ac5e9353 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you very much! Something else happens: \applytosplitstringwordspaced\somemacro{Content and {\tt typewriter} more content} either ignores braced groups or ignores macros AND prints braces "{" and "}" as if it were in verbatim mode depending on the content being on the document or loaded via Lua, even when context.escape is used. How to keep {\it braced content}? Thank you in advance. Jairo :) El s=C3=A1b., 8 de ago. de 2020 a la(s) 08:34, Hans Hagen (j.hagen@xs4all.n= l) escribi=C3=B3: > On 8/8/2020 12:00 PM, Wolfgang Schuster wrote: > > Jairo A. del Rio schrieb am 08.08.2020 um 10:14: > >> Hi, list! :D > >> I've found \applytosplitstringwordspaced and many other commands > >> reading on the mailing list and TeX StackExchange. An issue with those > >> is: the following does not work: > >> > >> \applytosplitstringwordspaced\somemacro{\input knuth} > >> > >> It only works with explicit TeX "words". How to circumvent this > >> inconvenience? Thanks in advance. > > > > You can't feed knuth.tex to the command because it contains multiple > > paragraphs but even when your file contains only a single paragraph it > > isn't perfect because the linebreak after the last line contains as > > extra word (seen in the first paragraph below). > > > > To use \input as argument for \applytosplitstringwordspaced you need a > > few \expandafter's to ensure the file is read before the argument is > > passed to Lua. A easier method is to move everything to Lua where you > > read the file and put it in a string, afterward you can use the CLD > > mechanism to call \applytosplitstringwordspaced from Lua. > > > > \unexpanded\def\somemacro#1{[#1]} > > > > \starttext > > > > > \expandafter\applytosplitstringwordspaced\expandafter\somemacro\expandaft= er{\input > > > weisman } > > > > \blank > > > > \startluacode > > > > -- local ward =3D io.loaddata(resolvers.findfile("ward.tex")) > > local ward =3D > string.fullstrip(io.loaddata(resolvers.findfile("ward.tex"))) > > > > context.applytosplitstringwordspaced ( "\\somemacro", ward ) > > > > \stopluacode > > > > \stoptext > just a remark: knuth.tex is tricky becauss it also has \TeX and \ and > such, so one needs to escape it, as in: > > context.applytosplitstringwordspaced ( > "\\somemacro", > context.escape(ward) > ) > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > _________________________________________________________________________= __________ > --000000000000bb1fe705ac5e9353 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you very much! Something else happens= :

\applytosplitstringwordspaced\somemacro{Content and {\tt ty= pewriter} more content}

either ignores braced groups or ignore= s macros AND prints braces "{" and "}" as if it were in= verbatim mode depending on the content being on the document or loaded via= Lua, even when context.escape is used. How to keep {\it braced content}? T= hank you in advance.

Jairo :)

El s=C3=A1b., 8 de ago. de 20= 20 a la(s) 08:34, Hans Hagen (j.hagen@= xs4all.nl) escribi=C3=B3:
On 8/8/2020 12:00 PM, Wolfgang Schuster wrote:
> Jairo A. del Rio schrieb am 08.08.2020 um 10:14:
>> Hi, list! :D
>> I've found \applytosplitstringwordspaced and many other comman= ds
>> reading on the mailing list and TeX StackExchange. An issue with t= hose
>> is: the following does not work:
>>
>> \applytosplitstringwordspaced\somemacro{\input knuth}
>>
>> It only works with explicit TeX "words". How to circumve= nt this
>> inconvenience? Thanks in advance.
>
> You can't feed knuth.tex to the command because it contains multip= le
> paragraphs but even when your file contains only a single paragraph it=
> isn't perfect because the linebreak after the last line contains a= s
> extra word (seen in the first paragraph below).
>
> To use \input as argument for \applytosplitstringwordspaced you need a=
> few \expandafter's to ensure the file is read before the argument = is
> passed to Lua. A easier method is to move everything to Lua where you =
> read the file and put it in a string, afterward you can use the CLD > mechanism to call \applytosplitstringwordspaced from Lua.
>
> \unexpanded\def\somemacro#1{[#1]}
>
> \starttext
>
> \expandafter\applytosplitstringwordspaced\expandafter\somemacro\expand= after{\input
> weisman }
>
> \blank
>
> \startluacode
>
> -- local ward =3D io.loaddata(resolvers.findfile("ward.tex")= )
> local ward =3D string.fullstrip(io.loaddata(resolvers.findfile("w= ard.tex")))
>
> context.applytosplitstringwordspaced ( "\\somemacro", ward )=
>
> \stopluacode
>
> \stoptext
just a remark: knuth.tex is tricky becauss it also has \TeX and \ and
such, so one needs to escape it, as in:

context.applytosplitstringwordspaced (
=C2=A0 =C2=A0"\\somemacro",
=C2=A0 =C2=A0context.escape(ward)
)


-----------------------------------------------------------------
=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
-----------------------------------------------------------------
___________________________________________________________________________= ________
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/nt= g-context
webpage=C2=A0 : http://www.pragma-ade.nl / http://context.aanhet.net=
archive=C2=A0 : https://bitbucket.org/phg/context-m= irror/commits/
wiki=C2=A0 =C2=A0 =C2=A0: http://contextgarden.net
___________________________________________________________________________= ________
--000000000000bb1fe705ac5e9353-- --===============4413906913290220608== 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== --===============4413906913290220608==--