From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/107542 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Jairo A. del Rio" Newsgroups: gmane.comp.tex.context Subject: About the use of command handlers Date: Thu, 28 May 2020 23:29:02 -0500 Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6535298310038085507==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="58546"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri May 29 06:29:45 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 1jeWeO-000F7q-HS for gctc-ntg-context-518@m.gmane-mx.org; Fri, 29 May 2020 06:29:44 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 95199181A6F; Fri, 29 May 2020 06:29:17 +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 fcp6ct1AXuwt; Fri, 29 May 2020 06:29:16 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B380D183905; Fri, 29 May 2020 06:29:16 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id F1BC7181EC1 for ; Fri, 29 May 2020 06:29:14 +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 KIITZLwJ65gQ for ; Fri, 29 May 2020 06:29:14 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.47; helo=mail-wr1-f47.google.com; envelope-from=jairoadelrio6@gmail.com; receiver= Original-Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 0111C181A6F for ; Fri, 29 May 2020 06:29:13 +0200 (CEST) Original-Received: by mail-wr1-f47.google.com with SMTP id x6so1764652wrm.13 for ; Thu, 28 May 2020 21:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Q+21dsJQ232UWAN/gw9VE3dQ/Q59qz6bGO1gxFJavnQ=; b=athXKxBUPHlFYoqAVmpb2nKQnHjsTFTP87xs4A0QKfMnRNEK6z0BU5UokAgRx7fmsF /39SYRHp3Bku1lIRuX3wjsJlPBLo/1Dzv+g3I3IlyfjSqUBNq88In7fwnCQ7ZCS4RmDY QfzcxRPnbU3q1VhHOvNra4JDeE6yu6/+K8U8C3tam32XJUtvzxqYMHZeGXOiyp/GyzdU ZY78OMwsdoCN1fxxhsdOzH1sU8BiDjoTQBGwZ4fok2UdEKKsEKh6+qfeOA986mIzN4tI 0vMB5DwdyOogKZidWgV7fofe2SWpr+yikmOjYHC834pTzutvVzKE4Q4S8YCJeAsc5aMo 58LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Q+21dsJQ232UWAN/gw9VE3dQ/Q59qz6bGO1gxFJavnQ=; b=hssqSsTeIaKADYJEmfCBZ9y3ZxZkYIASOP4g/aiAOxIcJNfRtRUcQzqvS0otwpQdCX LboLzSTs2MgQXW5A8m88BXc94mUI3T58d1eOQq5lkNzT6/ZqZgfZjNfV6F2OtFfS0R8/ n93TJKhj4nLj7rZ7nabz5zMZGhR4iNzTSu9q1ckOEopCJtOAjZUxJDBfwyNnajcxZSuY 2+0IVJEMvdpJEEhN9IGUHYUQdp7vPQakeuBdDiqT0l9h4lkPz0xA2FobCxZ/cU7WMGEu ROR03bGtIe9XdHDLr+M1TUWKfPJjrXcu3dtMihRYTjQv6znlk6ZdA+NUs6EEj8DXj5Ol bmFg== X-Gm-Message-State: AOAM533Tc76+ofsBSvTDLLsyxVEmLuReFcA0p6rLC3tuiZzRF+GznrYV pjfYVuDPpCX9QanB55EC+9aVtaz5r7jI3FJ+Z8yikqVmYyk= X-Google-Smtp-Source: ABdhPJykDYl5Y5BFkVlpQYPTdgffeMP1BnQKwipIwL0YG+stt391XcBQahnFzaBtLWL5GYuCXSU+x8ScQXnhPRK1Zzc= X-Received: by 2002:adf:e64b:: with SMTP id b11mr6587410wrn.402.1590726553366; Thu, 28 May 2020 21:29:13 -0700 (PDT) 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:107542 Archived-At: --===============6535298310038085507== Content-Type: multipart/alternative; boundary="00000000000025f5c205a6c1e39e" --00000000000025f5c205a6c1e39e Content-Type: text/plain; charset="UTF-8" Hello list! I was reading the following: https://wiki.contextgarden.net/Style_Alternatives I wanted to figure out how to make a simple module. However, there's a point in the example below which I don't understand % macros=mkvi \startmodule[look] \unprotect \writestatus{loading}{ConTeXt User Module / look} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \installnamespace {look} \installcommandhandler \????look {look} \????look \appendtoks \setuevalue{\currentlook}{\do_look{\currentlook}} \to \everydefinelook \unexpanded\def\do_look#id{% \edef\currentlook{#id}% \dosingleempty\do_do_look% } \def\do_do_look[#parms]#content{% \begingroup \iffirstargument\setupcurrentlook[#parms]\fi %This handles style and color \uselookstyleandcolor\c!style\c!color% #content% \endgroup% } \protect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \stopmodule What have I to do if, instead of "color" or "style", I want to use another keyword, as "dummy" and get its value? Something like \definelook[lol][dummy = blabla] \lol{words} %e.g. words \emph{blabla} or something similar so "lol" is a word, a number or whatever. I've read something about command handlers, but I'm having a hard time trying to understand them. Thank you in advance! --00000000000025f5c205a6c1e39e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello list! I was reading the following:
<= br>

=
I wanted to figure out how to make a simple module. However, there'= ;s a point in the example below which I don't understand
=
% macros=3Dmkvi
\startmodule[look]
\unprotect
\writestatus{loa= ding}{ConTeXt User Module / look} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%= %%%%%%%%%%%%%%%%%%%
\installnamespace {look}
\installcommandhandler \= ????look {look} \????look

\appendtoks
\setuevalue{\currentlook}{\= do_look{\currentlook}}
\to \everydefinelook

\unexpanded\def\do_lo= ok#id{%
\edef\currentlook{#id}%
\dosingleempty\do_do_look%
}
\def\do_do_look[#parms]#content{%
\begingroup
\iffirstargument\setu= pcurrentlook[#parms]\fi
%This handles style and color
\uselookstyleandcolor\c!style\c!color%
#content%
\endgroup%}

\protect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%= %%%%%%
\stopmodule

What have I to do if, instea= d of "color" or "style", I want to use another keyword,= as "dummy" and get its value? Something like

\= definelook[lol][dummy =3D blabla]
\lol{words}
%e.g.= words \emph{blabla} or something similar
so "lol" = is a word, a number or whatever. I've read something about command hand= lers, but I'm having a hard time trying to understand them. Thank you i= n advance!


--00000000000025f5c205a6c1e39e-- --===============6535298310038085507== 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== --===============6535298310038085507==--